Skip to content

laboneq.dsl.parameter

Parameter dataclass

Bases: ABC

Parent class for sweep parameters in a LabOne Q Experiment.

Attributes:

Name Type Description
uid str

A unique ID for the parameter. If not supplied, one will be automatically generated.

LinearSweepParameter dataclass

Bases: _ParameterArithmeticMixin, Parameter

A linear sweep parameter.

The parameter is swept through the values generated by numpy.linspace(start, stop, count).

Attributes:

Name Type Description
start Number

The starting value of the parameter sweep.

stop Number

The final value of the parameter sweep.

count Number

The number of sweep steps in the parameter sweep.

axis_name str

The name of the sweep axis for this parameter used in the results. If this argument is not defined, the uid of the parameter will be used. Default None.

Examples:

As with SweepParameter one can perform arithmetic operations on linear sweep parameters:

>>> param = 3 * linear_param
>>> param = np.sin(param)

See SweepParameter for a complete description.

Changed in 2.14.0

Support for applying numpy ufuncs (e.g. np.sin) was added.

values: ArrayLike property

The values swept by the parameter.

SweepParameter dataclass

Bases: _ParameterArithmeticMixin, Parameter

An arbitrary sweep parameter.

Attributes:

Name Type Description
values ArrayLike

An arbitrary numpy array whose values are used as the sweep parameter.

axis_name str

The name of the sweep axis for this parameter used in the results. If this argument is not defined, the uid of the parameter will be used. Default None.

driven_by list[SweepParameter]

Optional and usually absent. If given, specifies the list of SweepParameter objects that this one is derived from. See the notes below for an example. Parameters should have the same shape as the ones they are driven by. Incorrect shapes will raise a ValueError. Default None.

Examples:

The driven_by parameter is automatically set on the parameters created when we apply arithmetic operations. For example:

>>> triple_param = 3 * param

creates a new sweep parameter triple_param that is driven by param.

Similarly, one may apply other numpy operations such as:

>>> sin_param = np.sin(param)

One may also manually create more complex derived parameters:

>>> param = SweepParameter(np.linspace(0, np.pi, 10))
>>> sin_param = SweepParameter(
        values=np.sin(param.values),
        driven_by=[param],
    )

A sweep parameter may also be driven by multiple parameters, as is the case when adding parameters:

>>> param = param_1 + param_2

which creates a new parameter param that is the sum of param_1 and param_2 and is driven by both.

When a sweep parameter is driven by multiple others, the others must all be swept simultaneously.

Operations that create parameters of different shapes to the ones they are driven by will be rejected by raising a ValueError.

Changed in 2.14.0

Support for applying numpy ufuncs (e.g. np.sin) was added.