autowisp.evaluator module
Class Inheritance Diagram

More convenient interface to asteval interpreters.
- class autowisp.evaluator.Evaluator(*data)[source]
Bases:
EvaluatorBase
Evaluator for expressions involving fields of numpy array or headers.
- __init__(*data)[source]
Get ready to evaluate expressions given data.
- Parameters:
data ([dict-like]) – A mapping between variable names that will participate in the expressions to be evaluated and the value that should be used. In case of repeating keys, later entries overwrite earlier ones.
- Returns:
None
- class autowisp.evaluator.EvaluatorBase[source]
Bases:
Interpreter
Asteval interpreter with the symbols all AutoWISP expressions share.
- __call__(*args, **kwargs)[source]
Evaluate the expression, raising rather than returning None on error.
Asteval defaults to printing the error and returning
None, which only relocates the failure: theNoneflows on and breaks somewhere unrelated, long after the message about the offending expression has scrolled away. Callers wanting the permissive behaviour can still passraise_errors=Falseexplicitly.
- __init__()[source]
Create an interpreter with AutoWISP’s symbol table.
Sub-classes should add their data to the symbol table after invoking this, so a variable named like one of the aggregates shadows the function rather than the other way around.
- Returns:
None
- nan_aggregates = ('nanmean', 'nanmedian', 'nanstd', 'nanvar', 'nansum', 'nanprod', 'nanmin', 'nanmax', 'nanpercentile', 'nanquantile', 'nanargmin', 'nanargmax', 'nancumsum', 'nancumprod')
- removed_names = ('open', 'print')
- class autowisp.evaluator.LightCurveEvaluator(lightcurve, lc_points_selection=None, **lc_substitutions)[source]
Bases:
EvaluatorBase
Evaluator for expressions involving lightcurve datasets.
- __init__(lightcurve, lc_points_selection=None, **lc_substitutions)[source]
Get ready to evaluate expressions against the given light curve.
- property lc_points_selection
Getter for the poins selection property.
- property lc_substitutions
Substitutions to apply to resolve lightcurve datasets.
These can be changed after creating the instance.
- class autowisp.evaluator.LightCurveLookUp(key_prefix, evaluator)[source]
Bases:
object
Look up datasets under specific key prefix.
- autowisp.evaluator.eval_iterative_rej_polynomial_fit(x, y, *args, **kwargs)[source]
Allow using
iterative_rej_polynomial_fit()in evaluators.
- autowisp.evaluator.eval_iterative_rej_smoothing_spline(x, *args, **kwargs)[source]
Allow using
iterative_rej_smoothing_spline()in evaluators.
- autowisp.evaluator.eval_iterative_rejection_average(*args, **kwargs)[source]
Allow using
iterative_rejection_average()in evaluators.
- autowisp.evaluator.nanrank(x)[source]
Return each entry’s rank as a fraction of the finite entries.
The smallest of n finite values ranks
1/nand the largest1; ties share the average of the ranks they span, and NaN stays NaN without counting towards n. This is pandas’rank(pct=True), which is what the photometric reference merit’sqnt_<name>columns used, so a merit rewritten in terms of this ranks candidates the same way.Unlike the aggregates in
EvaluatorBase.nan_aggregates, the result has one entry per input entry, so it composes element-wise with the values it ranks.- Parameters:
x (array-like) – The values to rank.
- Returns:
- The ranks, as floats in
(0, 1], shaped like x.
- The ranks, as floats in
- Return type:
numpy.ndarray