def __call__(self, band = None):
     if band:
         self.f0 = 1e9 * min (band)
         self.f1 = 1e9 * max (band)
         VI.__call__(self, self.visa, CONFIGURE, self.f0, self.f1)
     VI.__call__(self, self.visa, MEASURE, self.f0, self.f1)
     return self.Fetch ()
 def __init__(self,
              band=None, #[Hz]
              ref=None,  #(dBm)
              bw=None,   #(Hz)
              shape=None,#(?)
              noise=None,#[dBm/Hz,Hz]
              gain=None, #[dB,Hz]
              gpib=20):  #GPIB address
     VI.__init__(self, ANALYZER,
                 ['band (Hz)',
                  'reference (dBm)',
                  'resolution (Hz)',
                  'variable shape (F)',
                  'noise (dBm/Hz,Hz)',
                  'gain (dB,Hz)',
                  'VISA session',
                  'error in (no error)'],
                 ['signal & noise (dB vs Hz)',
                  'peaks (dB,Hz)',
                  'significance (dB)',
                  'resolution out (Hz)',
                  'VISA session out',
                  'error out'])
     self.visa = ('GPIB0::%d::INSTR' % gpib, 0)
     self.error = (False, 0, "")
     self.band=self.ref=self.bw=self.shape=None
     self.noise=self['noise (dBm/Hz,Hz)']
     self.gain=self['gain (dB,Hz)']
     self (band, ref, bw, noise, gain, shape) # configure the instrument
 def __call__(self, frequency, power=None):
     """
     Set frequency (GHz) and output power (0dBm).
     """
     if power != None: self.power = power
     self.session = VI.__call__(self, frequency != None, frequency, self.power, * self.session)
     return frequency
 def __init__(self, frequency=None, power=None, gpib=11):
     """
     Open a session with the device (GPIB address)
     """
     VI.__init__(self,
         GENERATOR,
         ['RF on',
          'frequency (Hz)',
          'power (dBm)',
          'VISA session',
          'error in (no error)'],
         ['VISA session out',
          'error out'])
     self.session = (('GPIB0::%d::INSTR' % gpib, 0), None)
     self.power = None
     self (frequency, power)
 def __call__(self, band=None, ref=None, bw=None, shape=None, noise=None, gain=None):
     band = self.band = _default (band, self.band)
     ref = self.ref = _default (ref, self.ref)
     bw = self.bw = _default (bw, self.bw)
     noise = self.noise = _default (noise, self.noise)
     gain = self.gain = _default (gain, self.gain)
     shape = self.shape = _default (shape, self.shape)
     (signal, noise), peaks, margins, bw, self.visa, self.error = VI.__call__(self,
         band, ref, bw, shape, noise, gain, self.visa, self.error)
     return (signal, noise, peaks, margins, bw)
 def __init__(self,
              band = LB + HB, # GHz
              gpib=20): # GPIB address
     VI.__init__(self, PATH, [VISA, MODE, F0, F1], [P])
     self.visa = ('GPIB0::%d::INSTR' % gpib, 0)
     self (band)