InputsContainer

class InputsContainer(task_cls, context, *args, **kwargs)[source]

Bases: object

InputsContainer is the top-level container object for all task Inputs.

InputsContainer contains machinery to let Inputs classes operate purely in the scope of a single measurement set, to make both Inputs and Task implementation much simpler.

The InputsContainer operates in the scope of multiple measurement sets, and holds one Inputs instance for every measurement set within the context At task execution time, the task is executed for each active Inputs instance. Not all the Inputs instances held by the InputsContainer need be active: the user can reduce the scope of the task to a subset of measurement sets by setting vis, which makes an Inputs instance hidden and inactive.

Tasks that operate in the scope of more than one measurement set, e.g, imaging and session-aware tasks, can disable the InputsContainer machinery by setting is_multi_vis_task to True. For these multivis tasks, one Inputs instance is held in an InputsContainer, but all property sets and gets pass directly through the one underlying inputs instance.

For tasks that operate in the scope of a single measurement set, the InputsContainer class works in conjunction with VisDependentProperty to provide and process user input (eg. inputs.solint = 123) according to a set of rules:

  1. If the input is scalar and equal to '' or None, all measurement sets will be mapped back to NullMarker, therefore returning the default value or custom getter function on subsequent access.

  2. If the input is a list with number of items equal to the number of measurement sets, the items will be divided up and treated as mapping one value per measurement set.

  3. Otherwise, the user input is considered as the new default value for all measurement sets.

Before the user input is stored in the dictionary, however, the input is passed through the convert function, assuming one has been provided. The convert function allows the developer to validate or convert user input to a standard format before accepting it as a new argument.

Methods Summary

Methods Documentation

as_dict()[source]