def __init__(self, address):
        self.logger = logging.getLogger()
        self.logger.setLevel(logging.WARNING)

        Instrument.__init__(self, "", tags=['physical'])

        self._address = address
        rm = visa.ResourceManager()
        self._visainstrument = rm.open_resource(self._address)

        self.add_parameter('averages',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=1,
                           maxval=65536)

        self.add_parameter('nop',
                           type=int,
                           flags=Instrument.FLAG_GETSET,
                           minval=2,
                           maxval=65536)

        self._visainstrument.write(":WAV:FORMat WORD")
        self._vsteps = 65536  # the discretization for the WORD format
        self._visainstrument.write(":WAV:UNSIGNED 0")
        self._visainstrument.write(":TIMebase:REFerence LEFT")

        Channel.ALL = [Channel.ONE, Channel.TWO, Channel.THREE, Channel.FOUR]
        self.set_offset(0, *Channel.ALL)
    def __init__(self, address):
        self.logger = logging.getLogger()
        self.logger.setLevel(logging.WARNING)

        Instrument.__init__(self, "", tags=['physical'])

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

        self.set_output_state("ON")

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

        # external triggering parameters
        self.add_parameter('ext_trig_channel',
                           type=bytes,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('InSweep_trg_src',
                           type=bytes,
                           flags=Instrument.FLAG_GETSET)

        self.add_parameter('sweep_trg_src',
                           type=bytes,
                           flags=Instrument.FLAG_GETSET)
示例#3
0
    def __init__(self, address, reset=False, clock=1e9, nop=1000, marker_enob=10):
        '''
        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, "Tektronix_AWG5014", tags=['physical'])


        self._address = address
        self._visainstrument = visa.ResourceManager()\
            .open_resource(self._address, read_termination="\r\n",
                            write_termination="\n")
        self._values = {}
        self._values['files'] = {}
        self._clock = clock
        self._nop = nop
        self._waveforms = [None]*4
        self._amplitudes = [None]*4
        self._markers = [None]*8
        self._clear_all_waveforms()
        self._marker_enob = marker_enob
        self._marker_voltages = [{} for _ in range(8)]
        for i in range(1, 9):
            self.get_marker_voltages(i)
        for i in range(1,5):
            self.get_amplitude(i)
示例#4
0
	def __init__(self, address):
		'''Create a default Keysight AWG instrument'''
		Instrument.__init__(self, 'AWG', tags=['physical'])
		self._address = address
		rm = visa.ResourceManager()
		self._visainstrument = rm.open_resource(self._address)

		self._visainstrument.write(":DIG:TRAN:INT 1")


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

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

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

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

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

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

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

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

		self.add_function("apply_waveform")
    def __init__(self, address, volt_compliance = 3, 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 = -10e-3
        self._maxcurrent =  10e-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")

        self.set_voltage_compliance(volt_compliance)
        self.set_current(0)
        self.set_status(1)
    def __init__(self, address, channel_index = 1):
        '''
        Initializes

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

        self.logger = logging.getLogger()
        self.logger.setLevel(logging.WARNING)

        Instrument.__init__(self, "", tags=['physical'])

        self._address = address
        rm = visa.ResourceManager()
        self._visainstrument = rm.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

        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('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('center', 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('CWfreq', type=float,
            flags=Instrument.FLAG_GETSET,
            minval=300e3, 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=-90, maxval=12,
            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=bytes,
            flags=Instrument.FLAG_GETSET)

        # sets the S21 setting in the PNA X
        self.define_S21() # this two lines is uncommented by Shamil 06/26/2017 due to the fact that
        self.set_S21()  # by using high level measurement child classes it is not possible to continue proper operation
                        # of PNA-L after self._visaintrument.write( "SYST:FPReset" ) command, it seem like without this
                        # lines of code there is no trace selected after self.select_default_trace()
                        # and self.get_all seem do interrupt the program with timeout exception thrown by low-level visa
                        # GPIB drivers. The reason is that PNA-L doesn't have any number of points in sweep (get_all start
                        # by quering number of points in current sweep), because there is no traces defined, hence there
                        # is no number of points available to read
        self.select_default_trace()


        # Implement functions
        self.add_function('get_frequencies')
        self.add_function("get_freqpoints")
        self.add_function('get_tracedata')
        self.add_function('get_sdata')
        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('sweep_single')
        self.add_function("prepare_for_stb")
        self.add_function('wait_for_stb')
        self.add_function('set_electrical_delay')
        self.add_function('get_electrical_delay')
        self.add_function('sweep_hold')
        self.add_function('sweep_continuous')
        self.add_function('autoscale_all')

        #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()
    def __init__(self, address, channel_index=1):
        """
        Initializes

        Input:
            address (string) : VISA address
        """

        Instrument.__init__(self, "EXA", tags=['physical'])

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

        self._visainstrument.timeout = 1000

        # 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=1,
                           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=bytes,
                           flags=Instrument.FLAG_GETSET)

        # sets the S21 setting in the PNA X

        # 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('sweep_single')
        self.add_function("prepare_for_stb")
        self.add_function('wait_for_stb')
        self.add_function('set_electrical_delay')
        self.add_function("setup_list_sweep")
        self.add_function("set_parameters")
        #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()