atomiq.components.sinara.mirny ============================== .. py:module:: atomiq.components.sinara.mirny .. autoapi-nested-parse:: Sinara 4456 Mirny (4-channel ADF5356 PLL). Classes ------- .. autoapisummary:: atomiq.components.sinara.mirny.Mirny atomiq.components.sinara.mirny.MirnyChannel Functions --------- .. autoapisummary:: atomiq.components.sinara.mirny._amplitude_to_att_db atomiq.components.sinara.mirny._att_db_to_amplitude Module Contents --------------- .. py:function:: _amplitude_to_att_db(amplitude) .. py:function:: _att_db_to_amplitude(att_db) .. py:class:: Mirny(cpld, *args, **kwargs) Bases: :py:obj:`atomiq.components.primitives.Component` Sinara Mirny 4 Channel PLL/VCO-based microwave frequency synthesizer :param cpld: ARTIQ :class:`artiq.coredevice.mirny.Mirny` instance from the device database (e.g. ``@mirny0_cpld``). .. py:attribute:: kernel_invariants .. py:attribute:: cpld .. 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:class:: MirnyChannel(mirny, device, ttl=None, default_attenuation = 0.0, default_powerlevel = 3, freq_limit = (53125000.0, 4000000000.0), **kwargs) Bases: :py:obj:`atomiq.components.electronics.rfsource.RFSource`, :py:obj:`atomiq.components.primitives.Switchable` Single Mirny ADF5356 channel: PLL frequency, step attenuator, and RF switch. :param mirny: Parent :class:`Mirny` board the channels belongs to. :param device: ARTIQ :class:`artiq.coredevice.adf5356.ADF5356` channel device from the `device_db` (e.g. ``@mirny0_ch0``). :param ttl: The ARTIQ device from the `device_db` representing the Urukul fast RF switch, (e.g. ``@ttl_mirny0_sw0``). RF is switched on and off by disabling the PLL chip output (slow). :param default_amplitude: Default amplitude in interval [0,1] applied in ``prerun``. :param default_powerlevel: Default PLL chip power index applied in ``prerun``, this determines the maximum power. Defaults to 3 which is the maximum output power. See `the datasheet `_ for more info. :param freq_limit: Allowed output frequency range in Hz. :param blind: If ``True``, skip the usual :meth:`_prerun` reprogramming (see :class:`~atomiq.components.electronics.rfsource.RFSource`). .. note:: Call :meth:`init` once after power-on before experiments; it is not invoked automatically. .. warning:: The Mirny can not ramp frequencies continuously, between each step there will be a gap of ~1-2ms as the PLL needs to relock. .. py:attribute:: kernel_invariants .. py:attribute:: mirny .. py:attribute:: device .. py:attribute:: default_attenuation :value: 0.0 .. py:attribute:: default_powerlevel :value: 3 .. py:method:: init() Initialize CPLD (if needed) and PLL. Slow; run once after power-on. .. 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:method:: set_att(attenuation) Set hardware digital attenuation in dB (0–31.5 in 0.5 dB steps). Updates :attr:`attenuation` and keeps :attr:`amplitude` consistent with the mapping used by :meth:`set`. .. py:method:: _set_frequency(frequency) .. py:method:: _set_amplitude(amplitude) .. py:method:: _set_phase(phase) ADF5356 phase offset is not programmed by this Atomiq wrapper. .. py:method:: on() .. py:method:: off() .. py:method:: set_output_power_mu(n) Set PLL chip output power index (0–3); see ADF5356 datasheet. .. py:method:: output_power_mu() .. py:method:: _on_pll() .. py:method:: _off_pll() .. py:attribute:: amplitude :value: 0.0 .. py:attribute:: frequency :value: 100000000.0 .. py:attribute:: phase :value: 0.0 .. py:attribute:: default_ramp_steps :value: 30 .. py:attribute:: blind :value: False .. py:method:: _prerun_blind() .. py:method:: set_frequency(frequency) .. py:method:: _check_frequency(frequency) .. py:method:: get_frequency() .. py:method:: set_amplitude(amplitude) .. py:method:: _check_amplitude(amplitude) .. py:method:: get_amplitude() .. py:method:: set_phase(phase) .. py:method:: get_phase() .. py:method:: set(frequency = float('nan'), amplitude = float('nan'), phase = 0.0) Set the frequency and amplitude of the DDS channel Frequency/amplitude are set to the last known value if ``float("nan")`` is passed (default). :param frequency: Frequency in Hz (``nan`` to use previous value) :param amplitude: Amplitude (``nan`` to use previous value) :param phase: Phase in rad (default 0.0) .. py:method:: _ramp(duration, frequency_start, frequency_end, amplitude_start, amplitude_end, ramp_timestep = 0.0002) This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from RFSource .. py:method:: ramp(duration, frequency_start = float('nan'), frequency_end = float('nan'), amplitude_start = float('nan'), amplitude_end = float('nan'), ramp_timestep = float('nan'), ramp_steps = -1) Ramp frequency and amplitude over a given duration. Parameters default to ``-1`` or ``nan`` to indicate no change. If the start frequency/amplitude is set to ``nan``, the ramp starts from the last frequency/amplitude which was set. This method advances the timeline by ´duration´ :param duration: ramp duration [s] :param frequency_start: initial frequency [Hz] :param frequency_end: end frequency [Hz] :param amplitude_start: initial amplitude [0..1] :param amplitude_end: end amplitude [0..1] :param ramp_timesteps: time between steps in the ramp [s] :param ramp_steps: number of steps the whole ramp should have. This takes precedence over `ramp_timesteps` .. py:method:: _arb(duration, samples_amp, samples_freq, samples_phase, repetitions = 1, prepare_only = False, run_prepared = False, transform_amp=identity_float, transform_freq=identity_float, transform_phase=identity_float) .. py:method:: arb(duration, samples_amp = [], samples_freq = [], samples_phase = [], repetitions = 1, prepare_only = False, run_prepared = False, transform_amp=identity_float, transform_freq=identity_float, transform_phase=identity_float) Play Arbitrary Samples from a List This method allows to set the output amplitude, frequency an phase according to the values specified in respective lists. The whole sequence is played in the specified duration. The pattern store in the sample list can also be repeated. .. tip:: We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with :code:`prepapre_only = True` when the arb should be prepared and with :code:`run_prepared = True` when the prepared arb should be played. In both calls the other parameters have to be passed. :param samples_amp: List of amplitude samples. If this list is empty (default), the amplitude is not modified. :param samples_freq: List of frequency samples. If this list is empty (default), the frequency is not modified. :param samples_phase: List of phase samples. If this list is empty (default), the phase is not modified. :param duration: The time in which the whole sequence of samples should be played back [s]. :param repetitions: Number of times the sequence of all samples should be played. (default 1) :param prepare_only: Only write the sequence to RAM, don't play it. :param run_prepared: Play arb sequence previously prepared with :code:`prepare_only`. :param transform_amp: Function to transform amplitude samples, must take a single argument of type :type:`TFloat` and return a single :type:`TFloat`. :param transform_freq: Function to transform frequency samples (see :code:`transform_amp`). :param transform_phase: Function to transform phase samples (see :code:`transform_amp`). .. 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: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 = '')