Skip to content
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

Evaluate blueice_anchors expression #124

Merged
merged 4 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ parameter_definition:
uncertainty: 'stats.uniform(loc=-2, scale=4)'
# relative_uncertainty: false
fittable: true
blueice_anchors:
- -2
- -1
- 0
- 1
- 2
blueice_anchors: 'np.arange(-2, 3)'
fit_limits:
- -2
- 2
Expand Down
18 changes: 17 additions & 1 deletion alea/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
ptype: Optional[str] = None,
uncertainty: Optional[Union[float, str]] = None,
relative_uncertainty: Optional[bool] = None,
blueice_anchors: Optional[List] = None,
blueice_anchors: Optional[Union[list, str]] = None,
fit_limits: Optional[Tuple] = None,
parameter_interval_bounds: Optional[Tuple[float, float]] = None,
fit_guess: Optional[float] = None,
Expand Down Expand Up @@ -95,6 +95,22 @@ def uncertainty(self, value: Optional[Union[float, str]]) -> None:
)
self._uncertainty = value

@property
def blueice_anchors(self) -> Any:
"""Return the blueice_anchors of the parameter.

If the blueice_anchors is a string, it will be evaluated as a numpy or scipy function.

"""
if isinstance(self._blueice_anchors, str):
return evaluate_numpy_scipy_expression(self._blueice_anchors).tolist()
else:
return self._blueice_anchors

@blueice_anchors.setter
def blueice_anchors(self, value: Optional[Union[list, str]]) -> None:
self._blueice_anchors = value

@property
def fit_guess(self) -> Optional[float]:
"""Return the initial guess for fitting the parameter."""
Expand Down
Loading