Model Blender Rules
Blending models relies on rules to define how to evaluate all the input values for a model attribute in order to determine the final output value. These rules then get specified in the model schema for each attribute.
The rules get interpreted and applied as list or array operations that work on the set of input values for each attribute. The full set of pre-defined rules includes
import numpy as np
# translation dictionary for function entries from rules files
blender_funcs = {'first': first,
'last': last,
'float_one': float_one,
'int_one': int_one,
'zero': zero,
'multi': multi,
'multi?': multi1,
'mean': np.mean,
'sum': np.sum,
'max': np.max,
'min': np.min,
'stddev': np.std,
'mintime': mintime,
'maxtime': maxtime,
'mindate': mindate,
'maxdate': maxdate,
'mindatetime': mindatetime,
'maxdatetime': maxdatetime}
The rules that should be referenced in the model schema definition are the
keys defined for jwst.model_blender.blender_rules.blender_funcs
listed
above. This definition illustrates how several rules are simply interfaces for
numpy array operations, while others are defined internally to model_blender
.
jwst.model_blender.blendrules Module
blendmeta - Merge metadata from multiple models to create a new metadata instance and table
Functions
|
Return a list of keyword names. |
|
Return first item from list of values |
|
Return a constant floating point value of 1.0 |
|
Return an integer value of 1 |
|
Generate rule for single attribute from input line from rules file. |
|
Generate the rule(s) specified by the entry from the rules file. |
|
Return last item from list of values |
|
Return the maximum date from a list of date strings in yyyy-mm-dd format. |
|
Return the maximum datetime from a list of datetime strings in ISO-8601 format. |
|
|
|
Return the minimum date from a list of date strings in yyyy-mm-dd format. |
|
Return the minimum datetime from a list of datetime strings in ISO-8601 format. |
|
|
|
This will either return the common value from a list of identical values or 'MULTIPLE' |
|
This will either return the common value from a list of identical values or the single character '?' |
|
Return a value of 0 |
Classes
|
Read in the rules used to interpret the keywords from the specified instrument image header. |
|
This class encapsulates the logic needed for interpreting a single keyword rule from a text file. |