-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/spectral model #763
Refactor/spectral model #763
Conversation
Codecov Report
@@ Coverage Diff @@
## staging #763 +/- ##
=========================================
+ Coverage 80.4% 80.8% +0.4%
=========================================
Files 70 71 +1
Lines 4043 4061 +18
Branches 720 730 +10
=========================================
+ Hits 3252 3285 +33
+ Misses 664 645 -19
- Partials 127 131 +4
Continue to review full report at Codecov.
|
…/pyglotaran into refactor/spectral_model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the requested change to the docstring, this LGTM.
Also, one more minor side note, don't use blank # Allow printing in test files
test_*.py: T001 |
We should do this in a followup PR where we add flake8-print to pre-commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine now
Update typing and docstrings Correct typo sanatize -> sanitize (incl rename to sanitize.py)
Move sanatize.py to sanitize.py and update dependencies
Convert scientific notation string (e.g. 1E7) to proper floats
…loat or int typed properties which are parsed as strings.
Refactor/spectral model addendum
Kudos, SonarCloud Quality Gate passed!
|
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.38%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Benchmark is done. Checkout the benchmark result page. Benchmark diffParametrized benchmark signatures: BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now.
* Added SpectralShapeGaussian. * Replaced property energy_spectrum of SpectralMegacomplex with invert and axis_scale. * Made invert and axis_scale dataset properties. * Added guard and meaningful exception message for spectral skewness * Fixed scaling * Made SpectralShapeSkewedGaussian decendent of SpectralShapeGaussian and added fallback for skewness == 0. * Move sanatize.py to utils module and correct typo sanatize -> sanitize (incl rename to sanitize.py) * Move regex patterns to seperate module in utils * Add sanity_scientific_notation_conversion Convert scientific notation string (e.g. 1E7) to proper floats * Fixed spectral megacomplex test parameters and added test for inverted axis * Removed model_item._from_list * Added convenience in model_item.from_dict for automatically convert float or int typed properties which are parsed as strings. * Made amplitude of shape optional Co-authored-by: Joris Snellenburg <[email protected]>
* Added SpectralShapeGaussian. * Replaced property energy_spectrum of SpectralMegacomplex with invert and axis_scale. * Made invert and axis_scale dataset properties. * Added guard and meaningful exception message for spectral skewness * Fixed scaling * Made SpectralShapeSkewedGaussian decendent of SpectralShapeGaussian and added fallback for skewness == 0. * Move sanatize.py to utils module and correct typo sanatize -> sanitize (incl rename to sanitize.py) * Move regex patterns to seperate module in utils * Add sanity_scientific_notation_conversion Convert scientific notation string (e.g. 1E7) to proper floats * Fixed spectral megacomplex test parameters and added test for inverted axis * Removed model_item._from_list * Added convenience in model_item.from_dict for automatically convert float or int typed properties which are parsed as strings. * Made amplitude of shape optional Co-authored-by: Joris Snellenburg <[email protected]>
* Added SpectralShapeGaussian. * Replaced property energy_spectrum of SpectralMegacomplex with invert and axis_scale. * Made invert and axis_scale dataset properties. * Added guard and meaningful exception message for spectral skewness * Fixed scaling * Made SpectralShapeSkewedGaussian decendent of SpectralShapeGaussian and added fallback for skewness == 0. * Move sanatize.py to utils module and correct typo sanatize -> sanitize (incl rename to sanitize.py) * Move regex patterns to seperate module in utils * Add sanity_scientific_notation_conversion Convert scientific notation string (e.g. 1E7) to proper floats * Fixed spectral megacomplex test parameters and added test for inverted axis * Removed model_item._from_list * Added convenience in model_item.from_dict for automatically convert float or int typed properties which are parsed as strings. * Made amplitude of shape optional Co-authored-by: Joris Snellenburg <[email protected]>
This PR introduces some changes to the spectral model in order to "straighten it out" and enable TIMP like behaviour.
Change summary
SpectralShapeGaussian
as shape typegaussian
skewness
property mandatory for shapeskewed-gaussian
energy_spectrum
property from spectral megacomplexspectral_axis_inverted
andspectral_axis_scale
to dataset model (see below)Changes to spectral axis
The old behaviour was to invert the axis as
axis = 1e7 / axis
ifenergy_spectrum
was set true in the corresponding megacomplex.The new behaviour inverts the axis as
axis = dataset_model.spectral_axis_scale / axis
ifspectral_axis_inverted
property of the dataset model is set true. Thespectral_axis_scale
is also a dataset model property and is default1
. If the inverted property is not set and scale !=1
is provided, the axis will be scaled asaxis = dataset_model.spectral_axis_scale * axis
Checklist