-
Notifications
You must be signed in to change notification settings - Fork 1
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
Simplify TemplateSource, CombinedSource and SpectrumTemplateSource #69
Merged
Merged
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
ec0bc27
Simplify TemplateSource
dachengx cd0a594
Update settings of utils, add SR2 to demo CombinedSource
dachengx 1f9251b
Minor change
dachengx 789e3f2
Set numpy version to less than 1.23.0
dachengx e1aac2a
Update docstring to Google style
dachengx ef53ff8
Check needed weighted parameters of CombinedSource
dachengx 459c93b
Update docstring
dachengx e1cf100
Merge remote-tracking branch 'origin/main' into simplify_source
dachengx 698e0ba
No need to use multiple inheritance
dachengx c7252e8
Merge branch 'main' into simplify_source
dachengx 462fb5b
Raise error when there is no key in the json file
dachengx 20b53de
Merge remote-tracking branch 'origin/main' into simplify_source
dachengx de2044d
Recover logging, update docstring
dachengx 07fb1c0
Kill cache of coverage
dachengx 6fd9c19
Test SpectrumTemplateSource
dachengx 1356abb
Demo future callable uncertainty
dachengx 52c2681
Use latest numpy
dachengx bf29d49
Rename histogram_multiplier to histogram_scale_factor
dachengx c2b0cf3
Merge remote-tracking branch 'origin/main' into simplify_source
dachengx b3955f3
Test template source separately in another test module
dachengx b063d6e
Remove double quotes if not necessary
dachengx 4f5508a
Forget to upload this file
dachengx 68d2a2a
tiny typo
kdund 72b4e17
tiny docstring change
kdund acbd7db
Fix little typo
dachengx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"coordinate_system": [ | ||
0.0, | ||
100.0 | ||
], | ||
"map": [ | ||
1.0, | ||
1.0 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import warnings | ||
from typing import Any, Dict, List, Optional, Tuple | ||
|
||
import scipy | ||
from alea.utils import within_limits, clip_limits | ||
|
||
|
||
class Parameter: | ||
|
@@ -46,8 +46,8 @@ def __init__( | |
self.nominal_value = nominal_value | ||
self.fittable = fittable | ||
self.ptype = ptype | ||
self.uncertainty = uncertainty | ||
self.relative_uncertainty = relative_uncertainty | ||
self.uncertainty = uncertainty | ||
self.blueice_anchors = blueice_anchors | ||
self.fit_limits = fit_limits | ||
self.parameter_interval_bounds = parameter_interval_bounds | ||
|
@@ -66,21 +66,22 @@ def __repr__(self) -> str: | |
def uncertainty(self) -> float or Any: | ||
""" | ||
Return the uncertainty of the parameter. | ||
If the uncertainty is a string, it can be evaluated as a numpy or scipy function. | ||
""" | ||
if isinstance(self._uncertainty, str): | ||
# Evaluate the uncertainty if it's a string starting with "scipy." or "numpy." | ||
if self._uncertainty.startswith("scipy.") or self._uncertainty.startswith("numpy."): | ||
return eval(self._uncertainty) | ||
else: | ||
raise ValueError( | ||
f"Uncertainty string '{self._uncertainty}'" | ||
" must start with 'scipy.' or 'numpy.'") | ||
NotImplementedError( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the challenge in not including this functionality for now? |
||
"Only float uncertainties are supported at the moment.") | ||
else: | ||
return self._uncertainty | ||
|
||
@uncertainty.setter | ||
def uncertainty(self, value: float or str) -> None: | ||
""" | ||
Uncertainty can be a float or a string, but can only be a float if relative_uncertainty | ||
""" | ||
if self.relative_uncertainty and isinstance(value, str): | ||
raise ValueError( | ||
f"relative_uncertainty is not supported for " | ||
f"string uncertainties of {self.name}.") | ||
self._uncertainty = value | ||
|
||
@property | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think making all our tests usig the same large config is not optimal-- could we make smaller likelihoods for each aspects of the test?