atomiq.components.sinara¶
Submodules¶
Classes¶
Sinara Urukul 4 Channel DDS |
|
Single DDS Channel of a Sinara Urukul |
|
Kasli Module |
|
Fast Digital Input Channel Attached to Kasli |
|
Fast Digital Output Channel Attached to Kasli |
|
Sinara Sampler 8 Channel ADC |
|
Single ADC Channel of a Sinara Sampler |
Package Contents¶
- class atomiq.components.sinara.Urukul(cpld, default_profile=7, *args, **kwargs)[source]¶
Bases:
atomiq.components.primitives.ComponentSinara Urukul 4 Channel DDS
This class represents the Sinara Urukul 4 channel DDS RF source.
- Parameters:
cpld (CPLD) -- The ARTIQ cpld device from the device_db, e.g. @urukul0_cpld.
default_profile (artiq.language.types.TInt32) -- Which profile in the Urukul CPLD to use by default, i.e. if no profile is given (default 7)
- kernel_invariants¶
- cpld¶
- profile = 7¶
- _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.
- _set_profile_artiq9(profile=ad9910.DEFAULT_PROFILE, trigger=True)[source]¶
Set the Urukul to the given profile.
- Parameters:
profile (TInt32) -- profile
trigger (TBool) -- pulse io_update
- set_profile(profile=ad9910.DEFAULT_PROFILE, trigger=True)[source]¶
Set the Urukul to the given profile.
- Parameters:
profile (TInt32) -- profile
trigger (TBool) -- pulse io_update
- 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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- 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.sinara.UrukulChannel(urukul, device, ttl=None, default_attenuation=19.0, profile_arb=0, use_drg=True, auto_sync_drg=0, read_delay=np.int64(8000), write_delay=np.int64(8000), calc_delay_modifier=np.int64(7), *args, **kwargs)[source]¶
Bases:
atomiq.components.electronics.rfsource.RFSource,atomiq.components.primitives.SwitchableSingle DDS Channel of a Sinara Urukul
- Parameters:
urukul (Urukul) -- The Urukul component this channel belongs to
device (artiq.language.types.TStr) -- The ARTIQ device from the device_db representing the Urukul channel, e.g. @urukul0_ch0
ttl -- The ARTIQ device from the device_db representing the Urukul fast RF switch, e.g. @ttl_urukul0_sw0
default_attenuation -- Default attenuation to set for the channel on startup. (default -19dBm)
profile_arb (artiq.language.types.TInt32) -- Profile on the DDS to use for arbitrary function generation. (default 0)
use_drg (artiq.language.types.TBool) -- Use the DRG for amplitude or frequency ramps (recommended). (default True)
auto_sync_drg (artiq.language.types.TInt32) -- Defined if the drg is synced to either frequency (1) or amplitude (2) in the prepare phase. Default is not synced (0). Syncing is recommended in combination with
blindif continuous operation is required.read_delay (artiq.language.types.TInt64) -- Delay necessary for read operations of 64bit in mu. This is hardware specific and can be obtained from
calibrate_read_write_delays().The default value is conservative but fine for most uses. If you need to for example run drg ramps in quick succession you should adjust this.write_delay (artiq.language.types.TInt64) -- Delay necessary for write operations of 64bit in mu. See
read_delayfor more info.calc_delay_modifier (artiq.language.types.TInt64) -- Multiplier for delays inserted into function code to accommodate for CPU calculation time and avoid underflow. If necessary you can try to reduce the conservative default value. Specifically for Kasli SoC, the necessary multiplier is smaller.
Tip
The
ramp()method can be used in combination with theblindcomponent argument. This allows for generating continuous, jump-free ramps between experiments. This makes it possible to use the dds output to generate a lock signal for a laser cavity lock.Attention
Setting parameters before the DRG is synced with the python object would break the continuity. Run
sync_drg()before setting amplitude, frequency or phase parameters or useauto_sync_drg.- kernel_invariants¶
- urukul¶
- device¶
- attenuation = 19.0¶
- profile_arb = 0¶
- profile_default = 7¶
- use_drg = True¶
- auto_sync_drg = 0¶
- read_delay¶
- write_delay¶
- calc_delay_modifier¶
- init()[source]¶
Initialize the urukul channel. Necessary only once after power on.
Warning
This function is not called automatically as it is slow and resets the device leading to a frequency/amplitude jump.
- _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.
- set(frequency=float('nan'), amplitude=float('nan'), phase=0.0, profile=-1)[source]¶
Set the frequency and amplitude. Frequency/amplitude are set to the last known value if
float("nan")is passed (default).- Parameters:
frequency (artiq.language.types.TFloat) -- Frequency in Hz (
float("nan")to use previous value)amplitude (artiq.language.types.TFloat) -- Amplitude in units of full scale (
float("nan")to use previous value)phase (artiq.language.types.TFloat) -- Phase tuning word in turns
profile (artiq.language.types.TInt32) -- DDS Profile (
-1to keep current profile)
- set_att(attenuation)[source]¶
Set the hardware attenuation for this urukul channel via CPLD.
- Parameters:
attenuation (artiq.language.types.TFloat) -- channel attenuation (0. to 31.0 in 0.5 increments) [dB]
- calibrate_read_write_delays(security_factor=1.4)[source]¶
Helper function to calibrate the delays necessary in high level functions when writing and reading registers from the DDS to avoid underflows.
The default values for the component arguments read_delay and write_delay are conservative and should generally work. If you need fast successive drg ramps you can obtain your hardware specific values with this method and try to lower the delays in your components db.
- Parameters:
security_factor (artiq.language.types.TFloat) -- Factor with which the returned delay values are multiplied. Since the CPU is non-deterministic the real calculation time can vary, which is compensated by the security factor.
- Returns:
The read (0) and write (1) delays in machine units.
- Return type:
tuple[TInt64, TInt64]
Attention
This method turns off the urukul output writes into the drg registers and therefore brings the drg out of sync. It is generally not meant to run within a real experiment but for one-time calibration.
- amplitude_to_drg_step(val)[source]¶
- Parameters:
val (artiq.language.types.TFloat)
- Return type:
artiq.language.types.TInt32
- read64_32(addr)[source]¶
Read two 32-bit values from 64-bit register. Advances time cursor by 8640ns and removes all slack
- Parameters:
addr (artiq.language.types.TInt32) -- Register address
- Returns:
Tuple of two 32-bit integer register values
- _drg_write_registers(ramp_low, ramp_high, step_word)[source]¶
Writes the registers for drg ramp limits and step size. Advances time cursor by 2496ns
- Parameters:
ramp_low (artiq.language.types.TInt32)
ramp_high (artiq.language.types.TInt32)
step_word (artiq.language.types.TInt32)
- sync_drg(target)[source]¶
Synchronises the python object with the current register values of the DRG. Advances time cursor by 25us.
- Parameters:
target (artiq.language.types.TInt32) -- Target to synchronise to. 1 for frequency, 2 for amplitude.
- _write_drg_ramp(ramp_rate, end_val, old_low, old_high, step)[source]¶
- Parameters:
ramp_rate (artiq.language.types.TInt32)
end_val (artiq.language.types.TInt32)
old_low (artiq.language.types.TInt32)
old_high (artiq.language.types.TInt32)
step (artiq.language.types.TInt32)
- _amplitude_ramp_drg(duration, amplitude_start, amplitude_end, ramp_timestep=0.0002)[source]¶
- Parameters:
duration (artiq.language.types.TFloat)
amplitude_start (artiq.language.types.TFloat)
amplitude_end (artiq.language.types.TFloat)
ramp_timestep (artiq.language.types.TFloat)
- _frequency_ramp_drg(duration, frequency_start, frequency_end, ramp_timestep)[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(duration, frequency_start, frequency_end, amplitude_start, amplitude_end, ramp_timestep=5e-05)[source]¶
This method implements a stupid ramp on an abstract level. This will most likely work but be slow. If your hardware has native support for ramping, please override this function when you inherit from RFSource
- Parameters:
duration (artiq.language.types.TFloat)
frequency_start (artiq.language.types.TFloat)
frequency_end (artiq.language.types.TFloat)
amplitude_start (artiq.language.types.TFloat)
amplitude_end (artiq.language.types.TFloat)
ramp_timestep (artiq.language.types.TFloat)
- ramp(duration, frequency_start=float('nan'), frequency_end=float('nan'), amplitude_start=float('nan'), amplitude_end=float('nan'), ramp_timestep=float('nan'), ramp_steps=-1)[source]¶
Ramp frequency and amplitude over a given duration. Parameters default to
-1ornanto indicate no change. If the start frequency/amplitude is set tonan, the ramp starts from the last frequency/amplitude which was set. This method advances the timeline by ´duration´Tip
This method can be used in combination with the
blindcomponent argument. This allows for generating continuous, jump-free ramps between experiments. This makes it possible to use the dds output to generate a lock signal for a laser cavity lock. Note that in this mode using amplitude and frequency ramps leads to undefined behavior when switching between them. As the DRG can only address either amplitude or frequency, parallel ramps of both parameters are ramped in a simple step by step way. Usage of the DRG can be avoided by setting the component attributeuse_drgto False.Attention
When using the DRG, this method always advances the timeline by at least 10us, even if the ramp is shorter. Reading and writing of DDS registers is scheduled in the past, this means no drg changes should be made in the ~100us (dependent on
read_delayandwrite_delay) before this function is called.- Parameters:
duration (artiq.language.types.TFloat) -- ramp duration [s]
frequency_start (artiq.language.types.TFloat) -- initial frequency [Hz]
frequency_end (artiq.language.types.TFloat) -- end frequency [Hz]
amplitude_start (artiq.language.types.TFloat) -- initial amplitude [0..1]
amplitude_end (artiq.language.types.TFloat) -- end amplitude [0..1]
ramp_timesteps -- time between steps in the ramp [s]
ramp_steps (artiq.language.types.TInt32) -- number of steps the whole ramp should have. This takes precedence over ramp_timesteps
ramp_timestep (artiq.language.types.TFloat)
- _write_ram(data, transform=identity_float_int32)[source]¶
Write data to RAM.
Note
This is copied from upstream artiq to fix a bug, where the data is written into the RAM in reversed order. Once this is fixed upstream, we can remove this
The profile to write to and the step, start, and end address need to be configured before and separately using
set_profile_ram()and the parent CPLD set_profile.- Parameters:
data (TList(TFloat)) -- Data to be written to RAM.
- _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)[source]¶
- Parameters:
duration (artiq.language.types.TFloat)
samples_amp (TList(TFloat))
samples_freq (TList(TFloat))
samples_phase (TList(TFloat))
repetitions (artiq.language.types.TInt32)
prepare_only (artiq.language.types.TBool)
run_prepared (artiq.language.types.TBool)
- _prepare_arb(samples, t_step, repeat=False, ram_offset=0, profile=0, transform=identity_float_int32)[source]¶
Prepare a RAM profile for arbitrary amplitude modulation with amplitude values and equidistant time steps.
- Parameters:
samples (TList(TFloat)) -- List of sample values in units im machine units. Maximum length is 1024 samples.
t_step (artiq.language.types.TFloat) -- Time that should pass between the samples of the amplitudes list in units of s.
repeat (artiq.language.types.TBool) -- Should the sequence of samples be repeated? If not the last value is hold. (default False)
ram_offset (artiq.language.types.TInt32) -- Address offset of the RAM storage address. (default 0)
profile (artiq.language.types.TInt32) -- Profile of the DDS to use for the RAM mode. If none is given, profile 0 is used.
- Return type:
artiq.language.types.TInt32
- _run_arb(duration, ram_destination, trigger=True, profile=-1, start_time=0)[source]¶
- Parameters:
duration (artiq.language.types.TFloat)
ram_destination (artiq.language.types.TInt32)
trigger (artiq.language.types.TBool)
profile (artiq.language.types.TInt32)
start_time (artiq.language.types.TInt64)
- 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)[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.
Tip
We supports a scheme to prepare the arb function before it is actually used. If that is needed, run this function with
prepapre_only = Truewhen the arb should be prepared and withrun_prepared = Truewhen the prepared arb should be played. In both calls the other parameters have to be passed.Attention
This method always advances the timeline by at least 1.5us, even if the arb sample is shorter. Reading and writing of DDS registers is scheduled in the past, this means no drg changes should be made in ~5us (for
run_prepared=True, if wrtiting to RAM, this time is longer) before the function call.- Parameters:
samples_amp (TList(TFloat)) -- List of amplitude samples. If this list is empty (default), the amplitude is not modified.
samples_freq (TList(TFloat)) -- List of frequency samples. If this list is empty (default), the frequency is not modified.
samples_phase (TList(TFloat)) -- List of phase samples. If this list is empty (default), the phase is not modified.
duration (artiq.language.types.TFloat) -- The time in which the whole sequence of samples should be played back [s].
repetitions (artiq.language.types.TInt32) -- Number of times the sequence of all samples should be played. (default 1)
prepare_only (artiq.language.types.TBool) -- Only write the sequence to RAM, don't play it.
run_prepared (artiq.language.types.TBool) -- Play arb sequence previously prepared with
prepare_only.transform_amp -- Function to transform amplitude samples, must take a single argument of type
TFloatand return a singleTFloat.transform_freq -- Function to transform frequency samples (see
transform_amp).transform_phase -- Function to transform phase samples (see
transform_amp).
- amplitude = 0.0¶
- frequency = 100000000.0¶
- phase = 0.0¶
- default_ramp_steps = 30¶
- blind = False¶
- set_frequency(frequency)¶
- Parameters:
frequency (artiq.language.types.TFloat)
- _check_frequency(frequency)¶
- get_frequency()¶
- Return type:
artiq.language.types.TFloat
- set_amplitude(amplitude)¶
- Parameters:
amplitude (artiq.language.types.TFloat)
- _check_amplitude(amplitude)¶
- Parameters:
amplitude (artiq.language.types.TFloat)
- get_amplitude()¶
- Return type:
artiq.language.types.TFloat
- set_phase(phase)¶
- Parameters:
phase (artiq.language.types.TFloat)
- get_phase()¶
- Return type:
artiq.language.types.TFloat
- 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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- set_parameter(value, channel=None)¶
- Parameters:
value (artiq.language.types.TFloat)
channel (artiq.language.types.TStr)
- 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.sinara.Kasli(*args, **kwargs)[source]¶
Bases:
atomiq.components.primitives.ComponentKasli Module
- 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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- 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.sinara.DioInput(kasli, ttl, *args, **kwargs)[source]¶
Bases:
atomiq.components.primitives.Component,atomiq.components.primitives.MeasurableFast Digital Input Channel Attached to Kasli
This class describes the fast digital input channels directly attached to your Kasli.
- Parameters:
kasli (Kasli) -- Kasli module that this digital input belongs to
ttl -- ARTIQ device from device_db.py for the DIO channel
- kernel_invariants¶
- kasli¶
- ttl¶
- wait_for_trigger(timeout, edge='rising', log=False, keep_open=False)[source]¶
Wait for a trigger to occur. This function sets the time cursor to the time where the trigger edge is detected. If no edge is detected in the given timeout, the time cursor is set to the end of the gating window (set by timeout).
- Parameters:
timeout (artiq.language.types.TFloat) -- Timeout in seconds
edge (artiq.language.types.TStr) -- Edge to wait for (rising or falling)
log (artiq.language.types.TBool) -- If True emits a warning if no trigger is detected
keep_open (artiq.language.types.TBool) -- True keeps the gate open after the trigger window. This can be used to rapidly trigger on subsequent pulses on the microsecond timescale. Note that the trigger listener must be closed manually afterwards by either running this function with keep_open=True or by calling self.ttl._set_sensitivity(0) to avoid kernel slowdown.
- Returns:
True if a trigger is detected, False if not
- Return type:
bool
- Info:
Typically a delay of about 2 us is necessary after this command to avoid underflows.
- 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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- measurement_channels()¶
- class atomiq.components.sinara.DioOutput(kasli, ttl, *args, **kwargs)[source]¶
Bases:
atomiq.components.primitives.Component,atomiq.components.primitives.SwitchableFast Digital Output Channel Attached to Kasli
This class describes the fast digital output channels directly attached to your Kasli.
- Parameters:
kasli (Kasli) -- Kasli module that this digital output belongs to
ttl -- ARTIQ device from device_db.py for the DIO channel
- kernel_invariants¶
- kasli¶
- ttl¶
- 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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- 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.sinara.Sampler(sampler_device, default_gain=[0] * 8, *args, **kwargs)[source]¶
Bases:
atomiq.components.electronics.adc.ADCSinara Sampler 8 Channel ADC
This class represents the Sinara Sampler with all its 8 channels. It allows to sample all channels at once and to read out the result.
- Parameters:
sampler_device -- The ARTIQ device for the sampler from the device_db, e.g. @sampler0
default_gain (TList(TInt32)) -- List with 8 entries setting the default gain for the 8 channels at startup. (default [0, .. , 0])
- kernel_invariants¶
- _sampler_device¶
- default_gain = [0, 0, 0, 0, 0, 0, 0, 0]¶
- _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.
- set_gain(channel, gain=0)[source]¶
- Parameters:
channel (artiq.language.types.TInt32)
gain (artiq.language.types.TInt32)
- _measure(target_arr)[source]¶
Measure a single sample on all 8 channels at once.
This function advances the timeline by 175 us
- Parameters:
target_arr (TArray(TFloat))
- Return type:
TArray(TFloat)
- num_chan¶
- invalid_return¶
- _build()¶
Specify here what should be done for this component in the build phase
- measure(samples=1, channel='')¶
Measures all channels and returns the mean for a given number of subsequent samples.
This method advances the timeline by samples * sampling_time
- Parameters:
samples (artiq.language.types.TInt32) -- number of samples to take and average
channel (artiq.language.types.TStr)
- Return type:
TArray(TFloat)
- experiment¶
- identifier¶
- debug_output = False¶
- core¶
- _kernel_invariants¶
- _prepare_done = False¶
- _build_done = False¶
- _hooks_done = []¶
- _recursive_prepare()¶
- _prepare()¶
Specify here what should be done for this component in the prepare phase
- _recursive_build()¶
- _do_prerun()¶
- required_components(ancestors=[])¶
- 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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- measurement_channels()¶
- class atomiq.components.sinara.SamplerChannel(default_gain=0, *args, **kwargs)[source]¶
Bases:
atomiq.components.electronics.adc.ADCChannelSingle ADC Channel of a Sinara Sampler
This class represents a single channel of a Sinara Sampler as an
ADCChannel.- Parameters:
default_gain (artiq.language.types.TInt32) -- Default gain to set for the Sampler channel at startup. (default 0)
- set_gain(gain)[source]¶
Set the gain for the Sampler Channel
- Parameters:
gain (artiq.language.types.TInt32) -- Gain in machine units (0: 1, ..., 3: 1000)
- kernel_invariants¶
- adc_device¶
- channel¶
- measure(samples=1, cached=False, channel='')¶
- Parameters:
samples (artiq.language.types.TInt32)
cached (artiq.language.types.TBool)
channel (artiq.language.types.TStr)
- Return type:
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 (orNone) instead: when the repository is scanned to build the list of available experiments and when the dataset browserartiq_browseris used to open or run the analysis stage of an experiment. Do not rely on being able to operate on devices or arguments inbuild().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
BooleanValueandNumberValue.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,floator 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=Noneto 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 asslice(*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
Falseto prevent archival together with the run's results. Default isTrue.
- get_dataset_metadata(key, default=NoDefault)¶
Returns the metadata of a dataset.
Returns dictionary with items describing the dataset, including the units, scale and precision.
This function is used to get additional information for displaying the dataset.
See
set_dataset()for documentation of metadata items.
- setattr_dataset(key, default=NoDefault, archive=True)¶
Sets the contents of a dataset as attribute. The names of the dataset and of the attribute are the same.
- set_default_scheduling(priority=None, pipeline_name=None, flush=None)¶
Sets the default scheduling options.
This function should only be called from
build.
- measurement_channels()¶