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
- Return type:
None
- evaluate_metadata()
Evaluates all Metadata objects, fixing their values to the current value
- Return type:
None
- execute()
Perform 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.
- Return type:
None
- gen_measurement()
Create MEASURE and DATA_COLUMNS variables for get_datapoint method.
- Return type:
None
- 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.
- Return type:
Union[int,float,list[tuple[str,str]]]
- is_last()
Check if the procedure is the last one in the queue.
This method must be monkey patched by a worker to provide functionality.
- Return type:
bool
- Returns:
bool: True if the procedure is the last one in the queue, False otherwise.
- metadata_objects()
Returns a dictionary of all the Metadata objects
- Return type:
dict[str,Metadata]
- parameter_objects()
Returns a dictionary of all the Parameter objects and grabs any current values that are not in the default definitions
- Return type:
dict[str,Parameter]
- parameter_values()
Returns a dictionary of all the Parameter values and grabs any current values that are not in the default definitions
- Return type:
dict[str,Any]
- parameters_are_set()
Returns True if all parameters are set
- Return type:
bool
- 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[str]) – List of columns to be parsed.- Returns:
dict[str,PlainUnit] – Dictionary of columns with Pint units.
- classmethod placeholder_names()
Collect the names of all eligible placeholders (parameters & metadata)
- Return type:
list[str]
- placeholder_objects()
Collect all eligible placeholders (parameters & metadata) with their value in a dict.
- refresh_parameters()
No-op retained for API compatibility. :rtype:
NoneDeprecated since version 0.17.0: Historically re-cast parameter values; now a no-op retained for API compatibility since
__set__eagerly converts values at assignment time.
- 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
- Return type:
None
- 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.
- Return type:
None
- startup()
Executes the commands needed at the start-up of the measurement
- Return type:
None
- class pymeasure.experiment.procedure.ProcedureStatus(*values)
- class pymeasure.experiment.procedure.UnknownProcedure(parameters)
Handles the case when a
Procedureobject can not be imported during loading in theResultsclass- metadata_objects()
Returns a dictionary of all the Metadata objects
- Return type:
dict[str,Metadata]
- parameter_objects()
Returns a dictionary of all the Parameter objects and grabs any current values that are not in the default definitions
- Return type:
dict[str,Parameter]
- startup()
Executes the commands needed at the start-up of the measurement
- Return type:
None