parameter

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

CollectionType

Parameter collection type.

DataType

Parameter data type.

Parameter

A basic data structure that represents a single variable.

Setting

Physical quantity represented as a Parameter attached to a numerical value.

Inheritance

digraph inheritance96aeb1f401 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CollectionType" [URL="exa.common.data.parameter.CollectionType.html#exa.common.data.parameter.CollectionType",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter collection type."]; "IntEnum" -> "CollectionType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DataType" [URL="exa.common.data.parameter.DataType.html#exa.common.data.parameter.DataType",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Parameter data type."]; "IntEnum" -> "DataType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Enum" [URL="https://docs.python.org/3.11/library/enum.html#enum.Enum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Create a collection of name/value pairs."]; "IntEnum" [URL="https://docs.python.org/3.11/library/enum.html#enum.IntEnum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Enum where members are also (and must be) ints"]; "ReprEnum" -> "IntEnum" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Parameter" [URL="exa.common.data.parameter.Parameter.html#exa.common.data.parameter.Parameter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A basic data structure that represents a single variable."]; "ReprEnum" [URL="https://docs.python.org/3.11/library/enum.html#enum.ReprEnum",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Only changes the repr(), leaving str() and format() to the mixed-in type."]; "Enum" -> "ReprEnum" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Setting" [URL="exa.common.data.parameter.Setting.html#exa.common.data.parameter.Setting",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Physical quantity represented as a Parameter attached to a numerical value."]; }