Exemplo n.º 1
0
    def __init__(self, address, current_compliance=.001):
        '''Create a default Yokogawa_GS210 object as a current source'''
        Instrument.__init__(self, 'Yokogawa_GS210', tags=['physical'])
        self._address = address
        rm = visa.ResourceManager()
        self._visainstrument = rm.open_resource(self._address)

        current_range = (-200e-3, 200e-3)
        voltage_range = (-32, 32)

        self._mincurrent = -120e-3
        self._maxcurrent = 120e-3

        self._minvoltage = -1e-6
        self._maxvoltage = 1e-6

        self.add_parameter('current',
                           flags=Instrument.FLAG_GETSET,
                           units='A',
                           type=float,
                           minval=current_range[0],
                           maxval=current_range[1])

        self.add_parameter('current_compliance',
                           flags=Instrument.FLAG_GETSET,
                           units='V',
                           type=float,
                           minval=current_range[0],
                           maxval=current_range[1])

        self.add_parameter('voltage',
                           flags=Instrument.FLAG_GETSET,
                           units='V',
                           type=float,
                           minval=voltage_range[0],
                           maxval=voltage_range[1])

        self.add_parameter('voltage_compliance',
                           flags=Instrument.FLAG_GETSET,
                           units='V',
                           type=float,
                           minval=voltage_range[0],
                           maxval=voltage_range[1])

        self.add_parameter('status',
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           type=int)

        self.add_parameter('range',
                           flags=Instrument.FLAG_GETSET,
                           units='',
                           type=float)

        self.add_function("get_id")

        self.add_function("clear")
        self.add_function("set_src_mode_volt")

        self._visainstrument.write(":SOUR:FUNC CURR")
Exemplo n.º 2
0
 def __init__(self, name):
     logging.info(__name__ + ' : Initializing instrument Spectrum')
     Instrument.__init__(self, name, tags=['physical'])
     self._card_is_open = False
     self.software_nums_multi = 1
     self.software_averages = 1
     self._load_dll()
     self._open()
     self.nums = self.get_nums()
     self.set_timeout(10000)
Exemplo n.º 3
0
    def __init__(self, name, address):
        logging.info(__name__ + ' : Initializing instrument nn_rf_switch')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self.num_channels = 2

        self.add_parameter('switch',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=6,
                           channels=(1, 2),
                           channel_prefix='ch%d_')

        for channel in range(1, self.num_channels + 1):
            self.do_get_switch(channel=channel)
Exemplo n.º 4
0
    def __init__(self, name, address, reset=False):
        '''
		Initializes the Agilent_E8257D, and communicates with the wrapper.

		Input:
		  name (string)	   : name of the instrument
		  address (string) : GPIB address
		  reset (bool)	   : resets to default values, default=False
		'''
        logging.info(__name__ + ' : Initializing instrument Agilent_E8257D')
        Instrument.__init__(self, name, tags=['physical'])

        # Add some global constants
        self._address = address
        self._visainstrument = visa.ResourceManager().open_resource(
            self._address)

        self.add_parameter('power',
                           flags=Instrument.FLAG_GETSET,
                           units='dBm',
                           minval=-20,
                           maxval=18,
                           type=float)
        self.add_parameter('phase',
                           flags=Instrument.FLAG_GETSET,
                           units='rad',
                           minval=-numpy.inf,
                           maxval=numpy.inf,
                           type=float)
        self.add_parameter('frequency',
                           flags=Instrument.FLAG_GETSET,
                           units='Hz',
                           minval=1e5,
                           maxval=20e9,
                           type=float)
        self.add_parameter('status', flags=Instrument.FLAG_GETSET, type=bool)

        self.add_function('reset')
        self.add_function('get_all')

        if (reset):
            self.reset()
        else:
            self.get_all()
Exemplo n.º 5
0
 def __init__(self, name, chassis, slot_in):
     logging.info(__name__ + ' : Initializing instrument Spectrum')
     Instrument.__init__(self, name, tags=['physical'])
     self.moduleIn = keysightSD1.SD_AIN()
     self.moduleInID = self.moduleIn.openWithSlot("M3102A", chassis,
                                                  slot_in)
     self.mask = 0
     self.trigger_delay = 0
     self.software_nums_multi = 1
     self.software_averages = 1
     self.nop = 256
     self.nums = 1
     self.trigger = keysightSD1.SD_TriggerModes.EXTTRIG
     self.moduleIn.triggerIOconfig(1)
     self.timeout = 10000
     self.impedances = [0] * 5
     self.couplings = [0] * 5
     self.fullscale = [0.0625] * 5
     for ch in range(4):
         self.set_channelinputconfig(ch + 1)
Exemplo n.º 6
0
	def __init__(self, name, serial):
		'''
		Initializes the Labbrick, and communicates with the wrapper.

		Input:
		  name (string)    : name of the instrument
		  serial (int)  : serial number
		'''
		logging.info(__name__ + ' : Initializing instrument Labbrick')
		Instrument.__init__(self, name, tags=['physical'])
		
		devices = get_labbricks()
		for device_id, device in devices.items():
			if device['serial_number'] == serial:
				self._device_id = device_id
				self._device_name = device['name']
				
		if not hasattr(self, '_device_id'):
			raise ValueError('Labbrick with serial number {0} not found'.format(serial))
			
		_labbrick.set_test_mode(False)
		_labbrick.init_device(self._device_id)
		
		# Add some global constants
		self._serial_number = serial

		self.add_parameter('power',
			flags=Instrument.FLAG_GETSET, units='dBm', minval=4*_labbrick.get_min_pwr(self._device_id), \
			maxval=4*_labbrick.get_max_pwr(self._device_id), type=float)
		self.add_parameter('frequency',
			flags=Instrument.FLAG_GETSET, units='Hz', minval=_labbrick.get_min_freq(self._device_id)*10, \
			maxval=_labbrick.get_max_freq(self._device_id)*10, type=float)
		self.add_parameter('status',
			flags=Instrument.FLAG_GETSET, type=bool)

		self.add_function ('get_all')
		self.get_all()
Exemplo n.º 7
0
    def __init__(self, name, address, channel_index=1):
        '''
		Initializes 

		Input:
			name (string)    : name of the instrument
			address (string) : GPIB address
		'''

        logging.info(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.ResourceManager().open_resource(
            self._address)  # no term_chars for GPIB!!!!!
        self._visainstrument.timeout = 400000
        self._zerospan = False
        self._freqpoints = 0
        self._ci = channel_index
        self._start = 0
        self._stop = 0
        self._nop = 0

        # Implement parameters

        self.add_parameter('nop',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=100000,
                           tags=['sweep'])

        self.add_parameter('bandwidth',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=1e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('bandwidth_video',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=1e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('video_bw',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=1e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('res_bw',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=1e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('averages',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=1024,
                           tags=['sweep'])

        self.add_parameter('average', type=bool, flags=Instrument.FLAG_GETSET)

        self.add_parameter('centerfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('startfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('stopfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('span',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('zerospan', type=bool, flags=Instrument.FLAG_GETSET)

        self.add_parameter('channel_index',
                           type=int,
                           flags=Instrument.FLAG_GETSET)

        #Triggering Stuff
        self.add_parameter('trigger_source',
                           type=str,
                           flags=Instrument.FLAG_GETSET)

        # Implement functions
        self.add_function('get_freqpoints')
        self.add_function('get_tracedata')
        self.add_function('init')
        self.add_function('set_xlim')
        self.add_function('get_xlim')
        self.add_function('get_sweep_time')
        self.add_function('set_sweep_time')
        self.add_function('set_sweep_time_auto')
        self.add_function('get_sweep_time_auto')
        #self.add_function('avg_clear')
        #self.add_function('avg_status')

        #self._oldspan = self.get_span()
        #self._oldnop = self.get_nop()
        #if self._oldspan==0.002:
        #  self.set_zerospan(True)

        self.get_all()
Exemplo n.º 8
0
    def __init__(self, name, address, channel_index=1):
        '''
        Initializes

        Input:
            name (string)	: name of the instrument
            address (string) : GPIB address
        '''

        logging.info(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.ResourceManager().open_resource(
            self._address)  # no term_chars for GPIB!!!!!

        self._zerospan = False
        self._freqpoints = 0
        self._ci = channel_index
        self._start = 0
        self._stop = 0
        self._nop = 0

        # Implement parameters
        #Sweep
        self.add_parameter('sweep_mode',
                           type=str,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('nop',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=100000,
                           tags=['sweep'])
        ###########
        self.add_parameter('bandwidth',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=1e9,
                           units='Hz',
                           tags=['sweep'])
        #Averaging
        self.add_parameter('average_mode',
                           type=str,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('averages',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=1024,
                           tags=['sweep'])

        self.add_parameter('average', type=bool, flags=Instrument.FLAG_GETSET)
        ##########

        self.add_parameter('frequency',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('centerfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('startfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('stopfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('span',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=0,
                           maxval=20e9,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('power',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=-95,
                           maxval=30,
                           units='dBm',
                           tags=['sweep'])

        self.add_parameter('zerospan', type=bool, flags=Instrument.FLAG_GETSET)

        self.add_parameter('channel_index',
                           type=int,
                           flags=Instrument.FLAG_GETSET)

        #Triggering Stuff
        self.add_parameter('trigger_source',
                           type=str,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('timeout', type=int, flags=Instrument.FLAG_GETSET)

        self.add_parameter('status', type=bool, flags=Instrument.FLAG_GETSET)

        # sets the S21 setting in the PNA X
        #Do it in your script please!!
        #self.define_S21()
        #self.set_S21()

        # Implement functions
        self.add_function('get_freqpoints')
        self.add_function('get_tracedata')
        self.add_function('get_data')
        self.add_function('init')
        #self.add_function('set_S21')
        self.add_function('set_xlim')
        self.add_function('get_xlim')
        self.add_function('get_sweep_time')
        self.add_function('ask')
        self.add_function('write')
        #self.add_function('set_trigger_source')
        #self.add_function('get_trigger_source')
        #self.add_function('avg_clear')
        #self.add_function('avg_status')

        #self._oldspan = self.get_span()
        #self._oldnop = self.get_nop()
        #if self._oldspan==0.002:
        #  self.set_zerospan(True)

        self.clear()
        self.select_measurement(1)

        self.get_all()
Exemplo n.º 9
0
    def __init__(self, name, serial):
        '''
		Initializes 

		Input:
			name (string)    : name of the instrument
			serial (int) : serial number
		'''
        logging.info(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])
        self._device = _signal_hound.open_device_by_serial_number(
            serial_number=serial)
        #self._device = f(serial_number=serial)

        self._serial = serial

        # Implement parameters

        self.add_parameter('ref',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           minval=-80,
                           maxval=_signal_hound.max_ref,
                           units='dBm',
                           tags=['sweep'])

        self.add_parameter('reject_if',
                           type=bool,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           tags=['sweep'])

        self.add_parameter('nop',
                           type=int,
                           flags=Instrument.FLAG_GET,
                           tags=['sweep'])

        self.add_parameter('video_bw',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           minval=_signal_hound.min_rbw,
                           maxval=_signal_hound.max_rbw,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('res_bw',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           minval=_signal_hound.min_rbw,
                           maxval=_signal_hound.max_rbw,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('centerfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=_signal_hound.sa124_min_freq,
                           maxval=_signal_hound.sa124_max_freq,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('startfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=_signal_hound.sa124_min_freq,
                           maxval=_signal_hound.sa124_max_freq,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('stopfreq',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=_signal_hound.sa124_min_freq,
                           maxval=_signal_hound.sa124_max_freq,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('span',
                           type=float,
                           flags=Instrument.FLAG_GETSET,
                           minval=_signal_hound.min_span,
                           maxval=_signal_hound.sa124_max_freq,
                           units='Hz',
                           tags=['sweep'])

        self.add_parameter('averages',
                           type=int,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           minval=1,
                           maxval=1024,
                           tags=['sweep'])

        #		self.add_parameter('zerospan', type=bool,
        #			flags=Instrument.FLAG_GETSET)

        #Triggering Stuff
        #		self.add_parameter('trigger_source', type=str,
        #			flags=Instrument.FLAG_GETSET)

        # Implement functions
        self.add_function('get_freqpoints')
        self.add_function('get_tracedata')
        self.add_function('set_xlim')
        self.add_function('get_xlim')
        #self.add_function('avg_clear')
        #self.add_function('avg_status')

        #self._oldspan = self.get_span()
        #self._oldnop = self.get_nop()
        #if self._oldspan==0.002:
        #  self.set_zerospan(True)

        self.set_xlim(_signal_hound.sa124_min_freq,
                      _signal_hound.sa124_max_freq)
        self.set_res_bw(_signal_hound.max_rbw)
        self.set_video_bw(_signal_hound.max_rbw)
        self.set_reject_if(True)
        self.set_averages(1)
        _signal_hound.initiate(self._device, _signal_hound.sweeping, 0)

        self.get_all()
Exemplo n.º 10
0
    def __init__(self, name, address, reset=False, clock=1e9, nop=1000):
        '''
		Initializes the AWG520.

		Input:
			name (string)    : name of the instrument
			address (string) : GPIB address
			reset (bool)     : resets to default values, default=false
			nop (int)  : sets the number of datapoints

		Output:
			None
		'''
        logging.debug(__name__ + ' : Initializing instrument')
        Instrument.__init__(self, name, tags=['physical'])

        self._address = address
        self._visainstrument = visa.ResourceManager().open_resource(
            self._address)
        self._visainstrument.timeout = 5000
        self._values = {}
        self._values['files'] = {}
        self._clock = clock
        self._nop = nop
        self._waveforms = [None] * 4
        self._markers = [None] * 8
        self.check_cached = False
        self.invert_marker = [False] * 8

        # Add parameters
        self.add_parameter('waveform',
                           type=list,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           channel_prefix='ch%d_')
        self.add_parameter(
            'digital',
            type=list,
            flags=Instrument.FLAG_GETSET | Instrument.FLAG_GET_AFTER_SET,
            channels=(1, 8),
            channel_prefix='ch%d_'
        )  # marker 1 ch 1-4 are in 1-4, m2 ch 1-4 are in 5-8
        self.add_parameter('output',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           channel_prefix='ch%d_')
        self.add_parameter('trigger_mode',
                           type=str,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET)
        self.add_parameter('trigger_impedance',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           minval=49,
                           maxval=2e3,
                           units='Ohm')
        self.add_parameter('trigger_level',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           minval=-5,
                           maxval=5,
                           units='Volts')
        self.add_parameter('clock',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           minval=1e6,
                           maxval=1e9,
                           units='Hz')
        self.add_parameter('nop',
                           type=int,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           minval=100,
                           maxval=1e9,
                           units='Int')
        self.add_parameter('amplitude',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           minval=0,
                           maxval=2,
                           units='Volts',
                           channel_prefix='ch%d_')
        self.add_parameter('offset',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           minval=-2.25,
                           maxval=2.25,
                           units='Volts',
                           channel_prefix='ch%d_')
        self.add_parameter('marker1_low',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           minval=-2,
                           maxval=2.5,
                           units='Volts',
                           channel_prefix='ch%d_')
        self.add_parameter('marker1_high',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           minval=-2,
                           maxval=2.5,
                           units='Volts',
                           channel_prefix='ch%d_')
        self.add_parameter('marker2_low',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           minval=-2,
                           maxval=2.5,
                           units='Volts',
                           channel_prefix='ch%d_')
        self.add_parameter('marker2_high',
                           type=float,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           minval=-2,
                           maxval=2.5,
                           units='Volts',
                           channel_prefix='ch%d_')
        self.add_parameter('status',
                           type=bool,
                           flags=Instrument.FLAG_GETSET
                           | Instrument.FLAG_GET_AFTER_SET,
                           channels=(1, 4),
                           channel_prefix='ch%d_')

        # Add functions
        self.add_function('reset')
        self.add_function('get_all')
        self.add_function('clear_waveforms')
        self.add_function('set_trigger_impedance_1e3')
        self.add_function('set_trigger_impedance_50')

        # Make Load/Delete Waveform functions for each channel
        for ch in range(1, 5):
            self._add_load_waveform_func(ch)
            self._add_del_loaded_waveform_func(ch)

        if reset:
            self.reset()
        else:
            self.get_all()
Exemplo n.º 11
0
    def __init__(self,
                 name,
                 address=0,
                 ver=0,
                 use_internal_trigger=True,
                 mode='master'):
        from qsweepy.config import get_config
        import numbers
        #qtlab stuff
        Instrument.__init__(self, name, tags=['measure'])
        # Opening ftd2xx connection (USB-COM dongle)

        if not isinstance(address, numbers.Integral):
            address = ftd2xx.listDevices().index(address)
        print('opening device')
        self.h = ftd2xx.open(address)
        print('device open')

        # QTLab stuff
        self.add_parameter('repetition_period',
                           type=float,
                           flags=Instrument.FLAG_SET | Instrument.FLAG_SOFTGET,
                           minval=2e-9)

        self.add_function('LoadRAM')
        self.add_function('Send2CPU')
        self.add_function('ProgLimit')
        self.add_function('RamAddrCtrl')
        self.add_function('SetDAC8')
        self.add_function('InitDAC8')
        self.add_function('ProgAutoTrigger')
        self.add_function('ProgTimer')
        self.add_function('ProgRepeater')
        self.add_function('LoadPWL')
        self.add_function('intToBytes')
        #self.add_function('SetDAC16Gain')
        self.add_function('SetDAC16zero')
        self.add_function('SetDAC16')
        self.add_function('ProgPulse')
        self.add_function('SetPulseAmplitude')
        self.add_function('SendControlWord')
        self.add_function('InitPulseDacs')
        self.add_function('SendPacket')

        self.add_function('set_trigger_repeats')
        self.add_function('get_trigger_repeats')
        self.add_function('set_trigger_period')
        self.add_function('get_trigger_period')
        self.add_function('set_repetition_period')
        self.add_function('get_repetition_period')
        self.add_function('set_trigger_amplitude')
        self.add_function('get_trigger_amplitude')
        self.add_function('set_trigger_pulse')
        self.add_function('get_trigger_pulse')
        self.add_function('set_waveform')
        self.add_function('get_waveform')
        self.add_function('create_delayed_trigger_pulse')
        self.add_function('get_max_value')
        self.add_function('get_min_value')
        self.add_function('get_sample_period')
        self.add_function('get_sample_dtype')
        self.add_function('get_max_sample_size')

        # default driver settings
        channel_settings = {
            channel_id: {
                'on': True,  # turn on channel power
                'mode':
                'ram',  # AWG mode: 'ram' - predefined point, 'PWL' - piecewise linear
                'filter':
                False,  # turno/off 10 MHz filter (only available for channel 0)
                'offset':
                0,  # slow hardware offset (only available for channel 0)
                'sw_offset': 0,  #software offset
                'signed': True,  # 0 for -8192 to 8191, 1 for 0 to 16383
                'continuous_run':
                False,  # enables repetition inside a single AWG pulse sequence for this channel
                'reset_enable':
                False,  # enables repetition rate inside a single AWG pulse sequence 
                # for this channel different from 32768 pulse points
                'clock_phase': 0,  # clock phase inverter (1 ns shift)
                'delta_ram': 0,  # points per clock period
                'slow': 0,  # 2e-9 s clock period per data point
                'ram_pulse_length':
                32768,  # repetition rate inside a single AWG pulse sequence if 'continuous run' and 'reset enable' is on
                'delay': 0  # some strange delay 
            }
            for channel_id in range(7)
        }
        self.pulses = {channel_id: [] for channel_id in range(7)}
        self.channel_settings = channel_settings
        self.use_internal_trigger = use_internal_trigger
        # turning on AWG channels (control word)
        self.ver = ver
        if ver == 2:
            self.h.setBitMode(0xff, 0x40)
            self.h.setUSBParameters(0x10000, 0x10000)
            self.h.setLatencyTimer(2)
            self.h.setFlowControl(FT_FLOW_RTS_CTS, 0, 0)
            is_programmed = self.IsVirtexProgrammed()
            print('Virtex is programmed? ', is_programmed)
            if not is_programmed:
                if mode == 'master':
                    self.ProgVirtex6(
                        filename=get_config()['AWG500_default_firmware'])
                else:
                    self.ProgVirtex6(
                        filename=get_config()['AWG500_slave_firmware'])

        self.send_control_word()
        # setting a single trigger per AWG repeat
        self.set_trigger_repeats(1)
        self.set_trigger_period(0)
        self.set_repetition_period(self.get_max_sample_size() * 2e-9)
        # setting trigger amplitudes for PLS channels
        #self.trigger_amplitudes = {'PLS5':0xfff0, 'PLS2':0xfff0, 'PLS1':0xfff0}
        self.trigger_amplitudes = {
            'PLS5': 0x0000,
            'PLS2': 0x0000,
            'PLS1': 0x0000
        }
        for channel_name, amplitude in zip(self.trigger_amplitudes.keys(),
                                           self.trigger_amplitudes.values()):
            self.set_trigger_amplitude(channel_name, amplitude)
        # setting trigger pulse form. This is sick shit and it doesn't work as expected.
        # see documentation for explanation how it should work in principle.
        #default_trigger_pulse = [0, 4]
        default_trigger_pulse = self.create_delayed_trigger_pulse(0)
        self.trigger_pulses = {
            channel_name: default_trigger_pulse
            for channel_name in ['SYNC0']
        }  #, 'PLS1', 'PLS2', 'SYNC3', 'SYNC4', 'PLS5']}
        for channel_name, pulse in zip(self.trigger_pulses.keys(),
                                       self.trigger_pulses.values()):
            self.set_trigger_pulse(channel_name, pulse)
        # setting default AWG channel settings
        for channel_id, settings in zip(self.channel_settings.keys(),
                                        self.channel_settings.values()):
            self.set_channel_settings(channel_id, settings)