Bases: object
A group of models with attached parameters that can be used to infer the parameter values at an arbitrary point in the space defined by the models.
models must be a sequence of models or a 2-tuple with the second element a dictionary. If a model sequnce, they must all have the same parameter names and have compatible inputs. Otherwise, the first element specifies the type of model to use, and the second is a dictionary mapping parameter names to a sequence of parameter values.
The resultant models are expected to be a “sequence” in the sense that they can be interpolated across to get a meaningful parameter value between two models (e.g. double-valued model grids are not meaningful)
extraparams are parameters not a part of the model that are still available to be interpolated over. It must be None or a dictionary with values that are the same length as the model sequence.
output contraction can be either a function to call on the output of the models returning a scalar, None to do nothing to the output, ‘dist’ to use the euclidian distance (e.g. sqrt(sum(output**2)), or ‘sqdist’ to use the square of the distance.
interpolation may be either ‘linear’ for simple linear interpolation along the y-axis, or a 1D Model that will be fit with fitData on the contracted outputs.
interpolationdirection determines the direction along which interpolation is to be performed, and can be:
‘y’: interpolate along the output axis (by far the fastest method)
for the models
the closest model to the data point. Only meaningful for FunctionModel1D Models.
offgrid determines the behavior if a location is requested that is beyond the limits of the model sequence. It can be:
models must be a sequence of models or a 2-tuple with the second element a dictionary. If a model sequnce, they must all have the same parameter names and have compatible inputs. Otherwise, the first element specifies the type of model to use, and the second is a dictionary mapping parameter names to a sequence of parameter values.
The resultant models are expected to be a “sequence” in the sense that they can be interpolated across to get a meaningful parameter value between two models (e.g. double-valued model grids are not meaningful)
extraparams are parameters not a part of the model that are still available to be interpolated over. It must be None or a dictionary with values that are the same length as the model sequence.
output contraction can be either a function to call on the output of the models returning a scalar, None to do nothing to the output, ‘dist’ to use the euclidian distance (e.g. sqrt(sum(output**2)), or ‘sqdist’ to use the square of the distance.
interpolation may be either ‘linear’ for simple linear interpolation along the y-axis, or a 1D Model that will be fit with fitData on the contracted outputs.
interpolationdirection determines the direction along which interpolation is to be performed, and can be:
‘y’: interpolate along the output axis (by far the fastest method)
for the models
the closest model to the data point. Only meaningful for FunctionModel1D Models.
offgrid determines the behavior if a location is requested that is beyond the limits of the model sequence. It can be:
Methods
__init__(models[, extraparams, ...]) | models must be a sequence of models or a 2-tuple with the second |
getParam(x, y[, parnames, contracty]) | Computes the value of a requested parameter at the provided point in the input/output space of the models. |
getParamArray(parnames) | Generates an array of values for the requested parameter corresponding to each of the models. |
getParams(xs, ys[, parnames, contracty]) | Get parameters for an array of inputs - xs and ys should be matching sequences which each item matches the input and ouptut types of the models. |
plot1D([x1, x2, legend, clf, n]) | Plots the models in this ModelSequence assuming the models are 1D |
Attributes
extraparams | A tuple of the possible extra parameter names for this ModelSequence or |
interpolation | |
interpolationdirection | |
offgrid | |
outputcontraction | |
params | a tuple of the possible parameter names for this ModelSequence |
A tuple of the possible extra parameter names for this ModelSequence or None if there are none
Computes the value of a requested parameter at the provided point in the input/output space of the models.
parnames can be a single parameter name (output is then a scalar), a stirng with a comma-seperated list of parameters, a sequence of parameter names, or None to get a dictionary mapping parameter names to their value at the provided point
x and y should be inputs and outputs, respectively, of the Model objects that define this sequence.
if contracty is True, the output contraction will be applied to the provided y-value. Otherwise, it should be a scalar.
Generates an array of values for the requested parameter corresponding to each of the models.
parnames can be a single parameter name (output is then a scalar), a stirng with a comma-seperated list of parameters, a sequence of parameter names, or None to get a dictionary mapping parameter names to their arrays
Get parameters for an array of inputs - xs and ys should be matching sequences which each item matches the input and ouptut types of the models. For more info, see ModelSequence.getParam
Plots the models in this ModelSequence assuming the models are 1D
x1 and x2 are the upper and lower limits to the plot. If not specified, the rangehints for the models will be used
The output contraction function will be used to compute the y-axis.
legend determines if the legend with parameter value should be shown on the plot
kwargs are passed into the models’ plot method (except for n)