def load_asset(self, asset_name, load_dict=None): """ Loads a sequence or waveform to the specified channel of the pulsing device. @param str asset_name: The name of the asset to be loaded @param dict load_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.) @return int: error code (0:OK, -1:error) Unused for digital pulse generators without sequence storage capability (PulseBlaster, FPGA). """ if load_dict is None: load_dict = {} raise InterfaceImplementationError('PulserInterface>load_asset') return -1
def runTaskStep(self): """ Implement one work step of your task here. @return bool: True if the task should continue running, False if it should finish. """ raise InterfaceImplementationError( 'runTaskStep needs to be implemented in subclasses!') return False
def pulser_off(self): """ Switches the pulsing device off. @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('PulserInterface>pulser_off') return -1
def set_active_channels(self, ch=None): """ Set the active channels for the pulse generator hardware. @param dict ch: dictionary with keys being the analog or digital string generic names for the channels with items being a boolean value. @return dict: with the actual set values for active channels for analog and digital values. If nothing is passed then the command will return an empty dict. Note: After setting the active channels of the device, retrieve them again for obtaining the actual set value(s) and use that information for further processing. Example for possible input: ch={'a_ch2': True, 'd_ch1': False, 'd_ch3': True, 'd_ch4': True} to activate analog channel 2 digital channel 3 and 4 and to deactivate digital channel 1. The hardware itself has to handle, whether separate channel activation is possible. """ if ch is None: ch = {} raise InterfaceImplementationError( 'PulserInterface>set_active_channels') return {}, {}
def set_digital_level(self, low=None, high=None): """ Set low and/or high value of the provided digital channel. @param dict low: dictionary, with key being the channel and items being the low values (in volt) for the desired channel. @param dict high: dictionary, with key being the channel and items being the high values (in volt) for the desired channel. @return (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)! """ if low is None: low = {} if high is None: high = {} raise InterfaceImplementationError('PulserInterface>set_a_ch_offset') return -1
def has_sequence_mode(self): """ Asks the pulse generator whether sequence mode exists. @return: bool, True for yes, False for no. """ raise InterfaceImplementationError('PulserInterface>has_sequence_mode') return -1
def reset(self): """ Reset the device. @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('PulserInterface>reset') return -1
def get_loaded_asset(self): """ Retrieve the currently loaded asset name of the device. @return str: Name of the current asset, that can be either a filename a waveform, a sequence ect. """ raise InterfaceImplementationError('PulserInterface>get_loaded_asset') return -1
def set_power(self, power=0.): """ Sets the microwave output power. @param float power: the power (in dBm) set for this device @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('MicrowaveInterface>set_power')
def set_frequency(self, freq=0.): """ Sets the frequency of the microwave output. @param float freq: the frequency (in Hz) set for this device @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('MicrowaveInterface>set_frequency')
def ask(self, question): """ Asks the device a 'question' and receive and return an answer from it. a @param string question: string containing the command @return string: the answer of the device to the 'question' in a string """ raise InterfaceImplementationError('PulserInterface>ask') return ''
def tell(self, command): """ Sends a command string to the device. @param string command: string containing the command @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('PulserInterface>tell') return -1
def set_list(self, freq=None, power=None): """ Sets the MW mode to list mode @param list freq: list of frequencies in Hz @param float power: MW power of the frequency list in dBm @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('MicrowaveInterface>set_list')
def set_ex_trigger(self, source, pol): """ Set the external trigger for this device with proper polarization. @param str source: channel name, where external trigger is expected. @param str pol: polarisation of the trigger (basically rising edge or falling edge) @return int: error code (0:OK, -1:error) """ raise InterfaceImplementationError('MicrowaveInterface>trigger')
def get_interleave(self): """ Check whether Interleave is ON or OFF in AWG. @return bool: True: ON, False: OFF Unused for pulse generator hardware other than an AWG. """ raise InterfaceImplementationError('PulserInterface>set_interleave') return -1
def clear_all(self): """ Clears all loaded waveforms from the pulse generators RAM. @return int: error code (0:OK, -1:error) Unused for digital pulse generators without storage capability (PulseBlaster, FPGA). """ raise InterfaceImplementationError('PulserInterface>clear_all') return -1
def get_sample_rate(self): """ Get the sample rate of the pulse generator hardware @return 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. """ raise InterfaceImplementationError('PulserInterface>get_sampling_rate') return -1
def 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. @return list: List of all saved asset name strings in the current directory of the host PC. """ names = [] raise InterfaceImplementationError( 'PulserInterface>get_saved_asset_names') return names
def get_asset_dir_on_device(self): """ Ask for the directory where the hardware conform files are stored on the device. @return str: The current file directory Unused for digital pulse generators without changeable file structure (PulseBlaster, FPGA). """ raise InterfaceImplementationError( 'PulserInterface>get_sequence_directory') return ''
def upload_asset(self, asset_name=None): """ Upload an already hardware conform file to the device. Does NOT load it into channels. @param name: string, name of the ensemble/seqeunce to be uploaded @return int: error code (0:OK, -1:error) If nothing is passed, method will be skipped. """ raise InterfaceImplementationError('PulserInterface>upload_asset') return -1
def set_cw(self, freq=None, power=None, useinterleave=None): """ Sets the MW mode to cw and additionally frequency and power @param float freq: frequency to set in Hz @param float power: power to set in dBm @param bool useinterleave: If this mode exists you can choose it. @return int: error code (0:OK, -1:error) Interleave option is used for arbitrary waveform generator devices. """ raise InterfaceImplementationError('MicrowaveInterface>set_cw')
def get_uploaded_asset_names(self): """ Retrieve the names of all uploaded assets on the device. @return 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). """ names = [] raise InterfaceImplementationError( 'PulserInterface>get_uploaded_assets_names') return names
def set_sample_rate(self, sample_rate): """ Set the sample rate of the pulse generator hardware. @param float sample_rate: The sampling rate to be set (in Hz) @return 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. """ raise InterfaceImplementationError('PulserInterface>set_sampling_rate') return -1.
def set_asset_dir_on_device(self, dir_path): """ Change the directory where the assets are stored on the device. @param str dir_path: The target directory @return int: error code (0:OK, -1:error) Unused for digital pulse generators without changeable file structure (PulseBlaster, FPGA). """ raise InterfaceImplementationError( 'PulserInterface>set_sequence_directory') return -1
def delete_asset(self, asset_name): """ Delete all files associated with an asset with the passed asset_name from the device memory. @param str asset_name: The name of the asset to be deleted Optionally a list of asset names can be passed. @return list: a list with strings of the files which were deleted. Unused for digital pulse generators without sequence storage capability (PulseBlaster, FPGA). """ raise InterfaceImplementationError('PulserInterface>delete_asset') return -1
def set_interleave(self, state=False): """ Turns the interleave of an AWG on or off. @param bool state: The state the interleave should be set to (True: ON, False: OFF) @return 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. """ raise InterfaceImplementationError('PulserInterface>set_interleave') return -1
def get_status(self): """ Retrieves the status of the pulsing hardware @return (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. """ status_dic = dict() status_dic[-1] = 'Failed Request or Failed Communication with device.' status_dic[0] = 'Device has stopped, but can receive commands.' status_dic[1] = 'Device is active and running.' # All the other status messages should have higher integer values # then 1. raise InterfaceImplementationError('PulserInterface>get_status') return (-1, status_dic)
def get_analog_level(self, amplitude=None, offset=None): """ Retrieve the analog amplitude and offset of the provided channels. @param list amplitude: optional, if a specific amplitude value (in Volt peak to peak, i.e. the full amplitude) of a channel is desired. @param list offset: optional, if a specific high value (in Volt) of a channel is desired. @return: (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. 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 no entries provided then the levels of all channels where simply returned. If no analog channels provided, return just an empty dict. Example of a possible input: amplitude = [1,4], offset =[1,3] to obtain the amplitude of channel 1 and 4 and the offset {1: -0.5, 4: 2.0} {} since no high request was performed. The major difference to digital signals is that analog signals are always oscillating or changing signals, otherwise you can use just digital output. In contrast to digital output levels, analog output levels are defined by an amplitude (here total signal span, denoted in Voltage peak to peak) and an offset (a value around which the signal oscillates, denoted by an (absolute) voltage). In general there is no bijective correspondence between (amplitude, offset) and (value high, value low)! """ if amplitude is None: amplitude = [] if offset is None: offset = [] raise InterfaceImplementationError( 'PulserInterface>get_a_ch_amplitude') return -1
def get_digital_level(self, low=None, high=None): """ Retrieve the digital low and high level of the provided channels. @param list low: optional, if a specific low value (in Volt) of a channel is desired. @param list high: optional, if a specific high value (in Volt) of a channel is desired. @return: (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)! """ if low is None: low = [] if high is None: high = [] raise InterfaceImplementationError('PulserInterface>get_a_ch_offset') return -1
def get_active_channels(self, ch=None): """ Get the active channels of the pulse generator hardware. @param list ch: optional, if specific analog or digital channels are needed to be asked without obtaining all the channels. @return dict: where keys denoting the channel number 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 parameters are passed to this method all channels will be asked for their setting. """ if ch is None: ch = [] raise InterfaceImplementationError( 'PulserInterface>get_active_channels') return [-1]