punpy.digital_effects_table.measurement_function.MeasurementFunction

punpy.digital_effects_table.measurement_function.MeasurementFunction#

class punpy.digital_effects_table.measurement_function.MeasurementFunction(prop=None, xvariables=None, uncxvariables=None, yvariable=None, yunit='', corr_between=None, param_fixed=None, repeat_dims=None, corr_dims=None, separate_corr_dims=False, allow_some_nans=True, ydims=None, refxvar=None, sizes_dict=None, use_err_corr_dict=False, broadcast_correlation='syst')[source]#

MeasurementFunction class which provides all the functionality for propagating uncertainties using obsarray digital effects tables. This class needs to be subclassed, and a meas_function needs to be provided for the measurement function to propagate uncertainties through.

Parameters:
  • prop (punpy.MCPropagation or punpy. LPUPropagation) – punpy MC propagation or LPU propagation object. Defaults to None, in which case a MC propagation object with 100 MC steps is used.

  • xvariables (list(str), optional) – list of input quantity names, in same order as arguments in measurement function and with same exact names as provided in input datasets. Defaults to None, in which case get_argument_names function is used.

  • uncxvariables (list(str), optional) – list of input quantity names for which uncertainties should be propagated. Should be a subset of input quantity names. Defaults to None, in which case uncertainties on all input quantities are used.

  • yvariable (str, optional) – name of measurand. Defaults to None, in which case get_measurand_name_and_unit function is used.

  • yunit (str, optional) – unit of measurand. Defaults to “” (unitless).

  • corr_between (numpy.ndarray , optional) – Allows to specify the (average) error correlation coefficient between the various input quantities. Defaults to None, in which case no error-correlation is assumed.

  • param_fixed (list of bools, optional) – set to true or false to indicate for each input quantity whether it has to remain unmodified either when expand=true or when using repeated measurements, defaults to None (no inputs fixed).

  • repeat_dims (str or int or list(str) or list(int), optional) – Used to select the axis which has repeated measurements. Axis can be specified using the name(s) of the dimension, or their index in the ydims. The calculations will be performed seperately for each of the repeated measurments and then combined, in order to save memory and speed up the process. Defaults to -99, for which there is no reduction in dimensionality..

  • corr_dims (integer, optional) – set to positive integer to select the axis used in the correlation matrix. The correlation matrix will then be averaged over other dimensions. Defaults to -99, for which the input array will be flattened and the full correlation matrix calculated.

  • separate_corr_dims (bool, optional) – When set to True and output_vars>1, corr_dims should be a list providing the corr_dims for each output variable, each following the format defined in the corr_dims description. Defaults to False

  • allow_some_nans (bool, optional) – set to False to ignore any MC sample which has any nan’s in the measurand. Defaults to True, in which case only MC samples with only nan’s are ignored.

  • ydims (list(str), optional) – list of dimensions of the measurand, in correct order. list of list of dimensions when there are multiple measurands. Default to None, in which case it is assumed to be the same as refxvar (see below) input quantity.

  • refxvar (string, optional) – name of reference input quantity that has the same shape as measurand. Defaults to None

  • sizes_dict (dict, optional) – Dictionary with sizes of each of the dimensions of the measurand. Defaults to None, in which cases sizes come from input quantites.

  • use_err_corr_dict (bool, optional) – when possible, use dictionaries with separate error-correlation info per dimension in order to save memory

  • broadcast_correlation (str) – correlation form (“rand” or “syst” to use when broadcasting

__init__(prop=None, xvariables=None, uncxvariables=None, yvariable=None, yunit='', corr_between=None, param_fixed=None, repeat_dims=None, corr_dims=None, separate_corr_dims=False, allow_some_nans=True, ydims=None, refxvar=None, sizes_dict=None, use_err_corr_dict=False, broadcast_correlation='syst')[source]#

Methods

__init__([prop, xvariables, uncxvariables, ...])

get_argument_names()

This function allows to return the names of the input quantities as a list of strings.

get_measurand_name_and_unit()

This function allows to return the name and unit of the measurand as strings.

meas_function(*args, **kwargs)

meas_function is the measurement function itself, to be used in the uncertainty propagation.

propagate_ds(*args[, store_unc_percent, ...])

Function to propagate the uncertainties on the input quantities present in the digital effects tables provided as the input arguments, through the measurement function to produce an output digital effects table with the combined random, systematic and structured uncertainties on the measurand

propagate_ds_all(*args[, store_unc_percent, ...])

Function to propagate the uncertainties on the input quantities present in the digital effects tables provided as the input arguments, through the measurement function to produce an output digital effects table with the combined random, systematic and structured uncertainties on the measurand

propagate_ds_specific(comp_list, *args[, ...])

Function to propagate the uncertainties on the input quantities present in the digital effects tables provided as the input arguments, through the measurement function to produce an output digital effects table with the uncertainties of specific components listed in comp_list.

propagate_ds_total(*args[, ...])

Function to propagate the total uncertainties present in the digital effects tables in the input arguments, through the measurement function to produce an output digital effects table with the total uncertainties on the measurand

propagate_random(*args[, expand])

Function to propagate uncertainties for the random uncertainty component.

propagate_specific(form, *args[, expand, ...])

Function to propagate uncertainties for a specific uncertainty component.

propagate_structured(*args[, expand, ...])

Function to propagate uncertainties for the structured uncertainty component.

propagate_systematic(*args[, expand])

Function to propagate uncertainties for the systemtic uncertainty component.

propagate_total(*args[, expand, return_corr])

Function to propagate uncertainties for the total uncertainty component.

run(*args[, expand])

Function to calculate the measurand by running input quantities through measurement function.

setup(*args, **kwargs)

This function is to provide a setup stage that can be run before propagating uncertainties.

update_measurand(measurand, measurand_unit)