atomiq.components.sinara.urukul¶
Classes¶
Sinara Urukul 4 Channel DDS |
|
Single DDS Channel of a Sinara Urukul |
Module Contents¶
- class atomiq.components.sinara.urukul.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 (artiq.coredevice.urukul.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.
- class atomiq.components.sinara.urukul.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 continous, 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 callibration.
- 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 lenght 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).