parameter#
Physical quantities and instrument settings.
A basic data structure in EXA is the Parameter
, which represents
a single variable. The variable can be a high-level or low-level control knob of an instrument such as
the amplitude of a pulse or a control voltage; a physical quantity such as resonance frequency; or an abstract concept
like the number of averages in a measurement.
The Parameter is a simple structure with a name, label, unit and a datatype without much functionality.
The Setting
combines a Parameter and a value of the corresponding type.
Like Parameters, Settings are lightweight objects that contain information but don’t do anything by themselves.
>>> from exa.common.data.parameter import Parameter, Setting
>>> p = Parameter('qubit_1.drive.pi_pulse.duration', 'Duration', 's')
>>> s = Setting(p, 1e-6)
>>> print(s)
Setting(Duration = 1e-06 s)
The Settings are immutable, which means that the value can’t be changed, we can only make a copy with another value. When assigning a new value to a Setting, the datatype of the value is validated against the expected datatype of the parameter.
>>> setting1 = p.set(500) # an alternative way to transform a parameter into a setting
>>> setting2 = setting1.update(300)
>>> setting1.value
500
>>> setting2.value
300
>>> setting1.parameter == setting2.parameter
True
Full path: exa.common.data.parameter
Classes
Parameter collection type. |
|
Parameter data type. |
|
A basic data structure that represents a single variable. |
|
Physical quantity represented as a Parameter attached to a numerical value. |
Inheritance
