autowisp.evaluator module

Class Inheritance Diagram

Inheritance diagram of DataReductionFile, Evaluator, EvaluatorBase, LightCurveEvaluator, LightCurveLookUp

More convenient interface to asteval interpreters.

class autowisp.evaluator.Evaluator(*data)[source]

Bases: EvaluatorBase

Inheritance diagram of autowisp.evaluator.Evaluator

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

Inheritance diagram of autowisp.evaluator.EvaluatorBase

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: the None flows on and breaks somewhere unrelated, long after the message about the offending expression has scrolled away. Callers wanting the permissive behaviour can still pass raise_errors=False explicitly.

__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

Inheritance diagram of autowisp.evaluator.LightCurveEvaluator

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.

update_substitutions(new_substitutions)[source]

Like update for dict but resets previously read datasets.

class autowisp.evaluator.LightCurveLookUp(key_prefix, evaluator)[source]

Bases: object

Inheritance diagram of autowisp.evaluator.LightCurveLookUp

Look up datasets under specific key prefix.

__getattr__(key_suffix)[source]

Return the given attribute, reading dataset if needed.

__init__(key_prefix, evaluator)[source]

Look up datasets with keys like <key_prefix>.<something>.