atomiq.components.basics.calibration¶
In all experiments, calibrations are ubiquious. Examples are
voltage - power relation on a photodiode
Relation between the current through a coil and the created magentic field
RF power in an AOM and light power in the diffracted order
The current-voltage relation for a voltage-controlled current supply
...
In atomiq calibrations are comoponents just like every other piece of your experiment. Every calibration inherits
from the abstract Calibration class. A special subclass of calibration functions are invertable
calibrations that can be analytically inverted. The most frequently used example is a linear calibration function.
Invertable calibrations inherit from InvertableCalibration.
Classes¶
An abstract Calibration |
|
An abstract Calibration |
|
An abstract Calibration |
|
Calibration via data points |
|
Calibration via data points that can be inverted |
|
Calibration described by a polynomial |
|
Linear calibration |
|
Sigmoid calibration |
|
Inverse sigmoid calibration |
Functions¶
Module Contents¶
- atomiq.components.basics.calibration.exp(x)[source]¶
- Parameters:
x (artiq.language.types.TFloat)
- Return type:
artiq.language.types.TFloat
- atomiq.components.basics.calibration.ln(x, n=10000.0)[source]¶
- Parameters:
x (artiq.language.types.TFloat)
n (artiq.language.types.TFloat)
- Return type:
artiq.language.types.TFloat
- class atomiq.components.basics.calibration.Calibration(input_unit, output_unit, *args, **kwargs)[source]¶
Bases:
atomiq.components.primitives.ComponentAn abstract Calibration
This is an abstract class to describe a calibration.
- Parameters:
input_unit (artiq.language.types.TStr) -- A string determining the input unit (e.g. 'mW', 'V', or 'uA')
output_unit (artiq.language.types.TStr) -- A string determining the output unit (e.g. 'mW', 'V', or 'uA')
- kernel_invariants¶
- input_unit¶
- output_unit¶
- abstractmethod transform(input_value)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.InvertableCalibration(input_unit, output_unit, *args, **kwargs)[source]¶
Bases:
CalibrationAn abstract Calibration
This is an abstract class to describe a calibration.
- Parameters:
input_unit (artiq.language.types.TStr) -- A string determining the input unit (e.g. 'mW', 'V', or 'uA')
output_unit (artiq.language.types.TStr) -- A string determining the output unit (e.g. 'mW', 'V', or 'uA')
- abstractmethod transform_inv(input_value)[source]¶
Perform inverse transform of a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be inversely transformed. Must be given in units of the output unit
- Returns:
transformed value. The returned value is in units of the input unit
- Return type:
TFloat
- kernel_invariants¶
- input_unit¶
- output_unit¶
- abstractmethod transform(input_value)¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.DummyCalibration(*args, **kwargs)[source]¶
Bases:
CalibrationAn abstract Calibration
This is an abstract class to describe a calibration.
- Parameters:
input_unit -- A string determining the input unit (e.g. 'mW', 'V', or 'uA')
output_unit -- A string determining the output unit (e.g. 'mW', 'V', or 'uA')
- transform(input_value)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- kernel_invariants¶
- input_unit¶
- output_unit¶
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.SplineCalibration(calibration_points, *args, **kwargs)[source]¶
Bases:
CalibrationCalibration via data points
Data points are interpolated with linear splines
- Parameters:
calibration_points (TList(TList(TFloat))) -- List of tuples (x, y) containing the calibration data. The data must be ordered monotonously in x
- kernel_invariants¶
- calibration_points¶
- transform(input_value, invert=False)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
invert (artiq.language.types.TBool)
- Returns:
transformed value
- Return type:
TFloat
- input_unit¶
- output_unit¶
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.InvertableSplineCalibration(*args, **kwargs)[source]¶
Bases:
InvertableCalibration,SplineCalibrationCalibration via data points that can be inverted
Data points are interpolated with linear splines. For the inversion to work, both x and y of the calibration data must be monotonous.
- transform_inv(input_value)[source]¶
Perform inverse transform of a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be inversely transformed. Must be given in units of the output unit
- Returns:
transformed value. The returned value is in units of the input unit
- Return type:
TFloat
- kernel_invariants¶
- input_unit¶
- output_unit¶
- abstractmethod transform(input_value)¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- calibration_points¶
- class atomiq.components.basics.calibration.PolynomialCalibration(*args, coefficients, **kwargs)[source]¶
Bases:
CalibrationCalibration described by a polynomial
The calibration is given by the function
$$f(x) = sum_i c_i x^i$$
- Parameters:
coefficients (TList(TFloat)) -- List of coefficients $c_i$ of the polynomial, start from the lowest order.
- kernel_invariants¶
- coefficients¶
- transform(input_value)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- input_unit¶
- output_unit¶
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.LinearCalibration(a, b, *args, **kwargs)[source]¶
Bases:
InvertableCalibrationLinear calibration
The calibration is given by the function
$$f(x) = ax + b$$
- Parameters:
input_unit -- Unit of the input
output_unit -- Unit of the output
a (artiq.language.types.TFloat) -- Calibration coefficient a
b (artiq.language.types.TFloat) -- Calibration coefficient b
- kernel_invariants¶
- a¶
- b¶
- transform(input_value)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- transform_inv(output_value)[source]¶
Perform inverse transform of a value according to the calibration
- Parameters:
input_value -- value to be inversely transformed. Must be given in units of the output unit
output_value (artiq.language.types.TFloat)
- Returns:
transformed value. The returned value is in units of the input unit
- Return type:
TFloat
- input_unit¶
- output_unit¶
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.SigmoidCalibration(*args, A, k, x_offset=0, y_offset=0, **kwargs)[source]¶
Bases:
CalibrationSigmoid calibration
` output = A / ( 1 + e^k*(input - x_offset)) + y_offset `- Parameters:
input_unit -- Unit of the input
output_unit -- Unit of the output
A (artiq.language.types.TFloat) -- Amplitude of the sigmoid
k (artiq.language.types.TFloat) -- stretching of the sigmoid
x_offset (artiq.language.types.TFloat) -- offset on the x axis
y_offset (artiq.language.types.TFloat) -- offset on the y axis
- kernel_invariants¶
- A¶
- k¶
- x_offset = 0¶
- y_offset = 0¶
- transform(input_value)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- input_unit¶
- output_unit¶
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- class atomiq.components.basics.calibration.InvSigmoidCalibration(*args, A, k, x_offset=0, y_offset=0, **kwargs)[source]¶
Bases:
CalibrationInverse sigmoid calibration
` output = -ln( A / (input - y_offset) - 1) / k + x_offset `The parameters are defined in a way that they match the sigmoid definition.
- Parameters:
input_unit -- Unit of the input
output_unit -- Unit of the output
A (artiq.language.types.TFloat) -- Amplitude of the sigmoid
k (artiq.language.types.TFloat) -- stretching of the sigmoid
x_offset (artiq.language.types.TFloat) -- offset on the x axis
y_offset (artiq.language.types.TFloat) -- offset on the y axis
- kernel_invariants¶
- A¶
- k¶
- x_offset = 0¶
- y_offset = 0¶
- transform(input_value)[source]¶
Transform a value according to the calibration
- Parameters:
input_value (artiq.language.types.TFloat) -- value to be transformed
- Returns:
transformed value
- Return type:
TFloat
- input_unit¶
- output_unit¶
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _build()¶
Specify here what should be done for this component in the build phase
- _do_prerun()¶
- required_components(ancestors=[])¶
- _prerun()¶
Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.
- children = []¶
- __in_build = True¶
- register_child(child)¶
- call_child_method(method, *args, **kwargs)¶
Calls the named method for each child, if it exists for that child, in the order of registration.
- Parameters:
method (str) -- Name of the method to call
args -- Tuple of positional arguments to pass to all children
kwargs -- Dict of keyword arguments to pass to all children
- build()¶
Should be implemented by the user to request arguments.
Other initialization steps such as requesting devices may also be performed here.
There are two situations where the requested devices are replaced by
DummyDevice()and arguments are set to their defaults (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().Datasets are read-only in this method.
Leftover positional and keyword arguments from the constructor are forwarded to this method. This is intended for experiments that are only meant to be executed programmatically (not from the GUI).
- get_argument(key, processor, group=None, tooltip=None)¶
Retrieves and returns the value of an argument.
This function should only be called from
build.- Parameters:
key -- Name of the argument.
processor -- A description of how to process the argument, such as instances of
BooleanValueandNumberValue.group -- An optional string that defines what group the argument belongs to, for user interface purposes.
tooltip -- An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface.
- setattr_argument(key, processor=None, group=None, tooltip=None)¶
Sets an argument as attribute. The names of the argument and of the attribute are the same.
The key is added to the instance's kernel invariants.
- interactive(title='')¶
Request arguments from the user interactively.
This context manager returns a namespace object on which the method
setattr_argument()should be called, with the usual semantics.When the context manager terminates, the experiment is blocked and the user is presented with the requested argument widgets. After the user enters values, the experiment is resumed and the namespace contains the values of the arguments.
If the interactive arguments request is cancelled, raises
CancelledArgsError.
- get_device_db()¶
Returns the full contents of the device database.
- get_device(key)¶
Creates and returns a device driver.
- setattr_device(key)¶
Sets a device driver as attribute. The names of the device driver and of the attribute are the same.
The key is added to the instance's kernel invariants.
- set_dataset(key, value, *, unit=None, scale=None, precision=None, broadcast=False, persist=False, archive=True)¶
Sets the contents and handling modes of a dataset.
Datasets must be scalars (
bool,int,floator NumPy scalar) or NumPy arrays.- Parameters:
unit -- A string representing the unit of the value.
scale -- A numerical factor that is used to adjust the value of the dataset to match the scale or units of the experiment's reference frame when the value is displayed.
precision -- The maximum number of digits to print after the decimal point. Set
precision=Noneto print as many digits as necessary to uniquely specify the value. Uses IEEE unbiased rounding.broadcast -- the data is sent in real-time to the master, which dispatches it.
persist -- the master should store the data on-disk. Implies broadcast.
archive -- the data is saved into the local storage of the current run (archived as a HDF5 file).
- mutate_dataset(key, index, value)¶
Mutate an existing dataset at the given index (e.g. set a value at a given position in a NumPy array)
If the dataset was created in broadcast mode, the modification is immediately transmitted.
If the index is a tuple of integers, it is interpreted as
slice(*index). If the index is a tuple of tuples, each sub-tuple is interpreted asslice(*sub_tuple)(multi-dimensional slicing).
- append_to_dataset(key, value)¶
Append a value to a dataset.
The target dataset must be a list (i.e. support
append()), and must have previously been set from this experiment.The broadcast/persist/archive mode of the given key remains unchanged from when the dataset was last set. Appended values are transmitted efficiently as incremental modifications in broadcast mode.
- get_dataset(key, default=NoDefault, archive=True)¶
Returns the contents of a dataset.
The local storage is searched first, followed by the master storage (which contains the broadcasted datasets from all experiments) if the key was not found initially.
If the dataset does not exist, returns the default value. If no default is provided, raises
KeyError.By default, datasets obtained by this method are archived into the output HDF5 file of the experiment. If an archived dataset is requested more than one time or is modified, only the value at the time of the first call is archived. This may impact reproducibility of experiments.
- Parameters:
archive -- Set to
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.