Qudi
Public Member Functions | Public Attributes | List of all members
pulse_streamer.PulseStreamer Class Reference

Methods to control PulseStreamer. More...

Inheritance diagram for pulse_streamer.PulseStreamer:
Inheritance graph
[legend]
Collaboration diagram for pulse_streamer.PulseStreamer:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, config, kwargs)
 
def on_activate (self)
 Establish connection to pulse streamer and tell it to cancel all operations.
 
def on_deactivate (self)
 
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 upload_asset (self, asset_name=None)
 Upload an already hardware conform file to the device. More...
 
def load_asset (self, asset_name, load_dict=None)
 Loads a sequence or waveform to the specified channel of the pulsing device. More...
 
def clear_all (self)
 Clears all loaded waveforms from the pulse generators RAM. 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. More...
 
def get_digital_level (self, low=None, high=None)
 Retrieve the digital low and high level of the provided 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)
 
def set_active_channels (self, ch=None)
 
def get_loaded_asset (self)
 Retrieve the currently loaded asset name of the device. More...
 
def get_uploaded_asset_names (self)
 Retrieve the names of all uploaded assets on the device. More...
 
def get_saved_asset_names (self)
 Retrieve the names of all sampled and saved assets on the host PC. More...
 
def delete_asset (self, asset_name)
 Delete all files associated with an asset with the passed asset_name from the device memory. More...
 
def set_asset_dir_on_device (self, dir_path)
 Change the directory where the assets are stored on the device. More...
 
def get_asset_dir_on_device (self)
 Ask for the directory where the hardware conform files are stored on the device. 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 tell (self, command)
 Sends a command string to the device. More...
 
def ask (self, question)
 Asks the device a 'question' and receive and return an answer from it. 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.BaseMixin
def __init__ (self, manager, name, config=None, callbacks=None, kwargs)
 Initialise Base class object and set up its state machine. More...
 
def log (self)
 Returns a logger object.
 
def is_module_threaded (self)
 Returns whether the module shall be started in a thread.
 
def on_activate (self)
 Method called when module is activated. More...
 
def on_deactivate (self)
 Method called when module is deactivated. More...
 
def getStatusVariables (self)
 Return a dict of variable names and their content representing the module state for saving. More...
 
def setStatusVariables (self, variableDict)
 Give a module a dict of variable names and their content representing the module state. More...
 
def getConfiguration (self)
 Return the configration dictionary for this module. More...
 
def get_connector (self, connector_name)
 Return module connected to the given named connector. More...
 
- Public Member Functions inherited from core.module.ModuleMeta
def __new__ (cls, name, bases, attrs)
 Collect declared Connectors, ConfigOptions and StatusVars into dictionaries. More...
 

Public Attributes

 pulsed_file_dir
 
 host_waveform_directory
 
 current_status
 
 sample_rate
 
 current_loaded_asset
 
 pulse_streamer
 
- Public Attributes inherited from core.module.BaseMixin
 module_state
 
 connectors
 

Detailed Description

Methods to control PulseStreamer.

Example config for copy-paste:

pulse_streamer: module 'swabian_instruments.pulse_streamer.PulseStreamer' pulsestreamer_ip '192.168.1.100' laser_channel 0 uw_x_channel 2

Member Function Documentation

◆ ask()

def pulse_streamer.PulseStreamer.ask (   self,
  question 
)

Asks the device a 'question' and receive and return an answer from it.

a

Parameters
stringquestion: string containing the command
Returns
string: the answer of the device to the 'question' in a string

◆ clear_all()

def pulse_streamer.PulseStreamer.clear_all (   self)

Clears all loaded waveforms from the pulse generators RAM.

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

Unused for digital pulse generators without storage capability (PulseBlaster, FPGA).

◆ delete_asset()

def pulse_streamer.PulseStreamer.delete_asset (   self,
  asset_name 
)

Delete all files associated with an asset with the passed asset_name from the device memory.

Parameters
strasset_name: The name of the asset to be deleted Optionally a list of asset names can be passed.
Returns
int: error code (0:OK, -1:error)

Unused for digital pulse generators without sequence storage capability (PulseBlaster, FPGA).

◆ get_analog_level()

def pulse_streamer.PulseStreamer.get_analog_level (   self,
  amplitude = None,
  offset = None 
)

Retrieve the analog amplitude and offset of the provided channels.

Parameters
listamplitude: optional, if a specific amplitude value (in Volt peak to peak, i.e. the full amplitude) of a channel is desired.
listoffset: optional, if a specific high value (in Volt) of a channel is desired.
Returns
: (dict, dict): tuple of two dicts, with keys being the channel number and items being the values for those channels. Amplitude is always denoted in Volt-peak-to-peak and Offset in (absolute) Voltage.

◆ get_asset_dir_on_device()

def pulse_streamer.PulseStreamer.get_asset_dir_on_device (   self)

Ask for the directory where the hardware conform files are stored on the device.

Returns
str: The current file directory

Unused for digital pulse generators without changeable file structure (PulseBlaster, FPGA).

◆ get_constraints()

def pulse_streamer.PulseStreamer.get_constraints (   self)

Retrieve the hardware constrains from the Pulsing device.

Returns
dict: dict with constraints for the sequence generation and GUI

Provides all the constraints (e.g. sample_rate, amplitude, total_length_bins, channel_config, ...) related to the pulse generator hardware to the caller. The keys of the returned dictionary are the str name for the constraints (which are set in this method). No other keys should be invented. 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 add to all files containing this interface. The items of the keys are again dictionaries which have the generic dictionary form: {'min':

, 'max':

, 'step':

, 'unit': '

'}

Only the keys 'activation_config' and differs, since it contain the channel configuration/activation information.

If the constraints cannot be set in the pulsing hardware (because it might e.g. has no sequence mode) then write just zero to each generic dict. Note that there is a difference between float input (0.0) and integer input (0). ALL THE PRESENT KEYS OF THE CONSTRAINTS DICT MUST BE ASSIGNED!

◆ get_digital_level()

def pulse_streamer.PulseStreamer.get_digital_level (   self,
  low = None,
  high = None 
)

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

Parameters
listlow: optional, if a specific low value (in Volt) of a channel is desired.
listhigh: optional, if a specific high value (in Volt) of a channel is desired.
Returns
: (dict, dict): tuple of two dicts, with keys being the channel number and items being the values for those channels. Both low and high value of a channel is denoted in (absolute) Voltage.
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 no entries provided then the levels of all channels where simply returned. If no digital channels provided, return just an empty dict.

Example of a possible input: low = [1,4] to obtain the low voltage values of digital channel 1 an 4. A possible answer might be {1: -0.5, 4: 2.0} {} since no high request was performed.

The major difference to analog signals is that digital signals are either ON or OFF, whereas analog channels have a varying amplitude range. In contrast to analog output levels, digital output levels are defined by a voltage, which corresponds to the ON status and a voltage which corresponds to the OFF status (both denoted in (absolute) voltage)

In general there is no bijective correspondence between (amplitude, offset) and (value high, value low)!

◆ get_interleave()

def pulse_streamer.PulseStreamer.get_interleave (   self)

Check whether Interleave is ON or OFF in AWG.

Returns
bool: True: ON, False: OFF

Unused for pulse generator hardware other than an AWG.

◆ get_loaded_asset()

def pulse_streamer.PulseStreamer.get_loaded_asset (   self)

Retrieve the currently loaded asset name of the device.

Returns
str: Name of the current asset, that can be either a filename a waveform, a sequence ect.

◆ get_sample_rate()

def pulse_streamer.PulseStreamer.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 in a class variable, but instead retrieve the current sample rate directly from the device.

◆ get_saved_asset_names()

def pulse_streamer.PulseStreamer.get_saved_asset_names (   self)

Retrieve the names of all sampled and saved assets on the host PC.

This is no list of the file names.

Returns
list: List of all saved asset name strings in the current directory of the host PC.

◆ get_status()

def pulse_streamer.PulseStreamer.get_status (   self)

Retrieves the status of the pulsing hardware.

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

◆ get_uploaded_asset_names()

def pulse_streamer.PulseStreamer.get_uploaded_asset_names (   self)

Retrieve the names of all uploaded assets on the device.

Returns
list: List of all uploaded asset name strings in the current device directory. This is no list of the file names.

Unused for digital pulse generators without sequence storage capability (PulseBlaster, FPGA).

◆ has_sequence_mode()

def pulse_streamer.PulseStreamer.has_sequence_mode (   self)

Asks the pulse generator whether sequence mode exists.

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

◆ load_asset()

def pulse_streamer.PulseStreamer.load_asset (   self,
  asset_name,
  load_dict = None 
)

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

Parameters
strasset_name: The name of the asset to be loaded
dictload_dict: a dictionary with keys being one of the available channel numbers and items being the name of the already sampled waveform/sequence files. Examples {1: rabi_Ch1, 2: rabi_Ch2} {1: rabi_Ch2, 2: rabi_Ch1} This parameter is optional. If none is given then the channel association is invoked from the sequence generation, i.e. the filename appendix (_Ch1, _Ch2 etc.)
Returns
int: error code (0:OK, -1:error)

◆ pulser_off()

def pulse_streamer.PulseStreamer.pulser_off (   self)

Switches the pulsing device off.

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

◆ pulser_on()

def pulse_streamer.PulseStreamer.pulser_on (   self)

Switches the pulsing device on.

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

◆ reset()

def pulse_streamer.PulseStreamer.reset (   self)

Reset the device.

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

◆ set_analog_level()

def pulse_streamer.PulseStreamer.set_analog_level (   self,
  amplitude = None,
  offset = None 
)

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

Parameters
dictamplitude: dictionary, with key being the channel 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 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.

If nothing is passed then the command will return two empty dicts.

◆ set_asset_dir_on_device()

def pulse_streamer.PulseStreamer.set_asset_dir_on_device (   self,
  dir_path 
)

Change the directory where the assets are stored on the device.

Parameters
strdir_path: The target directory
Returns
int: error code (0:OK, -1:error)

Unused for digital pulse generators without changeable file structure (PulseBlaster, FPGA).

◆ set_digital_level()

def pulse_streamer.PulseStreamer.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 and items being the low values (in volt) for the desired channel.
dicthigh: dictionary, with key being the channel 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.

If nothing is passed then the command will return two empty dicts.

Note
After setting the high and/or low values of the device, retrieve them again for obtaining the actual set value(s) and use that information for further processing.

The major difference to analog signals is that digital signals are either ON or OFF, whereas analog channels have a varying amplitude range. In contrast to analog output levels, digital output levels are defined by a voltage, which corresponds to the ON status and a voltage which corresponds to the OFF status (both denoted in (absolute) voltage)

In general there is no bijective correspondence between (amplitude, offset) and (value high, value low)!

◆ set_interleave()

def pulse_streamer.PulseStreamer.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 pulse_streamer.PulseStreamer.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.
Note
After setting the sampling rate of the device, retrieve it again for obtaining the actual set value and use that information for further processing.

◆ tell()

def pulse_streamer.PulseStreamer.tell (   self,
  command 
)

Sends a command string to the device.

Parameters
stringcommand: string containing the command
Returns
int: error code (0:OK, -1:error)

◆ upload_asset()

def pulse_streamer.PulseStreamer.upload_asset (   self,
  asset_name = None 
)

Upload an already hardware conform file to the device.

Does NOT load it into channels.

Parameters
namestring, name of the ensemble/seqeunce to be uploaded
Returns
int: error code (0:OK, -1:error)

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