atomiq.components.laser

Classes

LaserSource

Free-running laser source

LockedLaserSource

Locked laser source

Laser

Laser light that can be modulated

SwitchableLaser

A laser that can be switched on and off

ModulatedLaser

A laser that can be changed in frequency and amplitude

StabilizedModulatedLaser

A power-stabilized modulated laser.

AutoCalibratedModulatedLaser

A laser that uses a Measurable to auto-calibrate its power

OptimizerStabilizedModulatedLaser

A modulated laser power-stabilized through an optimizer

ContinuouslyStabilizedModulatedLaser

A modulated laser power-stabilized through a continuous servo loop

Module Contents

class atomiq.components.laser.LaserSource(frequency, power=0.001, *args, **kwargs)[source]

Bases: atomiq.components.primitives.Component

Free-running laser source

This class represents a generic (free-running) laser source that emits light of a specified frequency

Parameters:
  • frequency (artiq.language.types.TFloat) -- Frequency of the emitted light in Hz

  • power (artiq.language.types.TFloat) -- Emitted light power in W

_frequency
_power = 0.001
get_frequency()[source]
set_frequency(frequency)[source]
Parameters:

frequency (artiq.language.types.TFloat)

get_power()[source]
set_power(power)[source]
Parameters:

power (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.

class atomiq.components.laser.LockedLaserSource(lock, *args, **kwargs)[source]

Bases: LaserSource

Locked laser source

This class represents a generic locked laser source that emits light of a specified frequency

Parameters:

lock (Lock) -- lock component that locks the laser source

kernel_invariants
lock
get_frequency()[source]
set_frequency(frequency)[source]
Parameters:

frequency (artiq.language.types.TFloat)

ramp_frequency(duration, frequency_start=float('nan'), frequency_end=float('nan'), ramp_timestep=float('nan'), ramp_steps=-1)[source]
Parameters:
  • duration (artiq.language.types.TFloat)

  • frequency_start (artiq.language.types.TFloat)

  • frequency_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

_frequency
_power = 0.001
get_power()
set_power(power)
Parameters:

power (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=[])
_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.

class atomiq.components.laser.Laser(laser_source, zero_freq=None, *args, **kwargs)[source]

Bases: LaserSource

Laser light that can be modulated

Since we inherit from LaserSource here, a Laser object can itself again be a LaserSource for another Laser object. This way one can describe consecutive manipulations from a LaserSource to the final Laser object.

Parameters:
  • laser_source (LaserSource) -- The laser source that this laser is taken from

  • zero_freq (artiq.language.types.TFloat) -- absolute frequency in Hz that should be considered zero. This allows to reference the laser frequency relative to e.g. an atomic transition. If not set, the detuning will be relative to the lock point of the laser source

kernel_invariants
laser_source
zero_freq
get_frequency()[source]
set_frequency(frequency)[source]

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_dummy(frequency)[source]
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)[source]

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)[source]

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
get_power()
set_power(power)
Parameters:

power (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=[])
_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.

class atomiq.components.laser.SwitchableLaser(switch, *args, **kwargs)[source]

Bases: Laser, atomiq.components.primitives.Switchable

A laser that can be switched on and off

This class represents a laser that can be switched on and off, e.g. by a mechanical shutter. However, every Switchable can be used to switch the laser.

Parameters:
  • laser_source -- The laser source that this laser is taken from

  • switch (Switchable) -- The component that switches the laser light

kernel_invariants
laser_source
switch
on()[source]
off()[source]
zero_freq
get_frequency()
set_frequency(frequency)

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_dummy(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
get_power()
set_power(power)
Parameters:

power (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=[])
_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 is_on(channel=None)
Parameters:

channel (artiq.language.types.TStr)

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.laser.ModulatedLaser(modulator, switch=None, fm_device='mod', am_device='mod', src_transmission=1.0, *args, **kwargs)[source]

Bases: SwitchableLaser, atomiq.components.primitives.Parametrizable

A laser that can be changed in frequency and amplitude

This class represents a laser that is altered by an acusto-optic modular (AOM). The AOM can be used the modulate the amplitude and the frequency of the light.

Parameters:
  • laser_source -- The laser source that this laser is taken from

  • switch (Switchable) -- The component that switches the laser light. If none is given, the AOM is used to switch the light.

  • modulator (LightModulator) -- component that does the amplitude/frequency/phase modulation of the laser. E.g. an AOM, EOM, etc.

  • zero_freq -- absolute frequency in Hz that should be considered zero. This allows to reference the laser frequency relative to e.g. an atomic transition. If not set, the detuning will be relative to the lock point of the laser source

  • fm_device (artiq.language.types.TStr) -- Choose whether the frequency should be set via the modulator (mod) or the laser source (src). (default: mod)

  • am_device (artiq.language.types.TStr) -- Choose whether the power should be set via the modulator (mod) or the laser source (src). (default: mod)

  • src_transmission (artiq.language.types.TFloat) -- Transmission of the light from the laser source to behind the modulator [0..1] (default 1)

kernel_invariants
modulator
laser_source
fm_device = 'mod'
am_device = 'mod'
src_transmission = 1.0
get_amplitude()[source]
Return type:

artiq.language.types.TFloat

set_amplitude(amplitude)[source]
Parameters:

amplitude (artiq.language.types.TFloat)

get_frequency()[source]
Return type:

artiq.language.types.TFloat

set_frequency(frequency)[source]

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_through_modulator(frequency)[source]
Parameters:

frequency (artiq.language.types.TFloat)

_set_frequency_through_source(frequency)[source]
Parameters:

frequency (artiq.language.types.TFloat)

ramp(duration, frequency_start=float('nan'), frequency_end=float('nan'), detuning_start=float('nan'), detuning_end=float('nan'), amplitude_start=float('nan'), amplitude_end=float('nan'), power_start=float('nan'), power_end=float('nan'), ramp_timestep=float('nan'), ramp_steps=-1)[source]

Ramp frequency and/or power/amplitude over a given duration.

Parameters default to -1 or nan to indicate no change. If no starting value is given, the ramp starts from the last frequency/amplitude which was set.

Either power or amplitude can be given to ramp the intensity of the laser. If power is given, it overwrites the value for the amplitude

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]

  • detuning_start (artiq.language.types.TFloat) -- initial detuning [Hz]

  • detuning_start -- final detuning [Hz]

  • amplitude_start (artiq.language.types.TFloat) -- initial amplitude

  • amplitude_end (artiq.language.types.TFloat) -- end amplitude

  • power_start (artiq.language.types.TFloat) -- initial power [W]

  • power_end (artiq.language.types.TFloat) -- final power [W]

  • detuning_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

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

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.

We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with prepare_only = True when the arb should be prepared and with run_only = 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_power (TList(TFloat)) -- List of power samples. If this list is empty (default), the amplitude is not modified. This overwrites samples_amp.

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

  • samples_det (TList(TFloat)) -- List of frequency samples relative to the zero frequency. If this list is empty (default), the frequency is not modified. This overwrites samples_frequency

  • 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)

  • run_prepared (artiq.language.types.TBool)

get_power()[source]
Return type:

artiq.language.types.TFloat

_amplitude_from_power(power)[source]
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TFloat

set_power(power)[source]

Set the absolute power of the light after modulation

Parameters:

power (artiq.language.types.TFloat) -- Absolute power of the light after modulation in W

switch
on()
off()
zero_freq
_set_frequency_dummy(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
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 is_on(channel=None)
Parameters:

channel (artiq.language.types.TStr)

toggle(channel=None)
Parameters:

channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

class atomiq.components.laser.StabilizedModulatedLaser(photodiode, *args, **kwargs)[source]

Bases: ModulatedLaser, atomiq.components.primitives.Measurable

A power-stabilized modulated laser.

With some means of measuring the laser power after the amplitude modulator and a feedback, the laser power can be stabilized. This is an abstract class to represent this kind of setups. To monitor the power of the laser after the modulator, a photodiode is required.

Parameters:

photodiode (Photodiode) -- The photodiode that monitors the laser power

kernel_invariants
photodiode
get_power()[source]
Return type:

artiq.language.types.TFloat

stabilize(enable)[source]
Parameters:

enable (artiq.language.types.TBool)

abstractmethod _stabilize(enable)[source]
Parameters:

enable (artiq.language.types.TBool)

modulator
laser_source
fm_device = 'mod'
am_device = 'mod'
src_transmission = 1.0
get_amplitude()
Return type:

artiq.language.types.TFloat

set_amplitude(amplitude)
Parameters:

amplitude (artiq.language.types.TFloat)

get_frequency()
Return type:

artiq.language.types.TFloat

set_frequency(frequency)

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_through_modulator(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

_set_frequency_through_source(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

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

Ramp frequency and/or power/amplitude over a given duration.

Parameters default to -1 or nan to indicate no change. If no starting value is given, the ramp starts from the last frequency/amplitude which was set.

Either power or amplitude can be given to ramp the intensity of the laser. If power is given, it overwrites the value for the amplitude

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]

  • detuning_start (artiq.language.types.TFloat) -- initial detuning [Hz]

  • detuning_start -- final detuning [Hz]

  • amplitude_start (artiq.language.types.TFloat) -- initial amplitude

  • amplitude_end (artiq.language.types.TFloat) -- end amplitude

  • power_start (artiq.language.types.TFloat) -- initial power [W]

  • power_end (artiq.language.types.TFloat) -- final power [W]

  • detuning_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

arb(duration, samples_amp=[], samples_power=[], samples_freq=[], samples_det=[], 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.

We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with prepare_only = True when the arb should be prepared and with run_only = 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_power (TList(TFloat)) -- List of power samples. If this list is empty (default), the amplitude is not modified. This overwrites samples_amp.

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

  • samples_det (TList(TFloat)) -- List of frequency samples relative to the zero frequency. If this list is empty (default), the frequency is not modified. This overwrites samples_frequency

  • 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)

  • run_prepared (artiq.language.types.TBool)

_amplitude_from_power(power)
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TFloat

set_power(power)

Set the absolute power of the light after modulation

Parameters:

power (artiq.language.types.TFloat) -- Absolute power of the light after modulation in W

switch
on()
off()
zero_freq
_set_frequency_dummy(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
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 is_on(channel=None)
Parameters:

channel (artiq.language.types.TStr)

toggle(channel=None)
Parameters:

channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

abstractmethod measure(channel='')
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TFloat

measurement_channels()
class atomiq.components.laser.AutoCalibratedModulatedLaser(points=6, *args, amp_min=0.0, amp_max=1.0, timestep=325 * us, **kwargs)[source]

Bases: StabilizedModulatedLaser

A laser that uses a Measurable to auto-calibrate its power

With some means of measuring the laser power after the amplitude modulator and a feedback, the amplitude for the modulator to achieve a certain power in the beam can be auto-calibrated. To achieve this, this laser measures a configurable number of points and makes a linear interpolation between them if a power in between is requested.

Parameters:
  • points (artiq.language.types.TInt32) -- number of points to measure for the auto-calibration. (default 6)

  • amp_min (artiq.language.types.TFloat) -- minimum amplitude to test in the auto-calibration

  • amp_max (artiq.language.types.TFloat) -- maximum amplitude to test in the auto-calibration

  • timestep (artiq.language.types.TFloat)

kernel_invariants
points = 6
amp_min = 0.0
amp_max = 1.0
timestep
cache
cache_filled = False
clear_cache()[source]
_cache_closest_idx(power)[source]
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TInt32

amplitude_from_power(power)[source]
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TFloat

autocalibrate()[source]
set_power(power)[source]

Set the output power of the laser

If no autocalibration has been done before in this kernel, this will immediately perform the calibration and set the modulator according to the result. If a calibration is present in the cache, the cache values are used to calculate an interpolation.

Parameters:
  • power (artiq.language.types.TFloat) -- the power the laser should be stabilized to. If the photodiode is calibrated the power should be

  • units (given in the calibrated)

photodiode
get_power()
Return type:

artiq.language.types.TFloat

stabilize(enable)
Parameters:

enable (artiq.language.types.TBool)

abstractmethod _stabilize(enable)
Parameters:

enable (artiq.language.types.TBool)

modulator
laser_source
fm_device = 'mod'
am_device = 'mod'
src_transmission = 1.0
get_amplitude()
Return type:

artiq.language.types.TFloat

set_amplitude(amplitude)
Parameters:

amplitude (artiq.language.types.TFloat)

get_frequency()
Return type:

artiq.language.types.TFloat

set_frequency(frequency)

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_through_modulator(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

_set_frequency_through_source(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

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

Ramp frequency and/or power/amplitude over a given duration.

Parameters default to -1 or nan to indicate no change. If no starting value is given, the ramp starts from the last frequency/amplitude which was set.

Either power or amplitude can be given to ramp the intensity of the laser. If power is given, it overwrites the value for the amplitude

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]

  • detuning_start (artiq.language.types.TFloat) -- initial detuning [Hz]

  • detuning_start -- final detuning [Hz]

  • amplitude_start (artiq.language.types.TFloat) -- initial amplitude

  • amplitude_end (artiq.language.types.TFloat) -- end amplitude

  • power_start (artiq.language.types.TFloat) -- initial power [W]

  • power_end (artiq.language.types.TFloat) -- final power [W]

  • detuning_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

arb(duration, samples_amp=[], samples_power=[], samples_freq=[], samples_det=[], 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.

We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with prepare_only = True when the arb should be prepared and with run_only = 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_power (TList(TFloat)) -- List of power samples. If this list is empty (default), the amplitude is not modified. This overwrites samples_amp.

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

  • samples_det (TList(TFloat)) -- List of frequency samples relative to the zero frequency. If this list is empty (default), the frequency is not modified. This overwrites samples_frequency

  • 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)

  • run_prepared (artiq.language.types.TBool)

_amplitude_from_power(power)
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TFloat

switch
on()
off()
zero_freq
_set_frequency_dummy(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
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 is_on(channel=None)
Parameters:

channel (artiq.language.types.TStr)

toggle(channel=None)
Parameters:

channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

abstractmethod measure(channel='')
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TFloat

measurement_channels()
class atomiq.components.laser.OptimizerStabilizedModulatedLaser(optimizer, cache_size=8, *args, **kwargs)[source]

Bases: StabilizedModulatedLaser

A modulated laser power-stabilized through an optimizer

This class integrates an optimizer to find the best setting of the amplitude modulator to achieve the desired power on the monitoring photodiode. This can be used to create "poor man's PID". Upon calling :func:set_power() it is checked whether an optimization result for the requested power already exists. If not the optimizer is called to find the best setting. This result is applied to the modulator and stored in the cache.

To find the best setting, the optimizer will (multiple times) switch on the laser, change its power and measure the photodiode. When switching on the light interferes with the experimental sequence, make sure to call :func:set_power() for your desired power for the first time before the experiment starts. Then the optimization will be done when it does not interfere with your experiment and at a later time the optimization result can be read from the cache, i.e. not further optimization is possible. Of course this assumes that the laser source power is reasonably stable during the time between the optimization the the time the value is recalled from the cache.

Parameters:
  • optimizer (Optimizer) -- Optimizer to use for finding the proper setting of the modulator. Make sure that the actor_component of the optimizer is identical to the the lasers modulator and the optimizer's monitor_component is identical to the lasers photodiode.

  • cache_size (artiq.language.types.TInt32) -- number of optimization results that can be stored. (default 8)

kernel_invariants
cache
cache_size = 8
optimizer
_cache_idx(power)[source]
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TInt32

clear_cache()[source]
set_power(power)[source]

Set the output power of the laser

If the requested power is not already in the cache, this will immediately perform the optimization and set the result on the modulator. If the requested power is present in the cache, the cache value is used.

Parameters:
  • power (artiq.language.types.TFloat) -- the power the laser should be stabilized to. If the photodiode is calibrated the power should be

  • units (given in the calibrated)

photodiode
get_power()
Return type:

artiq.language.types.TFloat

stabilize(enable)
Parameters:

enable (artiq.language.types.TBool)

abstractmethod _stabilize(enable)
Parameters:

enable (artiq.language.types.TBool)

modulator
laser_source
fm_device = 'mod'
am_device = 'mod'
src_transmission = 1.0
get_amplitude()
Return type:

artiq.language.types.TFloat

set_amplitude(amplitude)
Parameters:

amplitude (artiq.language.types.TFloat)

get_frequency()
Return type:

artiq.language.types.TFloat

set_frequency(frequency)

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_through_modulator(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

_set_frequency_through_source(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

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

Ramp frequency and/or power/amplitude over a given duration.

Parameters default to -1 or nan to indicate no change. If no starting value is given, the ramp starts from the last frequency/amplitude which was set.

Either power or amplitude can be given to ramp the intensity of the laser. If power is given, it overwrites the value for the amplitude

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]

  • detuning_start (artiq.language.types.TFloat) -- initial detuning [Hz]

  • detuning_start -- final detuning [Hz]

  • amplitude_start (artiq.language.types.TFloat) -- initial amplitude

  • amplitude_end (artiq.language.types.TFloat) -- end amplitude

  • power_start (artiq.language.types.TFloat) -- initial power [W]

  • power_end (artiq.language.types.TFloat) -- final power [W]

  • detuning_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

arb(duration, samples_amp=[], samples_power=[], samples_freq=[], samples_det=[], 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.

We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with prepare_only = True when the arb should be prepared and with run_only = 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_power (TList(TFloat)) -- List of power samples. If this list is empty (default), the amplitude is not modified. This overwrites samples_amp.

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

  • samples_det (TList(TFloat)) -- List of frequency samples relative to the zero frequency. If this list is empty (default), the frequency is not modified. This overwrites samples_frequency

  • 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)

  • run_prepared (artiq.language.types.TBool)

_amplitude_from_power(power)
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TFloat

switch
on()
off()
zero_freq
_set_frequency_dummy(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
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 is_on(channel=None)
Parameters:

channel (artiq.language.types.TStr)

toggle(channel=None)
Parameters:

channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

abstractmethod measure(channel='')
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TFloat

measurement_channels()
class atomiq.components.laser.ContinuouslyStabilizedModulatedLaser(start_stabilized=True, *args, **kwargs)[source]

Bases: StabilizedModulatedLaser

A modulated laser power-stabilized through a continuous servo loop

If a laser is power-stabilized by an external (hardware) servo loop, it is represented by this abstract class.

Parameters:

start_stabilized (artiq.language.types.TBool) -- Should the servo loop be activated on startup? (default True)

stabilized = True
_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.

kernel_invariants
photodiode
get_power()
Return type:

artiq.language.types.TFloat

stabilize(enable)
Parameters:

enable (artiq.language.types.TBool)

abstractmethod _stabilize(enable)
Parameters:

enable (artiq.language.types.TBool)

modulator
laser_source
fm_device = 'mod'
am_device = 'mod'
src_transmission = 1.0
get_amplitude()
Return type:

artiq.language.types.TFloat

set_amplitude(amplitude)
Parameters:

amplitude (artiq.language.types.TFloat)

get_frequency()
Return type:

artiq.language.types.TFloat

set_frequency(frequency)

Set the absolute frequency of the light after modulation

Parameters:

frequency (artiq.language.types.TFloat) -- Absolute frequency of the light after modulation in Hz

_set_frequency_through_modulator(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

_set_frequency_through_source(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

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

Ramp frequency and/or power/amplitude over a given duration.

Parameters default to -1 or nan to indicate no change. If no starting value is given, the ramp starts from the last frequency/amplitude which was set.

Either power or amplitude can be given to ramp the intensity of the laser. If power is given, it overwrites the value for the amplitude

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]

  • detuning_start (artiq.language.types.TFloat) -- initial detuning [Hz]

  • detuning_start -- final detuning [Hz]

  • amplitude_start (artiq.language.types.TFloat) -- initial amplitude

  • amplitude_end (artiq.language.types.TFloat) -- end amplitude

  • power_start (artiq.language.types.TFloat) -- initial power [W]

  • power_end (artiq.language.types.TFloat) -- final power [W]

  • detuning_end (artiq.language.types.TFloat)

  • ramp_timestep (artiq.language.types.TFloat)

  • ramp_steps (artiq.language.types.TInt32)

arb(duration, samples_amp=[], samples_power=[], samples_freq=[], samples_det=[], 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.

We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with prepare_only = True when the arb should be prepared and with run_only = 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_power (TList(TFloat)) -- List of power samples. If this list is empty (default), the amplitude is not modified. This overwrites samples_amp.

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

  • samples_det (TList(TFloat)) -- List of frequency samples relative to the zero frequency. If this list is empty (default), the frequency is not modified. This overwrites samples_frequency

  • 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)

  • run_prepared (artiq.language.types.TBool)

_amplitude_from_power(power)
Parameters:

power (artiq.language.types.TFloat)

Return type:

artiq.language.types.TFloat

set_power(power)

Set the absolute power of the light after modulation

Parameters:

power (artiq.language.types.TFloat) -- Absolute power of the light after modulation in W

switch
on()
off()
zero_freq
_set_frequency_dummy(frequency)
Parameters:

frequency (artiq.language.types.TFloat)

set_detuning(detuning)

Set the detuning of the light from the frequency defined by zero_freq

Note

If you are using a modulator (e.g. AOM) the center frequency is not taken into account. If you want to set the detuning from the center frequency of the modulator use self.modulator.set_detuning

Parameters:

detuning (artiq.language.types.TFloat) -- Detuning in Hz

detune(frequency)

Alias for set_detuning()

Parameters:

frequency (artiq.language.types.TFloat)

_frequency
_power = 0.001
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.

abstractmethod is_on(channel=None)
Parameters:

channel (artiq.language.types.TStr)

toggle(channel=None)
Parameters:

channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

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

  • channel (artiq.language.types.TStr)

abstractmethod measure(channel='')
Parameters:

channel (artiq.language.types.TStr)

Return type:

artiq.language.types.TFloat

measurement_channels()