atomiq.components.dummies

This module gathers different dummy components that mimic hardware but do nothing. They are mainly used for debugging atomiq

Classes

DummyADC

An analog-to-ditigal converter (ADC) with multiple channels

DummyRFSource

A dummy RFSource used for debugging

DummyDAC

A DAC with multiple channels

DummyActor

An atomiq Component

DummyMonitor

An atomiq Component

DummySwitch

An atomiq Component

DummyCore

A ARTIQ sim dummy core device that works with Atomiq.

Module Contents

class atomiq.components.dummies.DummyADC(return_value, *args, **kwargs)[source]

Bases: atomiq.components.electronics.adc.ADC

An analog-to-ditigal converter (ADC) with multiple channels

Many ADCs come with multiple channels that are always sampled together. This class represents such ADCs

Parameters:
  • num_chan -- Number of channels the ADC has.

  • return_value (artiq.language.types.TFloat)

kernel_invariants
return_value
_measure(target_arr)[source]
Parameters:

target_arr (TArray(TFloat))

Return type:

TArray(TFloat)

num_chan
invalid_return
_build()

Specify here what should be done for this component in the build phase

measure(samples=1, channel='')

Measures all channels and returns the mean for a given number of subsequent samples.

This method advances the timeline by samples * sampling_time

Parameters:
  • samples (artiq.language.types.TInt32) -- number of samples to take and average

  • channel (artiq.language.types.TStr)

Return type:

TArray(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()
_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 (or None) instead: when the repository is scanned to build the list of available experiments and when the dataset browser artiq_browser is used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments in build().

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 BooleanValue and NumberValue.

  • 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, float or 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=None to 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 as slice(*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 False to prevent archival together with the run's results. Default is True.

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.

measurement_channels()
class atomiq.components.dummies.DummyRFSource(default_frequency=100000000.0, default_amplitude=0.0, default_phase=0.0, freq_limit=(0.0, float('inf')), amp_limit=(0.0, 1.0), blind=False, default_ramp_steps=30, *args, **kwargs)[source]

Bases: atomiq.components.electronics.rfsource.RFSource

A dummy RFSource used for debugging

Parameters:
  • default_frequency (artiq.language.types.TFloat)

  • default_amplitude (artiq.language.types.TFloat)

  • default_phase (artiq.language.types.TFloat)

  • freq_limit (tuple)

  • amp_limit (tuple)

  • blind (artiq.language.types.TBool)

  • default_ramp_steps (artiq.language.types.TInt32)

_set_frequency(frequency)[source]
_set_amplitude(amplitude)[source]
_set_phase(phase)[source]
kernel_invariants
amplitude = 0.0
frequency = 100000000.0
phase = 0.0
default_ramp_steps = 30
blind = False
_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.

_prerun_blind()
set_frequency(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

_check_frequency(frequency)
get_frequency()
Return type:

artiq.language.types.TFloat

set_amplitude(amplitude)
Parameters:

amplitude (artiq.language.types.TFloat)

_check_amplitude(amplitude)
Parameters:

amplitude (artiq.language.types.TFloat)

get_amplitude()
Return type:

artiq.language.types.TFloat

set_phase(phase)
Parameters:

phase (artiq.language.types.TFloat)

get_phase()
Return type:

artiq.language.types.TFloat

set(frequency=float('nan'), amplitude=float('nan'), phase=0.0)

Set the frequency and amplitude of the DDS channel

Frequency/amplitude are set to the last known value if float("nan") is passed (default).

Parameters:
  • frequency (artiq.language.types.TFloat) -- Frequency in Hz (nan to use previous value)

  • amplitude (artiq.language.types.TFloat) -- Amplitude (nan to use previous value)

  • phase (artiq.language.types.TFloat) -- Phase in rad (default 0.0)

_ramp(duration, frequency_start, frequency_end, amplitude_start, amplitude_end, ramp_timestep=0.0002)

This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from RFSource

Parameters:
  • duration (artiq.language.types.TFloat)

  • frequency_start (artiq.language.types.TFloat)

  • frequency_end (artiq.language.types.TFloat)

  • amplitude_start (artiq.language.types.TFloat)

  • amplitude_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

ramp(duration, frequency_start=float('nan'), frequency_end=float('nan'), amplitude_start=float('nan'), amplitude_end=float('nan'), ramp_timestep=float('nan'), ramp_steps=-1)

Ramp frequency and amplitude over a given duration. Parameters default to -1 or nan to indicate no change. If the start frequency/amplitude is set to nan, the ramp starts from the last frequency/amplitude which was set. This method advances the timeline by ´duration´

Parameters:
  • duration (artiq.language.types.TFloat) -- ramp duration [s]

  • frequency_start (artiq.language.types.TFloat) -- initial frequency [Hz]

  • frequency_end (artiq.language.types.TFloat) -- end frequency [Hz]

  • amplitude_start (artiq.language.types.TFloat) -- initial amplitude [0..1]

  • amplitude_end (artiq.language.types.TFloat) -- end amplitude [0..1]

  • ramp_timesteps -- time between steps in the ramp [s]

  • ramp_steps (artiq.language.types.TInt32) -- number of steps the whole ramp should have. This takes precedence over ramp_timesteps

  • ramp_timestep (artiq.language.types.TFloat)

_arb(duration, samples_amp, samples_freq, samples_phase, repetitions=1, prepare_only=False, run_prepared=False, transform_amp=identity_float, transform_freq=identity_float, transform_phase=identity_float)
Parameters:
  • duration (artiq.language.types.TFloat)

  • samples_amp (TList(TFloat))

  • samples_freq (TList(TFloat))

  • samples_phase (TList(TFloat))

  • repetitions (artiq.language.types.TInt32)

  • prepare_only (artiq.language.types.TBool)

  • run_prepared (artiq.language.types.TBool)

arb(duration, samples_amp=[], samples_freq=[], samples_phase=[], repetitions=1, prepare_only=False, run_prepared=False, transform_amp=identity_float, transform_freq=identity_float, transform_phase=identity_float)

Play Arbitrary Samples from a List

This method allows to set the output amplitude, frequency an phase according to the values specified in respective lists. The whole sequence is played in the specified duration. The pattern store in the sample list can also be repeated.

Tip

We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with prepapre_only = True when the arb should be prepared and with run_prepared = True when the prepared arb should be played. In both calls the other parameters have to be passed.

Parameters:
  • samples_amp (TList(TFloat)) -- List of amplitude samples. If this list is empty (default), the amplitude is not modified.

  • samples_freq (TList(TFloat)) -- List of frequency samples. If this list is empty (default), the frequency is not modified.

  • samples_phase (TList(TFloat)) -- List of phase samples. If this list is empty (default), the phase is not modified.

  • duration (artiq.language.types.TFloat) -- The time in which the whole sequence of samples should be played back [s].

  • repetitions (artiq.language.types.TInt32) -- Number of times the sequence of all samples should be played. (default 1)

  • prepare_only (artiq.language.types.TBool) -- Only write the sequence to RAM, don't play it.

  • run_prepared (artiq.language.types.TBool) -- Play arb sequence previously prepared with prepare_only.

  • transform_amp -- Function to transform amplitude samples, must take a single argument of type TFloat and return a single TFloat.

  • transform_freq -- Function to transform frequency samples (see transform_amp).

  • transform_phase -- Function to transform phase samples (see transform_amp).

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=[])
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 (or None) instead: when the repository is scanned to build the list of available experiments and when the dataset browser artiq_browser is used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments in build().

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 BooleanValue and NumberValue.

  • 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, float or 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=None to 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 as slice(*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 False to prevent archival together with the run's results. Default is True.

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.

set_parameter(value, channel=None)
Parameters:
  • value (artiq.language.types.TFloat)

  • channel (artiq.language.types.TStr)

class atomiq.components.dummies.DummyDAC(*args, **kwargs)[source]

Bases: atomiq.components.electronics.voltagesource.DAC

A DAC with multiple channels

Parameters:

num_chan -- Number of channels the DAC has

values
set_channel_voltage(channel, voltage)[source]
Parameters:
  • channel (artiq.language.types.TInt32)

  • voltage (artiq.language.types.TFloat)

update()[source]
kernel_invariants
num_chan
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 (or None) instead: when the repository is scanned to build the list of available experiments and when the dataset browser artiq_browser is used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments in build().

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 BooleanValue and NumberValue.

  • 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, float or 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=None to 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 as slice(*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 False to prevent archival together with the run's results. Default is True.

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.

set_parameter(value, channel=None)
Parameters:
  • value (artiq.language.types.TFloat)

  • channel (artiq.language.types.TStr)

class atomiq.components.dummies.DummyActor(*args, **kwargs)[source]

Bases: atomiq.components.primitives.Component, atomiq.components.primitives.Parametrizable

An atomiq Component

Every component in atomiq inherits from this class. It provides basic functionality for automatic and recursive building and initialization of components (prepare, build, prerun). It also takes care for joining kernel invariants along the inheritance tree.

Note

The arguments parent and identifier are automatically passed to the component object by the atomiq object builder.

Parameters:
  • parent -- The parent context of the component. Usually this is the experiment that uses the component

  • identifier -- A unique name to identify the component.

  • debug_output -- Set whether the component should show debug output. Using this switch rather than the debug kernel logger can allow the compiler to not include the debug commands in the kernel code if the output is not needed.

amplitude = 0.0
set_amplitude(amp)[source]
Parameters:

amp (artiq.language.types.TFloat)

kernel_invariants
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 (or None) instead: when the repository is scanned to build the list of available experiments and when the dataset browser artiq_browser is used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments in build().

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 BooleanValue and NumberValue.

  • 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, float or 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=None to 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 as slice(*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 False to prevent archival together with the run's results. Default is True.

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.

set_parameter(value, channel=None)
Parameters:
  • value (artiq.language.types.TFloat)

  • channel (artiq.language.types.TStr)

class atomiq.components.dummies.DummyMonitor(dummy_actor, *args, **kwargs)[source]

Bases: atomiq.components.primitives.Component, atomiq.components.primitives.Measurable

An atomiq Component

Every component in atomiq inherits from this class. It provides basic functionality for automatic and recursive building and initialization of components (prepare, build, prerun). It also takes care for joining kernel invariants along the inheritance tree.

Note

The arguments parent and identifier are automatically passed to the component object by the atomiq object builder.

Parameters:
  • parent -- The parent context of the component. Usually this is the experiment that uses the component

  • identifier -- A unique name to identify the component.

  • debug_output -- Set whether the component should show debug output. Using this switch rather than the debug kernel logger can allow the compiler to not include the debug commands in the kernel code if the output is not needed.

  • dummy_actor (DummyActor)

dummy_actor
get_voltage()[source]
Return type:

artiq.language.types.TFloat

kernel_invariants
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 (or None) instead: when the repository is scanned to build the list of available experiments and when the dataset browser artiq_browser is used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments in build().

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 BooleanValue and NumberValue.

  • 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, float or 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=None to 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 as slice(*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 False to prevent archival together with the run's results. Default is True.

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.

abstractmethod measure(channel='')
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TFloat

measurement_channels()
class atomiq.components.dummies.DummySwitch(channels, *args, **kwargs)[source]

Bases: atomiq.components.primitives.Component, atomiq.components.primitives.Switchable

An atomiq Component

Every component in atomiq inherits from this class. It provides basic functionality for automatic and recursive building and initialization of components (prepare, build, prerun). It also takes care for joining kernel invariants along the inheritance tree.

Note

The arguments parent and identifier are automatically passed to the component object by the atomiq object builder.

Parameters:
  • parent -- The parent context of the component. Usually this is the experiment that uses the component

  • identifier -- A unique name to identify the component.

  • debug_output -- Set whether the component should show debug output. Using this switch rather than the debug kernel logger can allow the compiler to not include the debug commands in the kernel code if the output is not needed.

states
_get_channel_index(channel)[source]
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TInt32

on(channel='')[source]
Parameters:

channel (artiq.language.types.TStr)

off(channel='')[source]
Parameters:

channel (artiq.language.types.TStr)

is_on(channel='')[source]
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TBool

kernel_invariants
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 (or None) instead: when the repository is scanned to build the list of available experiments and when the dataset browser artiq_browser is used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments in build().

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 BooleanValue and NumberValue.

  • 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, float or 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=None to 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 as slice(*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 False to prevent archival together with the run's results. Default is True.

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.

toggle(channel=None)
Parameters:

channel (artiq.language.types.TStr)

pulse(pulsetime, channel='')
Parameters:
  • pulsetime (artiq.language.types.TFloat)

  • channel (artiq.language.types.TStr)

class atomiq.components.dummies.DummyCore(_dmgr)[source]

A ARTIQ sim dummy core device that works with Atomiq.

run(k_function, k_args, k_kwargs)[source]
Return type:

int

get_rtio_counter_mu()[source]
Return type:

int

reset()[source]
Return type:

None

break_realtime()[source]
Return type:

None

seconds_to_mu(seconds)[source]
Return type:

numpy.int64

mu_to_seconds(mu)[source]
Return type:

float