def upload_waveforms(self, sequence_names, sequence_channels, sequence_items, reload=True): channel_numbers = [ch[0] for ch in sequence_channels] if not all([ch in self._channel_numbers for ch in channel_numbers]): raise AwgCommonError( "Invalid channel numbers {}".format(channel_numbers)) wave_number = 0 delay = self.retrieve_setting('delay') cycles = self.retrieve_setting('cycles') prescaler = self.retrieve_setting('prescaler') auto_trigger = self.retrieve_setting('auto_trigger') wave_shape = self.retrieve_setting('wave_shape') amplitude = self.retrieve_setting('amplitude') offset = self.retrieve_setting('offset') for (channel_number, sequence) in zip(channel_numbers, sequence_items): wave_object = Keysight_M3201A.new_waveform_from_double( 0, np.array(sequence)) self.__awg.load_waveform(wave_object, wave_number) self.__awg.set('wave_shape_channel_%d' % channel_number, wave_shape) self.__awg.set('amplitude_channel_%d' % channel_number, amplitude) self.__awg.set('offset_channel_%d' % channel_number, offset) self.__awg.awg_queue_waveform(channel_number, wave_number, auto_trigger, delay, cycles, prescaler) wave_number += 1
def __init__(self, awg, awg_number=0): """ Implements the common functionality of the AwgCommon for the Zurich Instruments HDAWG8 to be controlled by the virtual AWG. Note: Channels are zero based so channel '0' is output '1' on the physical device. Note: This backend is setup to work with grouping 1x8 where one awg controls 8 outputs. Args: awg (ZIHDAWG8): Instance of the QCoDeS ZIHDAWG8 driver. awg_number (int): The number of the AWG that is to be controlled. The ZI HDAWG8 has 4 AWGs and the default one is the first one (index 0). """ super().__init__('ZIHDAWG8', channel_numbers=list(range(0, 8)), marker_numbers=list(range(0, 8))) if type(awg).__name__ is not self._awg_name: raise AwgCommonError('The AWG does not correspond with {}'.format( self._awg_name)) self.__awg = awg self.__awg_number = awg_number self.__settings = { 'sampling_rate': Parameter(name='sampling_rate', unit='GS/s', set_cmd=self.update_sampling_rate, get_cmd=self.retrieve_sampling_rate) }
def disable_outputs(self, channels=None): if not channels: channels = self._channel_numbers if not all([ch in self._channel_numbers for ch in channels]): raise AwgCommonError("Invalid channel numbers {}".format(channels)) name = self.__device_name [self.__daq.setInt("/{0}/sigouts/{1}/on".format(name, ch-1), 0) for ch in channels]
def disable_outputs(self, channels=None): if not channels: channels = self._channel_numbers if not all([ch in self._channel_numbers for ch in channels]): raise AwgCommonError("Invalid channel numbers {}".format(channels)) bit_mask = self.retrieve_setting('enabled_outputs') for channel in channels: bit_mask = bit_mask ^ 0b1 << (channel - 1) self.change_setting('enabled_outputs', bit_mask)
def __init__(self, awg): super().__init__('ZI_HDAWG8', channel_numbers=list(range(1, 9)), marker_numbers=list(range(1, 9))) if type(awg).__name__ is not self._awg_name: raise AwgCommonError('The AWG does not correspond with {}'.format(self._awg_name)) self.__device_name = awg._dev.device self.__awg_module = awg._dev.awgModule self.__daq = awg._dev.daq self.__awg = awg
def _set_sequence(self, channels, sequence): if not sequence or len(sequence) != len(channels): raise AwgCommonError('Invalid sequence and channel count!') if not all(len(idx) == len(sequence[0]) for idx in sequence): raise AwgCommonError('Invalid sequence list lengthts!') request_rows = len(sequence[0]) current_rows = self.__get_sequence_length() if request_rows != current_rows: self.__set_sequence_length(request_rows) for row_index in range(request_rows): for channel in self._channel_numbers: if channel in channels: ch_index = channels.index(channel) wave_name = sequence[ch_index][row_index] self.__awg.set_sqel_waveform(wave_name, channel, row_index + 1) else: self.__awg.set_sqel_waveform("", channel, row_index + 1) self.__awg.set_sqel_goto_state(request_rows, 1)
def __init__(self, awg): super().__init__('Keysight_M3201A', channel_numbers=[1, 2, 3, 4], marker_numbers=[1]) if not Keysight_M3201A: raise AwgCommonError('The Keysight SD drivers can not be found!') if type(awg).__name__ is not self._awg_name: raise AwgCommonError('The AWG does not correspond with {}'.format(self._awg_name)) self.__settings = [Parameter(name='enabled_outputs', initial_value=0b0000, set_cmd=None), Parameter(name='amplitude', unit='Volt', initial_value=1.0, vals=Numbers(0.0, 1.5), set_cmd=None), Parameter(name='offset', unit='seconds', initial_value=0.0, vals=Numbers(0.0, 2.0), set_cmd=None), Parameter(name='wave_shape', initial_value=6, set_cmd=None), Parameter(name='delay', unit='seconds', initial_value=0, vals=Numbers(0, 10), set_cmd=None), Parameter(name='auto_trigger', unit='', initial_value=0, set_cmd=None), Parameter(name='cycles', initial_value=0, set_cmd=None), Parameter(name='prescaler', initial_value=10, set_cmd=None)] self.__awg = awg
def retrieve_gain(self) -> float: """ Gets the amplitude for all the output channels. Returns: The amplitude for all output channels. Raises: AwgCommonError: If not all channel amplitudes have the same value. Then the settings in the AWG are off and needs to be reset first. """ gains = [self.__awg.get(f'ch{ch}_amp') for ch in self._channel_numbers] if not all([g == gains[0] for g in gains]): raise AwgCommonError('Not all channel amplitudes are equal. Please reset!') return gains[0]
def __init__(self, awg): super().__init__('Tektronix_AWG5014', channel_numbers=[1, 2, 3, 4], marker_numbers=[1, 2]) if type(awg).__name__ is not self._awg_name: raise AwgCommonError('The AWG does not correspond with {}'.format(self._awg_name)) self.__settings = [Parameter(name='sampling_rate', unit='GS/s', initial_value=1.0e9, vals=Numbers(1.0e7, 1.2e9), set_cmd=None), Parameter(name='marker_delay', unit='ns', initial_value=0.0, vals=Numbers(0.0, 1.0), set_cmd=None), Parameter(name='marker_low', unit='V', initial_value=0.0, vals=Numbers(-1.0, 2.6), set_cmd=None), Parameter(name='marker_high', unit='V', initial_value=1.0, vals=Numbers(-0.9, 2.7), set_cmd=None), Parameter(name='amplitudes', unit='V', initial_value=1.0, vals=Numbers(0.02, 4.5), set_cmd=None), Parameter(name='offset', unit='V', initial_value=0, vals=Numbers(-2.25, 2.25), set_cmd=None)] self._waveform_data = None self.__awg = awg
def disable_outputs(self, channels=None): if channels is None: channels = self._channel_numbers if not all([ch in self._channel_numbers for ch in channels]): raise AwgCommonError("Invalid channel numbers {}".format(channels)) _ = [self.__awg.disable_channel(ch) for ch in channels]
def enable_outputs(self, channels=None): if channels is None: channels = self._channel_numbers if not all([ch in self._channel_numbers for ch in channels]): raise AwgCommonError(f"Invalid channel numbers {channels}") _ = [self.__awg.enable_channel(ch) for ch in channels]
def update_running_mode(self, mode): modes = ['CONT', 'SEQ'] if mode not in modes: raise AwgCommonError('Invalid AWG mode ({})'.format(mode)) self.__awg.set('run_mode', mode)
def disable_outputs(self, channels=None): if not channels: channels = self._channel_numbers if not all([ch in self._channel_numbers for ch in channels]): raise AwgCommonError("Invalid channel numbers {}".format(channels)) [self.__awg.set('ch{}_state'.format(ch), 0) for ch in channels]