ParameterSet

class sofia_redux.pipeline.parameters.ParameterSet[source]

Bases: OrderedDict

Ordered dictionary of parameter values for a reduction step.

Sensible defaults are defined for all parameter fields in the set_param method.

Methods Summary

get_value(key)

Get the current value of the parameter.

set_param([key, value, dtype, wtype, name, ...])

Set a parameter key-value pair.

set_value(key[, value, options, ...])

Set a new value for a parameter.

Methods Documentation

get_value(key)[source]

Get the current value of the parameter.

Parameters:
keystr

Key name for the parameter.

Returns:
str, int, float, bool, or list

The current value of the parameter.

set_param(key='', value=None, dtype='str', wtype=None, name=None, options=None, option_index=0, description=None, hidden=False)[source]

Set a parameter key-value pair.

All input parameters are optional, although key values are necessary if more than one parameter is to be defined. The default values will create a string-valued parameter with an associated text-box widget. The default name matches the key value.

Parameters:
keystr, optional

The key for the parameter.

valuestr, int, float, bool, or list; optional

The value of the parameter. Should match dtype if provided.

dtype{‘str’, ‘int’, ‘float’, ‘bool’, ‘strlist’, ‘intlist’, ‘floatlist’, ‘boollist’}; optional

Data type of the parameter value. Basic data types understood by Redux are str, int, float, and bool, and lists of the same. Any other data type will be treated as a string.

wtype{‘text_box’, ‘check_box’, ‘combo_box’, ‘radio_button’, ‘pick_file’, ‘pick_directory’, ‘group’}; optional

Widget type to be used for editing the parameter in a GUI context. Ignored in command-line context.

namestr, optional

Display name or text for the parameter.

optionslist, optional

Enumerated list of possible values for the parameter. These values will be used as the displayed options in combo_box or radio_button widget types.

option_indexint, optional

If options is provided, this parameter sets the default selection.

descriptionstr, optional

Description of the parameter. In GUI context, the description will be shown in a tooltip when the parameter widget is hovered over.

hiddenbool, optional

If True, the parameter will be provided to the reduction step, but will not be displayed or editable by the user.

set_value(key, value=None, options=None, option_index=None, hidden=None)[source]

Set a new value for a parameter.

If the parameter does not yet exist, it will be created with default values for any items not provided.

Parameters:
keystr

Key name for the parameter.

valuestr, int, float, bool, or list; optional

New value for the parameter.

optionslist, optional

New enumerated value options for the parameter.

option_indexint, optional

New selected index for the value options.