Qudi
Public Member Functions | List of all members
pulser_interface.PulserInterface Class Reference

Interface class to define the abstract controls and communication with all pulsing devices. More...

Inheritance diagram for pulser_interface.PulserInterface:
Inheritance graph
[legend]
Collaboration diagram for pulser_interface.PulserInterface:
Collaboration graph
[legend]

Public Member Functions

def get_constraints (self)
 Retrieve the hardware constrains from the Pulsing device. More...
 
def pulser_on (self)
 Switches the pulsing device on. More...
 
def pulser_off (self)
 Switches the pulsing device off. More...
 
def load_waveform (self, load_dict)
 Loads a waveform to the specified channel of the pulsing device. More...
 
def load_sequence (self, sequence_name)
 Loads a sequence to the channels of the device in order to be ready for playback. More...
 
def get_loaded_assets (self)
 
def clear_all (self)
 Clears all loaded waveforms from the pulse generators RAM/workspace. More...
 
def get_status (self)
 Retrieves the status of the pulsing hardware. More...
 
def get_sample_rate (self)
 Get the sample rate of the pulse generator hardware. More...
 
def set_sample_rate (self, sample_rate)
 Set the sample rate of the pulse generator hardware. More...
 
def get_analog_level (self, amplitude=None, offset=None)
 Retrieve the analog amplitude and offset of the provided channels. More...
 
def set_analog_level (self, amplitude=None, offset=None)
 Set amplitude and/or offset value of the provided analog channel(s). More...
 
def get_digital_level (self, low=None, high=None)
 Retrieve the digital low and high level of the provided/all channels. More...
 
def set_digital_level (self, low=None, high=None)
 Set low and/or high value of the provided digital channel. More...
 
def get_active_channels (self, ch=None)
 Get the active channels of the pulse generator hardware. More...
 
def set_active_channels (self, ch=None)
 
def write_waveform (self, name, analog_samples, digital_samples, is_first_chunk, is_last_chunk, total_number_of_samples)
 
def write_sequence (self, name, sequence_parameters)
 Write a new sequence on the device memory. More...
 
def get_waveform_names (self)
 Retrieve the names of all uploaded waveforms on the device. More...
 
def get_sequence_names (self)
 Retrieve the names of all uploaded sequence on the device. More...
 
def delete_waveform (self, waveform_name)
 Delete the waveform with name "waveform_name" from the device memory. More...
 
def delete_sequence (self, sequence_name)
 Delete the sequence with name "sequence_name" from the device memory. More...
 
def get_interleave (self)
 Check whether Interleave is ON or OFF in AWG. More...
 
def set_interleave (self, state=False)
 Turns the interleave of an AWG on or off. More...
 
def reset (self)
 Reset the device. More...
 
def has_sequence_mode (self)
 Asks the pulse generator whether sequence mode exists. More...
 
- Public Member Functions inherited from core.module.ModuleMeta
def __new__ (cls, name, bases, attrs)
 Collect declared Connectors, ConfigOptions and StatusVars into dictionaries. More...
 

Detailed Description

Interface class to define the abstract controls and communication with all pulsing devices.

Member Function Documentation

◆ clear_all()

def pulser_interface.PulserInterface.clear_all (   self)

Clears all loaded waveforms from the pulse generators RAM/workspace.

Returns
int: error code (0:OK, -1:error)

◆ delete_sequence()

def pulser_interface.PulserInterface.delete_sequence (   self,
  sequence_name 
)

Delete the sequence with name "sequence_name" from the device memory.

Parameters
strsequence_name: The name of the sequence to be deleted Optionally a list of sequence names can be passed.
Returns
list: a list of deleted sequence names.

◆ delete_waveform()

def pulser_interface.PulserInterface.delete_waveform (   self,
  waveform_name 
)

Delete the waveform with name "waveform_name" from the device memory.

Parameters
strwaveform_name: The name of the waveform to be deleted Optionally a list of waveform names can be passed.
Returns
list: a list of deleted waveform names.

◆ get_active_channels()

def pulser_interface.PulserInterface.get_active_channels (   self,
  ch = None 
)

Get the active channels of the pulse generator hardware.

Parameters
listch: optional, if specific analog or digital channels are needed to be asked without obtaining all the channels.
Returns
dict: where keys denoting the channel string and items boolean expressions whether channel are active or not.

Example for an possible input (order is not important): ch = ['a_ch2', 'd_ch2', 'a_ch1', 'd_ch5', 'd_ch1'] then the output might look like {'a_ch2': True, 'd_ch2': False, 'a_ch1': False, 'd_ch5': True, 'd_ch1': False}

If no parameter (or None) is passed to this method all channel states will be returned.

◆ get_analog_level()

def pulser_interface.PulserInterface.get_analog_level (   self,
  amplitude = None,
  offset = None 
)

Retrieve the analog amplitude and offset of the provided channels.

Parameters
listamplitude: optional, if the amplitude value (in Volt peak to peak, i.e. the full amplitude) of a specific channel is desired.
listoffset: optional, if the offset value (in Volt) of a specific channel is desired.
Returns
: (dict, dict): tuple of two dicts, with keys being the channel descriptor string (i.e. 'a_ch1') and items being the values for those channels. Amplitude is always denoted in Volt-peak-to-peak and Offset in volts.
Note
Do not return a saved amplitude and/or offset value but instead retrieve the current amplitude and/or offset directly from the device.

If nothing (or None) is passed then the levels of all channels will be returned. If no analog channels are present in the device, return just empty dicts.

Example of a possible input: amplitude = ['a_ch1', 'a_ch4'], offset = None to obtain the amplitude of channel 1 and 4 and the offset of all channels {'a_ch1': -0.5, 'a_ch4': 2.0} {'a_ch1': 0.0, 'a_ch2': 0.0, 'a_ch3': 1.0, 'a_ch4': 0.0}

◆ get_constraints()

def pulser_interface.PulserInterface.get_constraints (   self)

Retrieve the hardware constrains from the Pulsing device.

Returns
constraints object: object with pulser constraints as attributes.

Provides all the constraints (e.g. sample_rate, amplitude, total_length_bins, channel_config, ...) related to the pulse generator hardware to the caller.

SEE PulserConstraints CLASS IN pulser_interface.py FOR AVAILABLE CONSTRAINTS!!!

If you are not sure about the meaning, look in other hardware files to get an impression. If still additional constraints are needed, then they have to be added to the PulserConstraints class.

Each scalar parameter is an ScalarConstraints object defined in core.util.interfaces. Essentially it contains min/max values as well as min step size, default value and unit of the parameter.

PulserConstraints.activation_config differs, since it contain the channel configuration/activation information of the form: {<descriptor_str>: <channel_set>, <descriptor_str>: <channel_set>, ...}

If the constraints cannot be set in the pulsing hardware (e.g. because it might have no sequence mode) just leave it out so that the default is used (only zeros).

Example for configuration with default values:

constraints = PulserConstraints()

constraints.sample_rate.min = 10.0e6 constraints.sample_rate.max = 12.0e9 constraints.sample_rate.step = 10.0e6 constraints.sample_rate.default = 12.0e9

constraints.a_ch_amplitude.min = 0.02 constraints.a_ch_amplitude.max = 2.0 constraints.a_ch_amplitude.step = 0.001 constraints.a_ch_amplitude.default = 2.0

constraints.a_ch_offset.min = -1.0 constraints.a_ch_offset.max = 1.0 constraints.a_ch_offset.step = 0.001 constraints.a_ch_offset.default = 0.0

constraints.d_ch_low.min = -1.0 constraints.d_ch_low.max = 4.0 constraints.d_ch_low.step = 0.01 constraints.d_ch_low.default = 0.0

constraints.d_ch_high.min = 0.0 constraints.d_ch_high.max = 5.0 constraints.d_ch_high.step = 0.01 constraints.d_ch_high.default = 5.0

constraints.waveform_length.min = 80 constraints.waveform_length.max = 64800000 constraints.waveform_length.step = 1 constraints.waveform_length.default = 80

constraints.waveform_num.min = 1 constraints.waveform_num.max = 32000 constraints.waveform_num.step = 1 constraints.waveform_num.default = 1

constraints.sequence_num.min = 1 constraints.sequence_num.max = 8000 constraints.sequence_num.step = 1 constraints.sequence_num.default = 1

constraints.subsequence_num.min = 1 constraints.subsequence_num.max = 4000 constraints.subsequence_num.step = 1 constraints.subsequence_num.default = 1

If sequencer mode is available then these should be specified

constraints.repetitions.min = 0 constraints.repetitions.max = 65539 constraints.repetitions.step = 1 constraints.repetitions.default = 0

constraints.event_triggers = ['A', 'B'] constraints.flags = ['A', 'B', 'C', 'D']

constraints.sequence_steps.min = 0 constraints.sequence_steps.max = 8000 constraints.sequence_steps.step = 1 constraints.sequence_steps.default = 0

the name a_ch<num> and d_ch<num> are generic names, which describe UNAMBIGUOUSLY the

channels. Here all possible channel configurations are stated, where only the generic

names should be used. The names for the different configurations can be customary chosen.

activation_conf = OrderedDict() activation_conf['yourconf'] = {'a_ch1', 'd_ch1', 'd_ch2', 'a_ch2', 'd_ch3', 'd_ch4'} activation_conf['different_conf'] = {'a_ch1', 'd_ch1', 'd_ch2'} activation_conf['something_else'] = {'a_ch2', 'd_ch3', 'd_ch4'} constraints.activation_config = activation_conf

◆ get_digital_level()

def pulser_interface.PulserInterface.get_digital_level (   self,
  low = None,
  high = None 
)

Retrieve the digital low and high level of the provided/all channels.

Parameters
listlow: optional, if the low value (in Volt) of a specific channel is desired.
listhigh: optional, if the high value (in Volt) of a specific channel is desired.
Returns
: (dict, dict): tuple of two dicts, with keys being the channel descriptor strings (i.e. 'd_ch1', 'd_ch2') and items being the values for those channels. Both low and high value of a channel is denoted in volts.
Note
Do not return a saved low and/or high value but instead retrieve the current low and/or high value directly from the device.

If nothing (or None) is passed then the levels of all channels are being returned. If no digital channels are present, return just an empty dict.

Example of a possible input: low = ['d_ch1', 'd_ch4'] to obtain the low voltage values of digital channel 1 an 4. A possible answer might be {'d_ch1': -0.5, 'd_ch4': 2.0} {'d_ch1': 1.0, 'd_ch2': 1.0, 'd_ch3': 1.0, 'd_ch4': 4.0} Since no high request was performed, the high values for ALL channels are returned (here 4).

◆ get_interleave()

def pulser_interface.PulserInterface.get_interleave (   self)

Check whether Interleave is ON or OFF in AWG.

Returns
bool: True: ON, False: OFF

Will always return False for pulse generator hardware without interleave.

◆ get_sample_rate()

def pulser_interface.PulserInterface.get_sample_rate (   self)

Get the sample rate of the pulse generator hardware.

Returns
float: The current sample rate of the device (in Hz)

Do not return a saved sample rate from an attribute, but instead retrieve the current sample rate directly from the device.

◆ get_sequence_names()

def pulser_interface.PulserInterface.get_sequence_names (   self)

Retrieve the names of all uploaded sequence on the device.

Returns
list: List of all uploaded sequence name strings in the device workspace.

◆ get_status()

def pulser_interface.PulserInterface.get_status (   self)

Retrieves the status of the pulsing hardware.

Returns
(int, dict): tuple with an integer value of the current status and a corresponding dictionary containing status description for all the possible status variables of the pulse generator hardware.

◆ get_waveform_names()

def pulser_interface.PulserInterface.get_waveform_names (   self)

Retrieve the names of all uploaded waveforms on the device.

Returns
list: List of all uploaded waveform name strings in the device workspace.

◆ has_sequence_mode()

def pulser_interface.PulserInterface.has_sequence_mode (   self)

Asks the pulse generator whether sequence mode exists.

Returns
: bool, True for yes, False for no.

◆ load_sequence()

def pulser_interface.PulserInterface.load_sequence (   self,
  sequence_name 
)

Loads a sequence to the channels of the device in order to be ready for playback.

For devices that have a workspace (i.e. AWG) this will load the sequence from the device workspace into the channels. For a device without mass memory this will make the waveform/pattern that has been previously written with self.write_waveform ready to play.

Parameters
dict|listsequence_name: a dictionary with keys being one of the available channel index and values being the name of the already written waveform to load into the channel. Examples {1: rabi_ch1, 2: rabi_ch2} or {1: rabi_ch2, 2: rabi_ch1} If just a list of waveform names if given, the channel association will be invoked from the channel suffix '_ch1', '_ch2' etc.
Returns
dict: Dictionary containing the actually loaded waveforms per channel.

◆ load_waveform()

def pulser_interface.PulserInterface.load_waveform (   self,
  load_dict 
)

Loads a waveform to the specified channel of the pulsing device.

Parameters
dict|listload_dict: a dictionary with keys being one of the available channel index and values being the name of the already written waveform to load into the channel. Examples {1: rabi_ch1, 2: rabi_ch2} or {1: rabi_ch2, 2: rabi_ch1} If just a list of waveform names if given, the channel association will be invoked from the channel suffix '_ch1', '_ch2' etc.
{1: rabi_ch1, 2: rabi_ch2}
or {1: rabi_ch2, 2: rabi_ch1}

If just a list of waveform names if given, the channel association will be invoked from the channel suffix '_ch1', '_ch2' etc. A possible configuration can be e.g.

['rabi_ch1', 'rabi_ch2', 'rabi_ch3']
Returns
dict: Dictionary containing the actually loaded waveforms per channel.

For devices that have a workspace (i.e. AWG) this will load the waveform from the device workspace into the channel. For a device without mass memory, this will make the waveform/pattern that has been previously written with self.write_waveform ready to play.

Please note that the channel index used here is not to be confused with the number suffix in the generic channel descriptors (i.e. 'd_ch1', 'a_ch1'). The channel index used here is highly hardware specific and corresponds to a collection of digital and analog channels being associated to a SINGLE wavfeorm asset.

◆ pulser_off()

def pulser_interface.PulserInterface.pulser_off (   self)

Switches the pulsing device off.

Returns
int: error code (0:OK, -1:error)

◆ pulser_on()

def pulser_interface.PulserInterface.pulser_on (   self)

Switches the pulsing device on.

Returns
int: error code (0:OK, -1:error)

◆ reset()

def pulser_interface.PulserInterface.reset (   self)

Reset the device.

Returns
int: error code (0:OK, -1:error)

◆ set_analog_level()

def pulser_interface.PulserInterface.set_analog_level (   self,
  amplitude = None,
  offset = None 
)

Set amplitude and/or offset value of the provided analog channel(s).

Parameters
dictamplitude: dictionary, with key being the channel descriptor string (i.e. 'a_ch1', 'a_ch2') and items being the amplitude values (in Volt peak to peak, i.e. the full amplitude) for the desired channel.
dictoffset: dictionary, with key being the channel descriptor string (i.e. 'a_ch1', 'a_ch2') and items being the offset values (in absolute volt) for the desired channel.
Returns
(dict, dict): tuple of two dicts with the actual set values for amplitude and offset for ALL channels.

If nothing is passed then the command will return the current amplitudes/offsets.

Note
After setting the amplitude and/or offset values of the device, use the actual set return values for further processing.

◆ set_digital_level()

def pulser_interface.PulserInterface.set_digital_level (   self,
  low = None,
  high = None 
)

Set low and/or high value of the provided digital channel.

Parameters
dictlow: dictionary, with key being the channel descriptor string (i.e. 'd_ch1', 'd_ch2') and items being the low values (in volt) for the desired channel.
dicthigh: dictionary, with key being the channel descriptor string (i.e. 'd_ch1', 'd_ch2') and items being the high values (in volt) for the desired channel.
Returns
(dict, dict): tuple of two dicts where first dict denotes the current low value and the second dict the high value for ALL digital channels. Keys are the channel descriptor strings (i.e. 'd_ch1', 'd_ch2')

If nothing is passed then the command will return the current voltage levels.

Note
After setting the high and/or low values of the device, use the actual set return values for further processing.

◆ set_interleave()

def pulser_interface.PulserInterface.set_interleave (   self,
  state = False 
)

Turns the interleave of an AWG on or off.

Parameters
boolstate: The state the interleave should be set to (True: ON, False: OFF)
Returns
bool: actual interleave status (True: ON, False: OFF)
Note
After setting the interleave of the device, retrieve the interleave again and use that information for further processing.

Unused for pulse generator hardware other than an AWG.

◆ set_sample_rate()

def pulser_interface.PulserInterface.set_sample_rate (   self,
  sample_rate 
)

Set the sample rate of the pulse generator hardware.

Parameters
floatsample_rate: The sampling rate to be set (in Hz)
Returns
float: the sample rate returned from the device (in Hz).
Note
After setting the sampling rate of the device, use the actually set return value for further processing.

◆ write_sequence()

def pulser_interface.PulserInterface.write_sequence (   self,
  name,
  sequence_parameters 
)

Write a new sequence on the device memory.

Parameters
strname: the name of the waveform to be created/append to
dictsequence_parameters: dictionary containing the parameters for a sequence
Returns
: int, number of sequence steps written (-1 indicates failed process)

The documentation for this class was generated from the following file: