atomiq.components.electronics.currentsource =========================================== .. py:module:: atomiq.components.electronics.currentsource Classes ------- .. autoapisummary:: atomiq.components.electronics.currentsource.CurrentSource atomiq.components.electronics.currentsource.HBridgedCurrentSource atomiq.components.electronics.currentsource.TTLHardwareLogicHBridgedCurrentSource atomiq.components.electronics.currentsource.TTLSoftwareLogicHBridgedCurrentSource atomiq.components.electronics.currentsource.RPCCurrentSource atomiq.components.electronics.currentsource.RPCCurrentSourceChannel atomiq.components.electronics.currentsource.VoltageControlledCurrentSource Module Contents --------------- .. py:class:: CurrentSource(min_current = float('-inf'), max_current = float('inf'), default_ramp_steps = 30, *args, **kwargs) Bases: :py:obj:`atomiq.components.primitives.Component`, :py:obj:`atomiq.components.primitives.Parametrizable` Current Source This abstract class represents any device that can output a defined, controllable current. :param min_current: The minimum current the device can output [A] :param max_current: The maximum current the device can output [A] :param default_ramp_steps: The default number of steps that this device should use if the current is ramped. This value is only used if no ``ramp_steps`` are given in the :func:`ramp_current` method. .. py:attribute:: kernel_invariants .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: _set_current(current) :abstractmethod: .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep = 0.0002) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None) .. py:class:: HBridgedCurrentSource(current_source, *args, **kwargs) Bases: :py:obj:`CurrentSource`, :py:obj:`atomiq.components.primitives.Switchable` Combination of an H-bridge and a current source Combining an H-bridge with a unipolar current source allows to create a bipolar current source. This class bundles these two comoponents an exposes them as a bipolar current source. :param current_source: The current source connected to the H-bridge .. py:class:: HBridgeState Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: FORWARD :value: (1,) .. py:attribute:: OFF :value: (0,) .. py:attribute:: REVERSE :value: -1 .. py:attribute:: kernel_invariants .. py:attribute:: current_source .. py:attribute:: state .. py:attribute:: last_state .. py:method:: hbridge_off() .. py:method:: hbridge_reverse() .. py:method:: hbridge_forward() .. py:method:: hbridge_toggle() .. py:method:: _hbridge_off() :abstractmethod: .. py:method:: _hbridge_forward() :abstractmethod: .. py:method:: _hbridge_reverse() :abstractmethod: .. py:method:: _set_current(current) .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:method:: off() .. py:method:: on() .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None) .. py:method:: is_on(channel = None) :abstractmethod: .. py:method:: toggle(channel = None) .. py:method:: pulse(pulsetime, channel = '') .. py:class:: TTLHardwareLogicHBridgedCurrentSource(switch_direction, switch_on, invert_direction = False, *args, **kwargs) Bases: :py:obj:`HBridgedCurrentSource` H-bridged current source with control logic implemented in hardware Some external hardware (logic gates) take care to set all MOSFETs of the H-bridge based on the desired direction as indicated by `switch_direction`. Via `switch_on` the entire bridge can be enabled and disabled. +---------------+----------------------+---------------------+ | ``switch_on`` | ``switch_direction`` | current flow | +===============+======================+=====================+ | off | on | off | +---------------+----------------------+---------------------+ | off | off | off | +---------------+----------------------+---------------------+ | on | on | forward | +---------------+----------------------+---------------------+ | on | off | reverse | +---------------+----------------------+---------------------+ :param switch_on: When ON, H-bridge is with forward or reverse; when OFF, load is disconnected from the PSU :param switch_direction: select forward or reverse direction of current flow :param invert_direction: flip forward/reverse .. py:attribute:: kernel_invariants .. py:attribute:: switch_direction .. py:attribute:: switch_on .. py:attribute:: invert_direction :value: False .. py:method:: _hbridge_off() .. py:method:: _hbridge_forward() .. py:method:: _hbridge_reverse() .. py:class:: HBridgeState Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: FORWARD :value: (1,) .. py:attribute:: OFF :value: (0,) .. py:attribute:: REVERSE :value: -1 .. py:attribute:: current_source .. py:attribute:: state .. py:attribute:: last_state .. py:method:: hbridge_off() .. py:method:: hbridge_reverse() .. py:method:: hbridge_forward() .. py:method:: hbridge_toggle() .. py:method:: _set_current(current) .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:method:: off() .. py:method:: on() .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None) .. py:method:: is_on(channel = None) :abstractmethod: .. py:method:: toggle(channel = None) .. py:method:: pulse(pulsetime, channel = '') .. py:class:: TTLSoftwareLogicHBridgedCurrentSource(switch_forward, switch_reverse, *args, **kwargs) Bases: :py:obj:`HBridgedCurrentSource` H-bridged current source with control logic implemented in software Each pair of MOSFETs is directly controlled by one switch. So when both TTLs are off, the bridge is off, but also when both are on the PSU is shorted. +--------------------+--------------------+--------------------+ | ``switch_forward`` | ``switch_reverse`` | current flow | +====================+====================+====================+ | off | off | off | +--------------------+--------------------+--------------------+ | off | on | reverse | +--------------------+--------------------+--------------------+ | on | off | forward | +--------------------+--------------------+--------------------+ | on | on | INVALID | +--------------------+--------------------+--------------------+ :param switch_forward: TTL to enable forward pair of MOSFETs :param switch_reverse: TTL to enable reverse pair of MOSFETs .. py:attribute:: kernel_invariants .. py:attribute:: switch_forward .. py:attribute:: switch_reverse .. py:method:: _hbridge_off() .. py:method:: _hbridge_forward() .. py:method:: _hbridge_reverse() .. py:class:: HBridgeState Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: FORWARD :value: (1,) .. py:attribute:: OFF :value: (0,) .. py:attribute:: REVERSE :value: -1 .. py:attribute:: current_source .. py:attribute:: state .. py:attribute:: last_state .. py:method:: hbridge_off() .. py:method:: hbridge_reverse() .. py:method:: hbridge_forward() .. py:method:: hbridge_toggle() .. py:method:: _set_current(current) .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:method:: off() .. py:method:: on() .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None) .. py:method:: is_on(channel = None) :abstractmethod: .. py:method:: toggle(channel = None) .. py:method:: pulse(pulsetime, channel = '') .. py:class:: RPCCurrentSource(rpc_currentsource, *args, **kwargs) Bases: :py:obj:`CurrentSource` A current source controlled via RPC calls :param rpc_currentsource: The ARTIQ rpc object representing the current source. This object needs to provide a function named `set_current(current_in_A)` to set the current. .. py:attribute:: kernel_invariants .. py:attribute:: currentsource .. py:method:: _set_current(current) .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep = 0.0002) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None) .. py:class:: RPCCurrentSourceChannel(rpc_currentsource, channel, *args, **kwargs) Bases: :py:obj:`CurrentSource` One channel of a multi-channel currentsource controlled via RPC :param rpc_currentsource: The ARTIQ rpc object representing the multi channel current source. This object needs to provide a function named `set_current(current_in_A, channel)` to set the current. :param channel: channel of the multi-channel current source to operate on .. py:attribute:: kernel_invariants .. py:attribute:: currentsource .. py:attribute:: channel .. py:method:: _set_current(current) .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep = 0.0002) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None) .. py:class:: VoltageControlledCurrentSource(voltage_source, calibration, *args, **kwargs) Bases: :py:obj:`CurrentSource` A current source controlled by an analog voltage A typical usecase for this class are voltage-controlled power supplies that drive the current through a coil. :param voltage_source: Voltage source that controls the current source :param calibration: Calibration U = f(I) to give the control voltage U for a desired current I .. py:attribute:: kernel_invariants .. py:attribute:: voltage_source .. py:attribute:: calibration .. py:method:: _set_current(current) .. py:method:: _ramp_current(duration, current_start, current_end, ramp_timestep) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from currentSource .. py:attribute:: current .. py:attribute:: min_current .. py:attribute:: max_current .. py:attribute:: default_ramp_steps :value: 30 .. py:method:: set_current(current) Set the current delivered by the current source :param current: Current in A .. py:method:: ramp_current(duration, current_end, current_start = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp current over a given duration. This method advances the timeline by `duration` :param duration: ramp duration [s] :param current_end: end current [A] :param current_start: initial current [A]. If not given, the ramp starts from the current operating current. .. py:attribute:: experiment .. py:attribute:: identifier .. py:attribute:: debug_output :value: False .. py:attribute:: core .. py:attribute:: _kernel_invariants .. py:attribute:: _prepare_done :value: False .. py:attribute:: _build_done :value: False .. py:attribute:: _hooks_done :value: [] .. py:method:: _recursive_prepare() .. py:method:: _prepare() Specify here what should be done for this component in the prepare phase .. py:method:: _recursive_build() .. py:method:: _build() Specify here what should be done for this component in the build phase .. py:method:: _do_prerun() .. py:method:: required_components(ancestors=[]) .. py:method:: _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. .. py:attribute:: children :value: [] .. py:attribute:: __in_build :value: True .. py:method:: register_child(child) .. py:method:: call_child_method(method, *args, **kwargs) Calls the named method for each child, if it exists for that child, in the order of registration. :param method: Name of the method to call :type method: str :param args: Tuple of positional arguments to pass to all children :param kwargs: Dict of keyword arguments to pass to all children .. py:method:: 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 :meth:`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). .. py:method:: get_argument(key, processor, group=None, tooltip=None) Retrieves and returns the value of an argument. This function should only be called from ``build``. :param key: Name of the argument. :param processor: A description of how to process the argument, such as instances of :mod:`~artiq.language.environment.BooleanValue` and :mod:`~artiq.language.environment.NumberValue`. :param group: An optional string that defines what group the argument belongs to, for user interface purposes. :param tooltip: An optional string to describe the argument in more detail, applied as a tooltip to the argument name in the user interface. .. py:method:: 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. .. py:method:: interactive(title='') Request arguments from the user interactively. This context manager returns a namespace object on which the method :meth:`~artiq.language.environment.HasEnvironment.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 :exc:`~artiq.language.environment.CancelledArgsError`. .. py:method:: get_device_db() Returns the full contents of the device database. .. py:method:: get_device(key) Creates and returns a device driver. .. py:method:: 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. .. py:method:: 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. :param unit: A string representing the unit of the value. :param 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. :param 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. :param broadcast: the data is sent in real-time to the master, which dispatches it. :param persist: the master should store the data on-disk. Implies broadcast. :param archive: the data is saved into the local storage of the current run (archived as a HDF5 file). .. py:method:: 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). .. py:method:: 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. .. py:method:: 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. :param archive: Set to ``False`` to prevent archival together with the run's results. Default is ``True``. .. py:method:: 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 :meth:`set_dataset` for documentation of metadata items. .. py:method:: 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. .. py:method:: set_default_scheduling(priority=None, pipeline_name=None, flush=None) Sets the default scheduling options. This function should only be called from ``build``. .. py:method:: set_parameter(value, channel = None)