Procedure class

class pymeasure.experiment.procedure.Procedure(**kwargs)

Provides the base class of a procedure to organize the experiment execution. Procedures should be run by Workers to ensure that asynchronous execution is properly managed.

procedure = Procedure()
results = Results(procedure, data_filename)
worker = Worker(results, port)
worker.start()

Inheriting classes should define the startup, execute, and shutdown methods as needed. The shutdown method is called even with a software exception or abort event during the execute method.

If keyword arguments are provided, they are added to the object as attributes.

check_parameters()

Raises an exception if any parameter is missing before calling the associated function. Ensures that each value can be set and got, which should cast it into the right format. Used as a decorator @check_parameters on the startup method

evaluate_metadata()

Evaluates all Metadata objects, fixing their values to the current value

execute()

Preforms the commands needed for the measurement itself. During execution the shutdown method will always be run following this method. This includes when Exceptions are raised.

gen_measurement()

Create MEASURE and DATA_COLUMNS variables for get_datapoint method.

get_estimates()

Function that returns estimates that are to be displayed by the EstimatorWidget. Must be reimplemented by subclasses. Should return an int or float representing the duration in seconds, or a list with a tuple for each estimate. The tuple should consists of two strings: the first will be used as the label of the estimate, the second as the displayed estimate.

metadata_objects()

Returns a dictionary of all the Metadata objects

parameter_objects()

Returns a dictionary of all the Parameter objects and grabs any current values that are not in the default definitions

parameter_values()

Returns a dictionary of all the Parameter values and grabs any current values that are not in the default definitions

parameters_are_set()

Returns True if all parameters are set

static parse_columns(columns)

Get columns with any units in parentheses. For each column, if there are matching parentheses containing text with no spaces, parse the value between the parentheses as a Pint unit. For example, “Source Voltage (V)” will be parsed and matched to Unit('volt'). Raises an error if a parsed value is undefined in Pint unit registry. Return a dictionary of matched columns with their units.

Parameters

columns – List of columns to be parsed.

Returns

Dictionary of columns with Pint units.

classmethod placeholder_names()

Collect the names of all eligible placeholders (parameters & metadata)

placeholder_objects()

Collect all eligible placeholders (parameters & metadata) with their value in a dict.

refresh_parameters()

Enforces that all the parameters are re-cast and updated in the meta dictionary

set_parameters(parameters, except_missing=True)

Sets a dictionary of parameters and raises an exception if additional parameters are present if except_missing is True

shutdown()

Executes the commands necessary to shut down the instruments and leave them in a safe state. This method is always run at the end.

startup()

Executes the commands needed at the start-up of the measurement

class pymeasure.experiment.procedure.UnknownProcedure(parameters)

Handles the case when a Procedure object can not be imported during loading in the Results class

startup()

Executes the commands needed at the start-up of the measurement