pace-neutrons / Euphonic

Euphonic is a Python package for efficient simulation of phonon bandstructures, density of states and inelastic neutron scattering intensities from force constants.
GNU General Public License v3.0
29 stars 11 forks source link

Spectrum refactoring, Spectrum2DCollection #305

Closed ajjackson closed 1 month ago

ajjackson commented 4 months ago

As part of a major refactor of Abins, we would like to use a Spectrum2DCollection object which behaves similarly to Spectrum1DCollection. This allows the code to largely treat 1D and 2D data interchangably, simplifying the logic and providing access to select/groupby "table-like" operations on the data.

This is implemented by factoring out the "collection"-specific methods to a "mixin" class. This gives a reasonable class heirarchy in which Spectrum1D, Spectrum2D, Spectrum1DCollection and Spectrum2DCollection are all children of Spectrum but not of each other.

In the process, we also found some limitations and inefficiencies in the existing Spectrum objects:

github-actions[bot] commented 4 months ago

Test Results

    22 files  ± 0      22 suites  ±0   30m 6s :stopwatch: +50s  1 054 tests + 6   1 048 :white_check_mark: + 6   6 :zzz: ±0  0 :x: ±0  10 480 runs  +60  10 417 :white_check_mark: +60  63 :zzz: ±0  0 :x: ±0 

Results for commit 0f7ec817. ± Comparison against base commit 82688812.

:recycle: This comment has been updated with latest results.

codecov-commenter commented 3 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 87.12871% with 13 lines in your changes missing coverage. Please review.

Project coverage is 95.47%. Comparing base (7608b14) to head (a50fc98). Report is 20 commits behind head on master.

Files Patch % Lines
euphonic/spectra.py 87.12% 11 Missing and 2 partials :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #305 +/- ## ========================================== - Coverage 95.85% 95.47% -0.39% ========================================== Files 28 28 Lines 3982 4021 +39 Branches 803 816 +13 ========================================== + Hits 3817 3839 +22 - Misses 97 109 +12 - Partials 68 73 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.