Beispiel #1
0
    def performOpen(self, options={}):
        """Perform the operation of opening the instrument connection"""
        # calling the generic VISA open to make sure we have a connection
        VISA_Driver.performOpen(self, options=options)

        degChannels = []
        self.unitFactors = [0. for i in range(8)]
        for i in range(1, 9):
            #Check if channel can be used (left and right limit tripped indicates failure or missing device)
            if int(self.askAndLog(str(i) + "MS").strip()[3].encode("hex"),
                   16) & 0x18 == 0x18:
                continue
            #Check the units
            unit = self.askAndLog(str(i) + "SN?").strip()[3:]
            self.unitFactors[i] = 1.
            if unit == "Dg.":
                degChannels.append("ch" + str(i) + "deg")
            elif unit == "mm":
                degChannels.append("ch" + str(i) + "mm")
                self.unitFactors[i] = .001
            else:
                degChannels.append("ch" + str(i) + "unknown")
            #Set maximum velocity
            vmax = self.askAndLog(str(i) + "VU?")[3:]
            self.writeAndLog(str(i) + "VA" + vmax)
        self.instrCfg.setInstalledOptions(degChannels)
    def performOpen(self, options={}):
        """Perform the operation of opening the instrument connection"""
        # calling the generic VISA open to make sure we have a connection
        VISA_Driver.performOpen(self, options=options)
        # do additional initialization code here...

        #Hacky way to make sure the input buffer is flushed out
        try:
            self.reportProgress(1 / 8)
            _ = self.read(1024)
        except:
            pass

        #Flush everything (hopefully)
        self.writeAndLog('*CLS')
        self.writeAndLog('FLOQ')

        #Step through each channel and query ID
        #Build up a dict of IDN/Channel pairs
        self.ports_dict = {}
        for ix in range(8):
            channel = ix + 1
            idn = self.sim900_module_ask(channel,
                                         '*IDN?',
                                         timeout=0.5,
                                         bCheckError=False)

            if idn not in ['None', 'Timed Out']:
                module_code = idn.split(',')[1]
                self.ports_dict[module_code] = channel
            else:
                module_code = idn

            self.setValue('Slot %d' % channel, module_code)
            self.reportProgress(channel / 8)
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # init meas param dict
     self.dMeasParam = {}
     self.cData=None
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
 def performGetValue(self, quant, options={}):
     """Perform the Get Value instrument operation"""
     # perform special getValue for reading complex value
     name = str(quant.name)
     if name == 'Value':
         # get complex value in one instrument reading
         sCmd = 'SNAP?1,2'
         sAns = self.askAndLog(sCmd).strip()
         lData = sAns.split(',')
         # return complex values
         return complex(float(lData[0].strip()), float(lData[1].strip()))
     elif name == 'R':
         #convert resistance to Kelvin
         R_volt = VISA_Driver.performGetValue(self, quant, options=options)
         Amp = 0.01  # 0.01 V
         R_std = 10e6  # standard resistance in Ohm
         R1 = R_volt / (Amp / R_std)  # R: resistance of thermometer
         if R1 > 3590:
             Temp = 377 * ((1 / (R1 - 1500)) + 8.22e-6)**0.86296
         else:
             Temp = 4031 * ((1 / (R1 - 997.7)) + 4.54e-5)**1.15512
         return Temp
     else:
         # run the generic visa driver case
         return VISA_Driver.performGetValue(self, quant, options=options)
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     
     degChannels = []
     self.unitFactors = [0. for i in range(8)]
     for i in range(1,9):
         #Check if channel can be used (left and right limit tripped indicates failure or missing device)
         if int(self.askAndLog(str(i)+"MS").strip()[3].encode("hex"), 16) & 0x18 == 0x18:
             continue
         #Check the units
         unit = self.askAndLog(str(i)+"SN?").strip()[3:]
         self.unitFactors[i] = 1.
         if unit == "Dg.":
             degChannels.append("ch"+str(i)+"deg")
         elif unit == "mm":
             degChannels.append("ch"+str(i)+"mm")
             self.unitFactors[i] = .001;
         else:
             degChannels.append("ch"+str(i)+"unknown")
         #Set maximum velocity
         vmax = self.askAndLog(str(i)+"VU?")[3:]
         self.writeAndLog(str(i)+"VA"+vmax)
     self.instrCfg.setInstalledOptions(degChannels)
Beispiel #6
0
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     if quant.name in ('Wait for new trace', ):
         # do nothing
         pass
     elif quant.name in ('Marker 1 - Function', ):
         m_idx = int(quant.name[7])
         if self.getValue(quant.name) == 'Band Power':
             self.writeAndLog('CALC:MARK%d:FUNC:BPOW:STAT ON' % m_idx)
         elif self.getValue(quant.name) == 'Noise Density':
             self.writeAndLog('CALC:MARK%d:FUNC:NOIS ON' % m_idx)
         else:
             pass
     elif quant.name in ('RBW', 'VBW', 'Detector', 'Sweep Time',
                         'Input Attenuation'):
         # manual performSetValue operation on certain quantities only if automatic setting is unchecked in the driver
         if not self.getValue(quant.name + ' - Auto'):
             # run standard VISA case
             value = VISA_Driver.performSetValue(self, quant, value,
                                                 sweepRate, options)
         else:
             # if automatic setting is checked, read the value from the instrument and save to local driver
             value = self.setValue(quant.name,
                                   self.readValueFromOther(quant.name))
     else:
         # run standard VISA case
         value = VISA_Driver.performSetValue(self, quant, value, sweepRate,
                                             options)
     return value
Beispiel #7
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     #Reads out the Arduino upon start        
     reply = self.read()
     self.log('Response at startup: ' + reply)
    def performOpen(self, options={}):
        """Perform the operation of opening the instrument connection"""
        # open visa communication
        VISA_Driver.performOpen(self, options)

        # set additional flags
        self.com.set_visa_attribute(VI_ATTR_WR_BUF_OPER_MODE,
                                    VI_FLUSH_ON_ACCESS)
        self.com.set_visa_attribute(VI_ATTR_RD_BUF_OPER_MODE,
                                    VI_FLUSH_ON_ACCESS)

        read_buff_size_bytes = 4096
        write_buff_size_bytes = 4096

        self.com.visalib.set_buffer(self.com.session, VI_READ_BUF,
                                    read_buff_size_bytes)
        self.com.__dict__['read_buff_size'] = read_buff_size_bytes
        self.com.visalib.set_buffer(self.com.session, VI_WRITE_BUF,
                                    write_buff_size_bytes)
        self.com.__dict__['write_buff_size'] = write_buff_size_bytes

        # timeout
        self.timeout_ms = int(1000 * self.dComCfg['Timeout'])
        self.nCh = 2
        self.lWaveUpdated = [False] * self.nCh
        # clear all waveforms
        self.writeAndLog(':TRAC:DEL:ALL')
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function
     should return the actual value set by the instrument."""
     # check quantity name
     if quant.name == 'FrequencyA':
         self.writeAndLog('C0')
         self.writeAndLog('f%f' % (1.e-6 * value))
     elif quant.name == 'PowerA':
         self.writeAndLog('C0')
         self.writeAndLog('W%f' % value)
     elif quant.name == 'OutputA':
         self.writeAndLog('C0')
         self.writeAndLog('r%d' % value)
     elif quant.name == 'FrequencyB':
         self.writeAndLog('C1')
         self.writeAndLog('f%f' % (1.e-6 * value))
     elif quant.name == 'PowerB':
         self.writeAndLog('C1')
         self.writeAndLog('W%f' % value)
     elif quant.name == 'OutputB':
         self.writeAndLog('C1')
         self.writeAndLog('r%d' % value)
     else:
         # otherwise, call standard VISA case
         VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
     return value
Beispiel #10
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # add compatibility with pre-python 3 version of Labber
     if not hasattr(self, 'write_raw'):
         self.write_raw = self.write
     # add compatibility with pre-1.5.4 version of Labber
     if not hasattr(self, 'getTrigChannel'):
         self.getTrigChannel = self._getTrigChannel
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options)
     # check for strange bug by reading the status bit
     try:
         status = self.askAndLog('*STB?', bCheckError=False)
         status = int(status)
     except:
         # if conversion to int failed, re-read instrument buffer to clear
         sBuffer = self.read()
         self.log('Extra data read from Tek: %s, %s' %
                  (str(status), sBuffer))
     # get model name and number of channels
     sModel = self.getModel()
     self.nCh = 4 if sModel in ('5004', '5014') else 2
     # turn off run mode
     self.writeAndLog(':AWGC:STOP;')
     # init vectors with old values
     self.bWaveUpdated = False
     self.nOldSeq = -1
     self.lOldU16 = [[np.array([], dtype=np.uint16) \
                    for n1 in range(self.nCh)] for n2 in range(1)]
     # clear old waveforms
     self.lInUse = [False] * self.nCh
     for n in range(self.nCh):
         self.createWaveformOnTek(n + 1, 0, bOnlyClear=True)
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # add compatibility with pre-Python 3 version of Labber
     if not hasattr(self, 'write_raw'):
         self.write_raw = self.write
     # add compatibility with pre-1.5.4 version of Labber
     if not hasattr(self, 'getTrigChannel'):
         self.getTrigChannel = self._getTrigChannel
     # start by calling the generic VISA open to make sure we have
     # a connection
     VISA_Driver.performOpen(self, options)
     # check for a strange bug by reading the status bit
     try:
         status = self.askAndLog('*STB?', bCheckError=False)
         status = int(status)
     except:
         # if conversion to int failed, re-read instrument buffer to
         # clear
         sBuffer = self.read()
         self.log('Extra data read from Tektronix AWG: %s' % sBuffer)
     # get model name and number of channels
     sModel = self.getModel()
     self.nCh = 4 if sModel in ('5004', '5014') else 2
     # turn off run mode
     self.bIsStopped = False
     self._stop()
     self.writeAndLog('WLIS:WAV:DEL ALL', bCheckError=False)
     self.writeAndLog('SLIS:SUBS:DEL ALL', bCheckError=False)
     self.bFastSeq = False
     self.bSubSeq = False
     self._clear_all()
     for n in range(self.nCh):
         self.createWaveformOnTek(n + 1, 0, bOnlyClear=True)
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     # fix issue with termination for read
     visa.vpp43.set_attribute(self.com.vi, visa.VI_ATTR_SUPPRESS_END_EN, visa.VI_FALSE)
     self.detectedOptions = self.getOptions()
Beispiel #13
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     # fix issue with termination for read
     visa.vpp43.set_attribute(self.com.vi, visa.VI_ATTR_SUPPRESS_END_EN, visa.VI_FALSE)
     
     #Detect options: (vector) magnet and swicth heater
     detectedOptions = []
     rate = self.askAndLog('READ:SYS:VRM:RFMX').strip().rsplit(':',1)[1][1:-1].translate(None,string.letters+"/").split()
     if float(rate[0]) > 0:
         detectedOptions.append("x magnet")
     if float(rate[1]) > 0:
         detectedOptions.append("y magnet")
     if float(rate[2]) > 0:
         detectedOptions.append("z magnet")
     
     heater = self.askAndLog('READ:SYS:VRM:SWHT').strip().rsplit(':',1)[1][1:-1].split()
     if heater[0] != "NOSW" or heater[1] != "NOSW" or heater[2] != "NOSW":
         detectedOptions.append("switch heater")
         
     self.instrCfg.setInstalledOptions(detectedOptions)
     
     # Make sure that the coordinate system matches the device
     coordFunc = self.instrCfg.getQuantity('CoordSys')
     v = self.performGetValue(coordFunc)
     coordFunc.setValue(v)
Beispiel #14
0
 def performGetValue(self, quant, options={}):
     self.log('performGetValue called: ' + quant.name)
     if quant.name.startswith('Measure '):
         #Determine which variables are being measured
         quantDict = {'Measure Current':'CURR', \
                      'Measure Voltage':'VOLT', \
                      'Measure Resistance':'RES'}
         reply = VISA_Driver.askAndLog(self, 'FUNC?')
         if quantDict[quant.name] in reply:
             return True
         else:
             return False
     elif quant.name.endswith('variable'):
         #Have set up format so the read or fetch command always returns values in the following order
         quantDict = {'Voltage variable':0, \
                      'Current variable':1, \
                      'Resistance variable':2}
         #If this is first measurement call, perform read operation and return appropriate values
         if self.isFirstCall(options):
             reply = VISA_Driver.askAndLog(self, 'READ?')
         #otherwise perform fetch operation and return appropriate values
         else:
             reply = VISA_Driver.askAndLog(self, 'FETCH?')
         value = reply.split(',')
         return value[quantDict[quant.name]]
     else:
         return VISA_Driver.performGetValue(self, quant, options)
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options)
     # check for strange bug by reading the status bit
     try:
         status = self.askAndLog('*STB?', bCheckError=False)
         status = int(status)
     except:
         # if conversion to int failed, re-read instrument buffer to clear
         sBuffer = self.read()
         self.log('Extra data read from Tek: %s, %s' % (str(status), sBuffer))
     # get model name and number of channels
     sModel = self.getModel()
     self.nCh = 4 if sModel in ('5004', '5014') else 2
     # turn off run mode
     self.writeAndLog(':AWGC:STOP;')
     # init vectors with old values
     self.bWaveUpdated = False
     self.nOldSeq = -1
     self.lOldU16 = [[np.array([], dtype=np.uint16) \
                    for n1 in range(self.nCh)] for n2 in range(1)]
     # clear old waveforms
     self.lInUse = [False]*self.nCh
     for n in range(self.nCh):
         self.createWaveformOnTek(n+1, 0, bOnlyClear=True)
Beispiel #16
0
    def performOpen(self, options={}):
        """Perform the operation of opening the instrument connection"""
        # calling the generic VISA open to make sure we have a connection
        VISA_Driver.performOpen(self, options=options)

        #Detect options: (vector) magnet and swicth heater
        detectedOptions = []
        rate = self.askAndLog('READ:SYS:VRM:RFMX').strip().rsplit(
            ':', 1)[1][1:-1].translate(None, string.letters + "/").split()
        if float(rate[0]) > 0:
            detectedOptions.append("x magnet")
        if float(rate[1]) > 0:
            detectedOptions.append("y magnet")
        if float(rate[2]) > 0:
            detectedOptions.append("z magnet")

        heater = self.askAndLog('READ:SYS:VRM:SWHT').strip().rsplit(
            ':', 1)[1][1:-1].split()
        if heater[0] != "NOSW" or heater[1] != "NOSW" or heater[2] != "NOSW":
            detectedOptions.append("switch heater")

        self.instrCfg.setInstalledOptions(detectedOptions)

        # Make sure that the coordinate system matches the device
        coordFunc = self.instrCfg.getQuantity('CoordSys')
        v = self.performGetValue(coordFunc)
        coordFunc.setValue(v)
Beispiel #17
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # keep track of sweep state
     self.is_sweeping = False
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     # always get function and range: they are essential for correct resolution and sweeping
     self.readValueFromOther('Function')
Beispiel #18
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     # Check if there really is an IPS120 at the other end of the wire
     if not "IPS120" in self.askAndLog("V"):
         raise InstrumentDriver.CommunicationError("Could not get an identification as IPS120.")
     self.writeAndLog("Q4")
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)    
     self.bSweep1 = self.getValue('Channel 1 Autosweep')
     self.bSweep2 = self.getValue('Channel 2 Autosweep')
     self.bSweep3 = self.getValue('Channel 3 Autosweep')
     self.bSweep4 = self.getValue('Channel 4 Autosweep')
    def performGetValue(self, quant, options={}):
        """Perform the Get Value instrument operation"""
        # check type of quantity
        if quant.name in ('Ch1 - Data', 'Ch2 - Data', 'Ch3 - Data', 'Ch4 - Data'):
            # traces, get channel
            channel = int(quant.name[2])
            # check if channel is on
            if self.getValue('Ch%d - Enabled' % channel):
                # get waveform descriptor data
#                sDesc = self.askAndLog('C%d:WF? DESC;' % channel)
                self.write('C%d:WF? DESC;' % channel, bCheckError=False)
                sDesc = self.read(ignore_termination=True)
                # start by finding byte count, skip 9 bytes after
                indx = sDesc.find('#9')
                sDesc = sDesc[indx+2+9:]
                # strip out relevant info
                iFirst = struct.unpack('>i', sDesc[124:128])[0]
                iLast = struct.unpack('>i', sDesc[128:132])[0]
                Voffs = struct.unpack('>f', sDesc[160:164])[0]
                Vgain = struct.unpack('>f', sDesc[156:160])[0]
                dt = struct.unpack('>f', sDesc[176:180])[0]
                nPts = struct.unpack('>i', sDesc[116:120])[0]
    #            print (iFirst, iLast, Voffs, Vgain, dt, nPts)
                #
                # do a second call to get data, convert to numpy array
                self.write('C%d:WF? DAT1;' % channel, bCheckError=False)
                sData = self.read(ignore_termination=True)
                head = 16
                vData = np.fromstring(sData[(head + iFirst*2):(head + (iLast+1)*2)], 
                                      dtype='>h', count=nPts)
                value = InstrumentQuantity.getTraceDict(vData*Vgain + Voffs, dt=dt)
            else:
                # not enabled, return empty array
                value = InstrumentQuantity.getTraceDict([])
        elif quant.name == 'Trig source':
            # trig source, treat seperately
            sAns = self.askAndLog('TRSE?').strip()
            i1 = sAns.find(',SR,') + 4
            i2 = sAns.find(',HT')
            # convert response to a number
            value = quant.getValueFromCmdString(sAns[i1:i2])
        elif quant.name == 'Trig level':
            # trig options, get local trig source value
            sTrig = self.getCmdStringFromValue('Trig source')
            sAns = self.askAndLog('%s:TRLV?' % sTrig).strip()
            i1 = sAns.find('V')
            value = float(sAns[:i1])
        elif quant.name == 'Trig slope':
            # trig options, get local trig source value
            sTrig = self.getCmdStringFromValue('Trig source')
            # update visa commands
            quant.set_cmd = '%s:TRSL' % sTrig
            # run standard VISA case with updated commands
            value = VISA_Driver.performGetValue(self, quant, options)
        else:
            # for all other cases, call VISA driver
            value = VISA_Driver.performGetValue(self, quant, options)
        return value
Beispiel #21
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     # Check if there really is an IPS120 at the other end of the wire
     if not "IPS120" in self.askAndLog("V"):
         raise InstrumentDriver.CommunicationError(
             "Could not get an identification as IPS120.")
     self.writeAndLog("Q4")
Beispiel #22
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # add compatibility with pre-python 3 version of Labber
     if not hasattr(self, 'write_raw'):
         self.write_raw = self.write
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options)
     # clear value of waveform
     self.setValue('Arb. Waveform', [])
Beispiel #23
0
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     # check if set value and in sweep mode
     if quant.name in ('Voltage', 'Current'):
         # check limits
         (dStep, dMax) = self.getMaxValueAndSmallestStep()
         if abs(value) > dMax:
             # new value out of range, return error
             raise Exception(
                 'New value (%.6g) is out of range (max = %.6g)' %
                 (value, dMax))
         # calculate actual value based on smallest step size
         value = dStep * np.round(value / dStep)
         # check if sweep mode or output off, if not call generic driver
         if sweepRate == 0.0 or (not self.getValue('Output')):
             return VISA_Driver.performSetValue(self,
                                                quant,
                                                value,
                                                0.0,
                                                options=options)
         # sweep mode, do it here
         # get old value to find sweep time and step size
         currValue = self.performGetValue(quant)
         if value == currValue:
             # already at the final value, return
             return value
         # if sweep range is less than two minimal steps, don't sweep
         if abs(value - currValue) < 2.5 * dStep:
             return VISA_Driver.performSetValue(self,
                                                quant,
                                                value,
                                                0.0,
                                                options=options)
         dSweepTime = abs(value - currValue) / sweepRate
         # don't allow sweep times that are shorter than 0.1 s
         dSweepTime = max(dSweepTime, 0.1)
         sSweepTime = '%.1f' % dSweepTime
         sCmd = '*CLS;:PROG:REP 0;' + \
                'SLOP %s;' % sSweepTime + \
                'INT %s;'  % sSweepTime + \
                'EDIT:STAR;' + \
                ':SOUR:LEV %.6E;' % value + \
                ':PROG:EDIT:END;' + \
                ':PROG:RUN'
         self.is_sweeping = True
         VISA_Driver.writeAndLog(self, sCmd)
         # return target value
         return value
     else:
         # for all other quantities, call the generic VISA driver
         return VISA_Driver.performSetValue(self,
                                            quant,
                                            value,
                                            sweepRate,
                                            options=options)
Beispiel #24
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)
     # check if in DC mode
     for n in range(2):
         ch = n + 1
         wfInfor = self.askAndLog(f'SOUR{ch}:APPL?')
         if wfInfor.strip('"').split(',')[0] != 'DC':
             self.writeAndLog(f':SOUR{ch}:APPL:DC 1,1,0')
Beispiel #25
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     try:
        # start by calling the generic VISA open to make sure we have a connection
        VISA_Driver.performOpen(self, options=options)
        
     except Error as e:
         # re-cast errors as a generic communication error
         msg = str(e)
         raise BaseDriver.CommunicationError(msg)
Beispiel #26
0
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function
     should return the actual value set by the instrument."""
     # check quantity name
     if quant.name == 'Frequency':
         self.write('P%08.fZ0K0L3M0N6O3' % (value / 1000.))
     else:
         # otherwise, call standard VISA case
         VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
     return value
 def checkIfSweeping(self, quant, options={}):
     #Can't create quant instances from here, can only pass name of quant
     #Whereas system
     if type(quant) == str:
         name = quant
     else:
         name = quant.name
     if name == 'Source Voltage Level' or name == 'Source Current Level':
         #If sweeping, can't go into program edit mode
         #Can't see any other way of checking if program is running
         VISA_Driver.writeAndLog(self,'*CLS') #Clear any existing errors
         VISA_Driver.writeAndLog(self,'PROG:EDIT:STAR') #force an error if program running
         err = VISA_Driver.askAndLog(self,'SYST:ERR?') #Check if there's a 'program running' error
         #Separate error code and error message
         #error code = 0 -> no errors
         errCode = int(err.split(',')[0])
         if errCode == -284:
             #There is a 'program running' error, so program must be sweeping
             return True
         elif errCode == 103:
             #There is a 'program being edited error' for some reason. Stop editing
             self.log("Program didn't stop properly")
             VISA_Driver.writeAndLog(self,'PROG:EDIT:END')
             return False
         else:
             VISA_Driver.writeAndLog(self,'PROG:EDIT:END')
             return False
     else:
         #Not checking one of the quants that can sweep
         return False
 def performStopSweep(self, quant, options={}):
     # This command is only necessary if in ramp mode
     if quant.name.startswith("Voltage"):
         mode = self.getValue("Voltage Mode")
     elif quant.name.startswith("Current"):
         mode = self.getValue("Voltage Mode")
     else:
         # if it is some other quant, call default function
         VISA_Driver.performStopSweep(self, quant, options)
     if mode == "Ramp":
         VISA_Driver.writeAndLog(self, "ABOR")
Beispiel #29
0
 def performClose(self, bError=False, options={}):
     """Perform the close instrument connection operation"""
     try:
         # try to stop awg before closing communication
         for n in range(self.n_ch):
             self.writeAndLog(':OUTP%d 0' % (n + 1))
         self.stop_awg()
     except:
         pass
     # close VISA connection
     VISA_Driver.performClose(self, bError, options)
Beispiel #30
0
 def performStopSweep(self, quant, options={}):
     #This command is only necessary if in ramp mode
     if quant.name.startswith('Voltage'):
         mode = self.getValue('Voltage Mode')
     elif quant.name.startswith('Current'):
         mode = self.getValue('Voltage Mode')
     else:
         #if it is some other quant, call default function
         VISA_Driver.performStopSweep(self, quant, options)
     if mode == 'Ramp':
         VISA_Driver.writeAndLog(self, 'ABOR')
Beispiel #31
0
 def clearMessages(self):
     #Send version request so message buffer isn't empty
     VISA_Driver.writeAndLog(self,'V')
     #Read message buffer in full, to clear any messages that were not previously cleared
     #(Uncleared messages seem to arise from fact that device seems to be comparatively slow to reply)
     reply = VISA_Driver.read(self,ignore_termination=True)
     self.log("Message buffer read on initialisation: "+reply)
     while not reply.startswith('IPS120'):
         #There was an error or incorrect value, try to clear message buffer again
         reply = VISA_Driver.read(self,ignore_termination=True)
         self.wait(delayTime)
         self.log("Message buffer read again: "+reply)
Beispiel #32
0
 def clearMessages(self):
     #Send version request so message buffer isn't empty
     VISA_Driver.writeAndLog(self, 'V')
     #Read message buffer in full, to clear any messages that were not previously cleared
     #(Uncleared messages seem to arise from fact that device seems to be comparatively slow to reply)
     reply = VISA_Driver.read(self, ignore_termination=True)
     self.log("Message buffer read on initialisation: " + reply)
     while not reply.startswith('IPS120'):
         #There was an error or incorrect value, try to clear message buffer again
         reply = VISA_Driver.read(self, ignore_termination=True)
         self.wait(delayTime)
         self.log("Message buffer read again: " + reply)
    def performOpen(self, options={}):
        """Perform the operation of opening the instrument connection"""
        # calling the generic VISA open to make sure we have a connection
        VISA_Driver.performOpen(self, options=options)

        #This device does not respond to *IDN?, so let's check manually
        id = self.askAndLog("ID")
        if not id in ("7260", "7265"):
            raise InstrumentDriver.CommunicationError(
                "ID query did not return 7260 or 7265. Is this the right driver for the device at the right address?"
            )
            return
Beispiel #34
0
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function
     should return the actual value set by the instrument."""
     # check quantity name
     if quant.name == 'Frequency':
         self.write('FR%011.0fHZ' % value)
     elif quant.name == 'Power':
         self.write('LE%+.1fDM' % value)
     else:
         # otherwise, call standard VISA case
         VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
     return value
    def performOpen(self, options={}):
        """Perform the operation of opening the instrument connection"""
        # calling the generic VISA open to make sure we have a connection
        VISA_Driver.performOpen(self, options=options)

        # This device does not respond to *IDN?, so let's check manually
        id = self.askAndLog("ID")
        if not id in ("7260", "7265"):
            raise InstrumentDriver.CommunicationError(
                "ID query did not return 7260 or 7265. Is this the right driver for the device at the right address?"
            )
            return
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options=options)    
     self.amplitude = 0
     self.phase = 0
     self.IOffset = 0
     self.QOffset = 0
     self.II = 1
     self.IQ = 0
     self.QI = 0
     self.QQ = 1
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # add compatibility with pre-python 3 version of Labber
     if not hasattr(self, 'write_raw'):
         self.write_raw = self.write
     # Call the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options)
     # clear value of waveforms
     self.write('SOUR1:DATA:VOL:CLE')
     self.write('SOUR2:DATA:VOL:CLE')
     self.setValue('Channel 1 Arb. Waveform', [])
     self.setValue('Channel 2 Arb. Waveform', [])
     self.waves = [None] * 2
    def performGetValue(self, quant, options={}):
        """Perform the Get Value instrument operation"""
        if quant.name in ('Frequency'):
            value = VISA_Driver.performGetValue(
                self, quant,
                options) / 1e2  # Return value is pad with 0 in the end.
        elif quant.name in ('Level', 'Output', 'REF_10M', 'REF_1.6G'):
            value = VISA_Driver.performGetValue(
                self, quant, options
            )  # value will be converted according to combo_defs, if there exists.
        else:
            value = quant.getValue()

        return value
Beispiel #39
0
 def performOpen(self, options={}):
     """Perform the operation of opening the instrument connection"""
     # start by calling the generic VISA open to make sure we have a connection
     VISA_Driver.performOpen(self, options)
     # get model name and number of channels
     sModel = self.getModel()
     if sModel == '5208':
         self.nCh = 8
     elif sModel == '5204':
         self.nCh = 4
     elif sModel == '5202':
         self.nCh = 2
     self.nMarker = 4
     self.initSetConfig()
 def performOpen(self, options={}):
     VISA_Driver.performOpen(self, options=options)
     self.data = None
     self.xdisp = 0
     self.xincr = 1
     self.f1 = 0
     self.f2 = 0
     self.I1 = None
     self.Q1 = None
     self.I2 = None
     self.Q2 = None
     self.P1Mean = None
     self.P2Mean = None
     self.psi = None
     self.covar = None
	def performSetValue(self, quant, value, sweepRate=0.0, options={}):
		"""Perform the Set Value instrument operation. This function should return the actual value set by the instrument"""
		if quant.name in ('Range type',):
			if quant.getValueString(value) == 'Zero-span mode':
				# set span to zero
				self.sendValueToOther('Span', 0.0)
				self.sendValueToOther('# of points', 2.0)
				#sweep time should be set to a small value (for example, 10 ms)
				self.writeAndLog(':SWE:TIME 1E-3;')
			else:
                # set lowest possible span to get out of zero-span mode
				if self.getValue('Span') < 10:
					self.sendValueToOther('Span', 1000000)
				if self.getValue('# of points') == 2:
					self.sendValueToOther('# of points', 1001)
				# sweep time should be set to auto
				self.writeAndLog(':SWE:TIME:AUTO 1;')
		elif quant.name in ('Wait for new trace',):
            # turn on continous acquisition if not waiting     
			if value == False:
				self.writeAndLog(':INIT:CONT ON;')
		elif quant.name in ('Trace type CS', 'Trace type CW', 'Measurement Type'):
			pass
		else:
			# run standard VISA case 
			value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
		return value
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     if quant.name in ('Zero-span mode',):
         # set span to zero
         if value == True:
             quantSpan = self.instrCfg.getQuantity('Span')
             self.performSetValue(quantSpan, 0.0)
             quantPts = self.instrCfg.getQuantity('# of points')
             self.performSetValue(quantPts, 2)
             # sweep time should be set to a small value (for example, 10 ms)
             self.writeAndLog(':SWE:TIME:AUTO 0;:SWE:TIME 10E-3;')
         else:
             # set lowest possible span to get out of zero-span mode
             quantSpan = self.instrCfg.getQuantity('Span')
             self.performSetValue(quantSpan, 100.)
             # sweep time should be set to auto
             self.writeAndLog(':SWE:TIME:AUTO 1;')
     elif quant.name in ('Wait for new trace',):
         # turn on continous acquisition if not waiting     
         if value == False:
             self.writeAndLog(':INIT:CONT ON;')
     else:
         # run standard VISA case 
         value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
     return value
    def performSetValue(self, quant, value, sweepRate=0.0, options={}):
        """Perform the Set Value instrument operation. This function should
        return the actual value set by the instrument"""
		# create new channels if needed
        if quant.name in ('S11 - Enabled', 'S21 - Enabled', 'S12 - Enabled',
                          'S22 - Enabled'):
            # get updated list of measurements in use
            param = quant.name[:3]
            self.getActiveMeasurements()
            # clear old measurements for this parameter
            if param in self.dMeasParam:
                for name in self.dMeasParam[param]:
                    self.writeAndLog("CALC:PAR:DEL '%s'" % name)
            # create new measurement, if enabled is true
            if value:
                newName = 'LabC_%s' % param
                self.writeAndLog("CALC:PAR:SDEF '%s','%s'" % (newName, param))
                # show on PNA screen
                iTrace = 1 + ['S11', 'S21', 'S12', 'S22'].index(param)
                self.writeAndLog("DISP:WIND:TRAC%d:FEED '%s'" % (iTrace, newName))
                # add to dict with list of measurements
                self.dMeasParam[param] = [newName]
        elif quant.name in ('Wait for new trace',):
            # do nothing
            pass
        else:
            # run standard VISA case 
            value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
        return value
    def performGetValue(self, quant, options={}):
        """Perform the Get Value instrument operation"""
        # do special case get value for some quantities
        if quant.name == 'I Voltage':
            return self.getVoltage(1)
        elif quant.name == 'Q Voltage':
            return self.getVoltage(2)
        elif quant.name == 'I Autorange':
            return self.getCommand('A', 1)
        elif quant.name == 'Q Autorange':
            return self.getCommand('A', 2)
        elif quant.name == 'I Range':
            return self.getCommand('R', 1)
        elif quant.name == 'Q Range':
            return self.getCommand('R', 2)
        elif quant.name == 'I Offset':
            return self.IOffset
        elif quant.name == 'Q Offset':
            return self.QOffset
        elif quant.name == 'II':
            return self.II
        elif quant.name == 'QQ':
            return self.QQ
        elif quant.name == 'IQ':
            return self.IQ
        elif quant.name == 'QI':
            return self.QI

        
        else:
            # run the generic visa driver case
            return VISA_Driver.performGetValue(self, quant, options=options)
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     
     if quant.name == 'Channel 1 Voltage':
         self.setVoltage(1, value)
     elif quant.name == 'Channel 2 Voltage':
         self.setVoltage(2, value)
     elif quant.name == 'Channel 3 Voltage':
         self.setVoltage(3, value)
     elif quant.name == 'Channel 4 Voltage':
         self.setVoltage(4, value)   
     elif quant.name == 'Channel 1 Autosweep':
         self.bSweep1 = value 
     elif quant.name == 'Channel 2 Autosweep':
         self.bSweep2 = value 
     elif quant.name == 'Channel 3 Autosweep':
         self.bSweep3 = value 
     elif quant.name == 'Channel 4 Autosweep':
         self.bSweep4 = value     
     else:
         # for all other quantities, call the generic VISA driver
         return VISA_Driver.performSetValue(self, quant, value, sweepRate,
                                            options=options)
     return value                         
 def performGetValue(self, quant, options={}):
     """Perform the Get Value instrument operation"""
     # check type of quantity
     if quant.name in ('Ch1 - Data', 'Ch2 - Data', 'Ch3 - Data', 'Ch4 - Data'):
         # traces, get channel
         channel = int(quant.name[2])
         # check if channel is on
         if self.getValue('Ch%d - Enabled' % channel):
             # select channel and set # of bytes to send
             self.write(':DATA:SOU CH%d;:WFMO:BYT_N 2;' % channel, bCheckError=False)
             # query range and offset
             sRange = self.ask(':WFMO:XZE?;:WFMO:XIN?;:WFMO:YMU?;:WFMO:YOF?;:WFMO:YZE?;', bCheckError=False)
             lRange = sRange.split(';')
             (t0, dt, gain, ioffset, offset) = [float(s) for s in lRange]
             # get data as i16, convert to numpy array
             self.write('CURV?', bCheckError=False)
             sData = self.read(ignore_termination=True)
             # strip header to find # of points
             i0 = sData.find('#')
             nDig = int(sData[i0+1])
             nByte = int(sData[i0+2:i0+2+nDig])
             nData = nByte/2
             # get data to numpy array
             vData = np.frombuffer(sData[(i0+2+nDig):(i0+2+nDig+nByte)], 
                                   dtype='>h', count=nData)
             value = InstrumentQuantity.getTraceDict( \
                     gain*(vData - ioffset) + offset, dt=dt)
         else:
             # not enabled, return empty array
             value = InstrumentQuantity.getTraceDict([])
     else:
         # for all other cases, call VISA driver
         value = VISA_Driver.performGetValue(self, quant, options)
     return value
 def performGetValue(self, quant, options={}):
     """Perform the Get Value instrument operation"""
     # perform special getValue for reading complex value
     name = str(quant.name)
     if name == 'Value':
         # get complex value in one instrument reading
         sCmd = 'SNAP?1,2'
         sAns = self.askAndLog(sCmd).strip()
         lData =  sAns.split(',')
         
         #Sometimes, we receive the value twice 
         #(0.12e-3,4.56e-70.12e-3,4.56e-7 instead of 0.12e-3,4.56e-7)
         #This is a simple fix:
         if len(lData) > 2:
             lData =  sAns[:len(sAns)/2].split(',')
         #Also, sometimes we receive an additional "-" at the end of a value
         #(0.12e-3,4.56e-7- instead of 0.12e-3,4.56e-7)
         #Hence, another simple fix:
         if lData[1][-1] == "-":
             lData[1] = ldata[1][:-1]
         
         # return complex values
         return complex(float(lData[0].strip()), float(lData[1].strip()))
     else:
         # run the generic visa driver case
         return VISA_Driver.performGetValue(self, quant, options=options)
Beispiel #48
0
 def performGetValue(self, quant, options={}):
     """Perform the Get Value instrument operation"""
     if (quant.datatype == quant.DOUBLE):
         value = self.askAndLog(quant.set_cmd+"?")
         value = value.replace(" ", "")
         for i,c in enumerate(value):
             if not c in "0123456789.-eE":
                 break
         number=float(value[:i])
         unit=value[i:]
         
         factor = 1
         cfactor = unit[:1]
         if (cfactor == "G"):
             factor = 1e9
         elif (cfactor == "M"):
             factor = 1e6
         elif (cfactor == "k"):
             factor = 1e3
         elif (cfactor == "m"):
             factor = 1e-3
         elif (cfactor == "u"):
             factor = 1e-6
         elif (cfactor == "n"):
             factor = 1e-9
         elif (cfactor == "p"):
             factor = 1e-12
         v = float(number)*factor
         return v
     else:
         value = VISA_Driver.performGetValue(self, quant, options)
         return value
Beispiel #49
0
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     # perform special setValue for delay commands
     name = str(quant.name)
     if name.endswith(('Start time', 'Start reference',
                       'Stop time', 'Stop reference')):
         # get pulse channel in use
         lName =  name.split(' ')
         key = '%s - %s' % (lName[0], lName[2])
         sChannel = '%d' % self.dChCmd[key]
         # get buddy quantity
         if lName[3] == 'time':
             sTime = quant.getCmdStringFromValue(value)
             sRef = self.getCmdStringFromValue('%s - %s reference' % 
                                               (lName[0], lName[2]))
         else:
             sTime = self.getCmdStringFromValue('%s - %s time' %
                                                (lName[0], lName[2]))
             sRef = quant.getCmdStringFromValue(value)
         sCmd = 'DLAY %s,%s,%s' % (sChannel, sRef, sTime)
         self.writeAndLog(sCmd)
         return value
     else:
         # for all other quantities, call the generic VISA driver
         return VISA_Driver.performSetValue(self, quant, value, sweepRate,
                                            options=options)
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     #        if quant.name in ('Zero-span mode',):
     if quant.name in ('Range type', ):
         if quant.getValueString(value) == 'Zero-span mode':
             # set span to zero
             self.sendValueToOther('Span', 0.0)
             self.sendValueToOther('# of points', 2.0)
             # sweep time should be set to a small value (for example, 10 ms)
             self.writeAndLog(':SWE:TIME:AUTO 0;:SWE:TIME 10E-3;')
         else:
             # set lowest possible span to get out of zero-span mode
             self.sendValueToOther('Span', 100.0)
             # sweep time should be set to auto
             self.writeAndLog(':SWE:TIME:AUTO 1;')
     elif quant.name in ('Wait for new trace', ):
         # turn on continous acquisition if not waiting
         if value == False:
             self.writeAndLog(':INIT:CONT ON;')
     else:
         # run standard VISA case
         value = VISA_Driver.performSetValue(self, quant, value, sweepRate,
                                             options)
     return value
Beispiel #51
0
 def performGetValue(self, quant, options={}):
     """Perform the Get Value instrument operation"""
     # perform special getValue for reading complex value
     name = str(quant.name)
     if name == 'Value':
         # get complex value in one instrument reading
         sCmd = 'SNAP?1,2'
         sAns = self.askAndLog(sCmd).strip()
         lData =  sAns.split(',')
         
         #Sometimes, we receive the value twice 
         #(0.12e-3,4.56e-70.12e-3,4.56e-7 instead of 0.12e-3,4.56e-7)
         #This is a simple fix:
         if len(lData) > 2:
             lData =  sAns[:int(len(sAns)/2)].split(',')
         #Also, sometimes we receive an additional "-" at the end of a value
         #(0.12e-3,4.56e-7- instead of 0.12e-3,4.56e-7)
         #Hence, another simple fix:
         if lData[1][-1] == "-":
             lData[1] = ldata[1][:-1]
         
         # return complex values
         return complex(float(lData[0].strip()), float(lData[1].strip()))
     else:
         # run the generic visa driver case
         return VISA_Driver.performGetValue(self, quant, options=options)
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the set value operation"""
     # check type of quantity: There seems to be a problem with some float type commands... (i.e. oscillator frequency) Use the fixed point version instead.
     if quant.name in ("Oscillator Frequency"):
         self.writeAndLog(quant.set_cmd + " " + str(int(value * 1000)))  # Fixed point version uses mHz
     else:
         return VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
     return value
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     # if quant.name == 'blah':
     #    self.dsa. _set(value)
     # else:
     # for all other quantities, call the generic VISA driver
     return VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
 def performOpen(self, options={"values_format":visa.single | visa.big_endian}):
     """Perform the operation of opening the instrument connection"""
     
     try:
         VISA_Driver.performOpen(self, options=options)  # start by calling the generic VISA open to make sure we have a connection
         self.com.values_format=visa.single | visa.big_endian  #this sets this bit order so we can interpret the binary data
         self.writeAndLog("HEADER OFF") #having the header on makes reading data more difficult
         self.writeAndLog("DATA:ENCDG FPBinary") # enable the encoding of bits we can understand (faster data transfer than ASCII)
         self.AvgTrace = {'Time': None,       #This is a local dictionary to avoid taking a sweep twice unnecessarily
                          'Amplitude': None,
                          'RollAvg Time': None,
                          'RollAvg Amplitude': None} 
         self.numRep=self.getValue("Number of shifts")
     except Error as e:
         # re-cast errors as a generic communication error
         msg = str(e)
         raise InstrumentDriver.CommunicationError(msg)
Beispiel #55
0
 def performOpen(self, options={}):
     """ Perform the operation of opening the instrument connection """
     # self.writeAndLog('*CLS')
     VISA_Driver.performOpen(self, options=options)
     self.writeAndLog("*CLS")
     self.writeAndLog("OUTX0")  # set output to GPIB
     self.writeAndLog("PDST 3")  # set Print/Plot/Dump destination to GPIB
     self.writeAndLog("DISP 2, 1")  # set displays live
     self.writeAndLog("DFMT 1")  # set displays to dual display
     self.writeAndLog("ACTD 0")  # set active display to displayA
     self.writeAndLog("RPMF 0")  # set Hz as frequency units (not RPM)
     self.writeAndLog("A1RG 1")  # Autoranges Channel 1
     self.writeAndLog("A2RG 1")  # Autoranges Channel 2
     self.writeAndLog("I1AR 1")  # Autotracks Channel 1
     self.writeAndLog("I2AR 1")  # Autotracks Channel 2
     self.writeAndLog("ASCL 0")  # Autoscales Display 0
     self.writeAndLog("ASCL 1")  # Autoscales Display 1
     self.writeAndLog("STRT")  # Starts measurement
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     if quant.name == 'Number of shifts':  
         self.numRep= value
     else:
         # for all other quantities, call the generic VISA driver
         value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options=options)
     return value
 def performSetValue(self, quant, value, sweepRate=0.0, options={}):
     """Perform the Set Value instrument operation. This function should
     return the actual value set by the instrument"""
     # update visa commands for triggers
     if quant.name in ('S11 - Enabled', 'S21 - Enabled', 'S12 - Enabled',
                       'S22 - Enabled'):
         if self.getModel() in ('E5071C',):
             # new trace handling, use trace numbers, set all at once
             lParam = ['S11', 'S21', 'S12', 'S22']
             dParamValue = dict()
             for param in lParam:
                 dParamValue[param] = self.getValue('%s - Enabled' % param)
             dParamValue[quant.name[:3]] = value
             # add parameters, if enabled
             self.dMeasParam = dict()
             for (param, enabled) in dParamValue.items():
                 if enabled:
                     nParam = len(self.dMeasParam)+1
                     self.writeAndLog(":CALC:PAR%d:DEF %s" %
                                      (nParam, param))
                     self.dMeasParam[param] = nParam
             # set number of visible traces
             self.writeAndLog(":CALC:PAR:COUN %d" % len(self.dMeasParam))
         else:
             # get updated list of measurements in use
             self.getActiveMeasurements()
             param = quant.name[:3]
             # old-type handling of traces
             if param in self.dMeasParam:
                 # clear old measurements for this parameter
                 for name in self.dMeasParam[param]:
                     self.writeAndLog("CALC:PAR:DEL '%s'" % name)
             # create new measurement, if enabled is true
             if value:
                 newName = 'LabC_%s' % param
                 self.writeAndLog("CALC:PAR:EXT '%s','%s'" % (newName, param))
                 # show on PNA screen
                 iTrace = 1 + ['S11', 'S21', 'S12', 'S22'].index(param)
 #                sPrev = self.askAndLog('DISP:WIND:CAT?')
 #                if sPrev.find('EMPTY')>0:
 #                    # no previous traces
 #                    iTrace = 1
 #                else:
 #                    # previous traces, add new
 #                    lTrace = sPrev[1:-1].split(',')
 #                    iTrace = int(lTrace[-1]) + 1
                 self.writeAndLog("DISP:WIND:TRAC%d:FEED '%s'" % (iTrace, newName))
                 # add to dict with list of measurements
                 self.dMeasParam[param] = [newName]
     elif quant.name in ('Wait for new trace',):
         # do nothing
         pass
     else:
         # run standard VISA case 
         value = VISA_Driver.performSetValue(self, quant, value, sweepRate, options)
     return value