atomiq.components.sinara.dac

Classes

Zotino

This class represents the Sinara Zotino 32 Channel DAC.

ZotinoChannel

Voltage Source

Fastino

The Sinara Fast ADC called Fastino

FastinoChannel

Voltage Source

Module Contents

class atomiq.components.sinara.dac.Zotino(zotino_device, *args, max_parallel_arbs=5, max_arb_samples=128, **kwargs)[source]

Bases: atomiq.components.electronics.voltagesource.DAC

This class represents the Sinara Zotino 32 Channel DAC.

Hint

The Zotino provides the Zotino.parallel_arb context manager which allows to play arbitrary waveforms and ramps on multiple channels in parallel. Example code using this functionality can be found here

Parameters:
  • zotino_device (artiq.language.types.TStr) -- The ARTIQ zotino device to use from the device db, e.g. @zotino_0

  • max_parallel_arbs (artiq.language.types.TInt32) -- Number of channels that can be ramped or played an arbitrary waveform on in parallel. Keep this as low as possible as higher numbers increase the prerun phase length.

  • max_arb_samples (artiq.language.types.TInt32) -- Number of samples a arbitrary waveform/ramp can maximally have. Keep this as low as possible as higher numbers increase the prerun phase length.

kernel_invariants
hold_arbs = False
_last_update
_last_dac_write
_presched_dac_counter = 0
_zotino_device
parallel_arb
current_parallel_arb
update_i = 0
update_times
_prerun()[source]

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.

update()[source]

Applies the voltages in the DAC register to the outputs.

Hint

If an update is already scheduled at the current time, this command does nothing. This allows for setting multiple DAC channels in a parallel statement without multiple slow updates.

write_dac(channel, voltage)[source]

Writes the voltage value voltage to the DAC channel channel. This method schedules the operation in the past and does not advance the time cursor.

Parameters:
  • channel (artiq.language.types.TInt32) -- Channel number

  • voltage (artiq.language.types.TFloat) -- Voltage in V

Hint

This command uses a scheduler which takes care that no write operations occur at the same time to prevent undefined behavior which often do not result in a noticeable error.

class _SingleChannelArb(zotino_instance, max_samples)[source]

Represents an arbitrary voltage signal on a single Zotino channel.

Parameters:
  • zotino_instance (Zotino)

  • max_samples (artiq.language.types.TInt32)

active = False
channel = 0
len = 0
step_offset
i_step = 0
zotino
values
activate(channel, step_offset, values)[source]
Parameters:
  • channel (artiq.language.types.TInt32)

  • step_offset (artiq.language.types.TInt64)

step()[source]
class _ParallelArb(zotino_instance, max_parallel, max_samples)[source]

Represents a voltage arbitrary signal on multiple channels in parallel

Parameters:
  • zotino_instance (Zotino)

  • max_parallel (artiq.language.types.TInt32)

  • max_samples (artiq.language.types.TInt32)

zotino
arbs
start_mu
timestep_mu
n_arbs = 0
start_record()[source]

Defines the starting point of the parallel arbitrary waveform at the current time cursor position and resets previously scheduled arbs

register_arb(channel, arb_values, timestep_mu, start_mu)[source]

Add a single channel arbitrary waveform to the parallel arb scheduler

Parameters:
  • channel (artiq.language.types.TInt32) -- Zotino channel

  • arb_values -- List of values which are played sequentially in machine units

  • timestep_mu (artiq.language.types.TInt64) -- Time between arb samples. Must be equal for all arbs which are scheduled in parallel

  • start_mu (artiq.language.types.TInt64) -- Time offset of the arb in reference to the point where start_record was called. Can be negative but must be a multiple of timestep_mu.

start()[source]

Start the playback of all arbitrary volage signals merged by the register_arb method

class _ParallelArbsContext(zotino_instance)[source]

Context manager which makes all arbitrary waveforms defined within played in parallel. For an usage example, see here.

Parameters:

zotino_instance (Zotino)

zotino
__enter__()[source]
__exit__(exc_type, exc_value, exc_traceback)[source]
num_chan
set_channel_voltage(channel, voltage)
Parameters:
  • channel (artiq.language.types.TInt32)

  • voltage (artiq.language.types.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=[])
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.sinara.dac.ZotinoChannel(dac_device, channel, *args, **kwargs)[source]

Bases: atomiq.components.electronics.voltagesource.DACChannel

Voltage Source

This abstract class represents any device that can output a defined, controllable voltage.

Parameters:
  • min_voltage -- The minimum voltage the device can output [V]

  • max_voltage -- The maximum voltage the device can output [V]

  • default_ramp_steps -- The default number of steps that this device should use if the voltage is ramped. This value is only used if no ramp_steps are given in the ramp_voltage() method.

  • dac_device (DAC)

  • channel (artiq.language.types.TInt32)

_set_voltage(voltage, update_dac=True)[source]
Parameters:
  • voltage (artiq.language.types.TFloat)

  • update_dac (artiq.language.types.TBool)

_ramp_voltage(duration, voltage_start, voltage_end, ramp_timestep=0.0002)[source]

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 VoltageSource

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

  • voltage_start (artiq.language.types.TFloat)

  • voltage_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

kernel_invariants
dac_device
channel
min_voltage
max_voltage
default_ramp_steps = 30
set_voltage(voltage)

Set the voltage delivered by the voltage source

Parameters:

voltage (artiq.language.types.TFloat) -- Voltage in V

ramp_voltage(duration, voltage_start, voltage_end, ramp_timestep=float('nan'), ramp_steps=-1)

Ramp voltage over a given duration.

This method advances the timeline by duration

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

  • voltage_start (artiq.language.types.TFloat) -- initial voltage [V]

  • voltage_end (artiq.language.types.TFloat) -- end voltage [V]

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

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.sinara.dac.Fastino(fastino_device, parallel_event_delay=1e-08, *args, **kwargs)[source]

Bases: atomiq.components.electronics.voltagesource.DAC

The Sinara Fast ADC called Fastino

Parameters:
  • fastino_device (artiq.language.types.TStr) -- The ARTIQ fastino device from the device_db

  • parallel_event_delay (artiq.language.types.TBool) -- Time by which occurring parallel events in ramps are moved [s] (default: 10ns)

kernel_invariants
_fastino_device
event_slots
event_slots_max_idx = -1
parallel_event_delay = 1e-08
_prerun()[source]

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.

update()[source]
register_event(time)[source]
Parameters:

time (artiq.language.types.TInt64)

Return type:

artiq.language.types.TFloat

num_chan
set_channel_voltage(channel, voltage)
Parameters:
  • channel (artiq.language.types.TInt32)

  • voltage (artiq.language.types.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=[])
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.sinara.dac.FastinoChannel(dac_device, channel, *args, **kwargs)[source]

Bases: atomiq.components.electronics.voltagesource.DACChannel

Voltage Source

This abstract class represents any device that can output a defined, controllable voltage.

Parameters:
  • min_voltage -- The minimum voltage the device can output [V]

  • max_voltage -- The maximum voltage the device can output [V]

  • default_ramp_steps -- The default number of steps that this device should use if the voltage is ramped. This value is only used if no ramp_steps are given in the ramp_voltage() method.

  • dac_device (DAC)

  • channel (artiq.language.types.TInt32)

_ramp_voltage(duration, voltage_start, voltage_end, ramp_timestep=0.0002, relocate_parallel=True)[source]

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 VoltageSource

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

  • voltage_start (artiq.language.types.TFloat)

  • voltage_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • relocate_parallel (artiq.language.types.TBool)

_set_voltage(voltage, zero_time=False)[source]
Parameters:
  • voltage (artiq.language.types.TFloat)

  • zero_time (artiq.language.types.TBool)

kernel_invariants
dac_device
channel
min_voltage
max_voltage
default_ramp_steps = 30
set_voltage(voltage)

Set the voltage delivered by the voltage source

Parameters:

voltage (artiq.language.types.TFloat) -- Voltage in V

ramp_voltage(duration, voltage_start, voltage_end, ramp_timestep=float('nan'), ramp_steps=-1)

Ramp voltage over a given duration.

This method advances the timeline by duration

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

  • voltage_start (artiq.language.types.TFloat) -- initial voltage [V]

  • voltage_end (artiq.language.types.TFloat) -- end voltage [V]

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

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)