Exemplo n.º 1
0
 def open_devices(self):
     self.uni = None
     self.multimeter = None
     self.syn = None
     self.flukemeter = None
     if self.devices.use_unidex:
         try:
             self.uni = Unidex11()
             self.uni.reset()
             time.sleep(2.0)
             self.uni.home(axis='X')
             time.sleep(10.0)
             logger.info("Unidex 11 available, reset and homed")
         except:
             logger.error("Unidex11 Not available")
             raise BeamPatternGeneralError("open_devices",
                                           "Unidex11 Not available")
     if self.devices.use_vna:
         try:
             self.an = Analyzer_8510c()
             logger.info("HP8510C vector network analyzer initialized")
             time.sleep(0.5)
             self.freq_list = numpy.array(self.vna.freq) * 1e9
             print self.freq_list
             meas = self.vna.meas
             avg_value = self.vna.avg_value
             self.an.initialize_vna(self.freq_list,
                                    measure=meas,
                                    avg_value=avg_value)
         except:
             logger.error("VNA not available")
             raise BeamPatternGeneralError("open_devices",
                                           "VNA not available")
Exemplo n.º 2
0
 def open_devices(self):
     self.prologix = PrologixGPIB()
     self.vv = None
     self.syn = HP83620A(self.prologix)
     logger.info("Synthesizer initialized")
     self.freq_list = numpy.array(self.synthesizer.freq)*1.e9
     print self.freq_list
     if self.devices.use_unidex:
         try:
             self.uni = Unidex11(self.prologix)
             self.uni.reset()
             time.sleep(2.0)
             self.uni.home(axis='X')
             time.sleep(10.0)
             logger.info("Unidex 11 available, reset and homed")
         except:
             logger.error("Unidex11 Not available")
             raise BeamPatternGeneralError("open_devices", "Unidex11 Not available")
     if self.devices.use_vv:
         try:
             self.vv = VectorVoltmeter(self.prologix)
             logger.info("Vector voltmeter initialized")
             self.average = self.vector_voltmeter.avg_value
             time.sleep(0.5)
         except:
             logger.error("Vector Voltmeter not available")
             raise BeamPatternGeneralError("open_devices", "Vector Voltmeter not available")
Exemplo n.º 3
0
 def take_readings(self, nrdgs=2):
     if self.devices.use_multi:
         try:
             vmean, vstd = self.multimeter.take_readings(nrdgs=nrdgs)
             return vmean, vstd
         except:
             raise BeamPatternGeneralError("take_readings",
                                           "Cannot read HP voltmeter")
     else:
         try:
             vmean, vstd = self.flukemeter.measure(nrdgs=nrdgs)
             return vmean, vstd
         except:
             raise BeamPatternGeneralError("take_readings",
                                           "Cannot read Fluke voltmeter")
Exemplo n.º 4
0
 def take_readings(self):
     if self.devices.use_vv:
         try:
             data = self.vv.measure_transmission_single(average=self.average)
             return data
         except:
             raise BeamPatternGeneralError("take_readings", "Cannot read Vector Voltmeter")
Exemplo n.º 5
0
 def _get_configuration(self):
     if self.cfgfile and os.path.exists(self.cfgfile):
         config = Configuration(self.cfgfile)
         return config.cfg
     else:
         raise BeamPatternGeneralError(
             'get_configuration',
             "Could not parse configuration from config file")
Exemplo n.º 6
0
 def take_readings(self):
     if self.devices.use_vna:
         try:
             data = self.an.get_freq_data()
             return data
         except:
             raise BeamPatternGeneralError("take_readings",
                                           "Cannot read VNA")
Exemplo n.º 7
0
 def _get_cfg_file(self):
     fp = open(self.filename, 'r')
     first = fp.readline()
     match = re.match('# Beammap Timestamp: (?P<datetime_str>\w+)', first)
     if match:
         self.datetime_str = match.groupdict()['datetime_str']
     second = fp.readline().strip()
     match = re.match('# Configfile: (?P<cfgfile>\w+\.\w+)', second)
     if match:
         self.cfgfile = match.groupdict()['cfgfile']
     else:
         raise BeamPatternGeneralError(
             'get_cfg_file', "Could not parse config file from input file")
     three = fp.readline().strip()
Exemplo n.º 8
0
 def measure(self, nrdgs=2):
     rdg = numpy.zeros(nrdgs, dtype='float')
     for i in range(nrdgs):
         self.write('QM')
         meas = self.read()
         #print meas
         args = meas.split(',')
         if len(args) != 4:
             raise BeamPatternGeneralError("fluke", "Error in measurement")
         else:
             val, unit, state, attribute = args
             val = float(val)
             rdg[i] = val
             logger.debug("Voltage read: %.5f" % val)
     return rdg.mean(), rdg.std()
Exemplo n.º 9
0
    def __init__(self, cfg, filename, datetime_str, cfgfile, debug=True):
        self.plot_symbols = [
            'o', 's', 'v', '^', '<', '>', '1', '2', '3', '4', 'p', '*', 'h',
            'H', '+', 'x', 'D', 'd'
        ]

        self.debug = debug
        self.cfg = cfg
        self._get_config_parameters()
        self.filename = filename
        self.datetime_str = datetime_str
        self.cfgfile = cfgfile
        self.offset = 0.0
        self.offset_std = 0.0
        self.nrdgs = 1
        if not self.check_map_azimuth_parameters():
            logger.error("Map Parameters Malformed")
            raise BeamPatternGeneralError("AzimuthMap",
                                          "Map Parameters Malformed")
Exemplo n.º 10
0
 def __init__(self, cfg, filename, datetime_str, cfgfile,
              digital=False):
     self.plot_symbols = ['o', 's', 'v', '^', '<', '>',
                          '1', '2', '3', '4', 'p', '*',
                          'h', 'H', '+', 'x', 'D', 'd', '|', '_'] * 5 # lots of symbols
     self.cfg = cfg
     self._get_config_parameters()
     self.filename = filename
     self.datetime_str = datetime_str
     self.cfgfile = cfgfile
     self.freq_list = []
     self.offset = 0.0
     self.offset_std = 0.0
     self.nrdgs = 1
     if not self.check_map_azimuth_parameters():
         logger.error("Map Parameters Malformed")
         raise BeamPatternGeneralError("AzimuthMap", "Map Parameters Malformed")
     self.digital = digital
     if self.digital:
         self.labjack = LabJackT7()
Exemplo n.º 11
0
    def open_devices(self):
        self.uni = None
        self.multimeter = None
        self.syn = None
        self.flukemeter = None
        if self.devices.use_unidex:
            try:
                self.uni = Unidex11()
                time.sleep(2.0)
                self.uni.reset()
                time.sleep(2.0)
                self.uni.home(axis='Y')
                time.sleep(10.0)
                self.uni.home(axis='X')
                time.sleep(10.0)
                logger.info("Unidex 11 available, reset and homed")
            except:
                logger.error("Unidex11 Not available")
                raise BeamPatternGeneralError("open_devices",
                                              "Unidex11 Not available")
        if self.devices.use_multi:
            try:
                self.multimeter = Multimeter()
                #if self.multimeter.idstr != 'HP3457A':
                #    logger.error("Multimeter ID not right")
                #    raise BeamPatternGeneralError("open_devices", "Multimeter ID not right")
                logger.info("HP3478A multimeter initialized")
                time.sleep(0.5)
                self.multimeter.setup_ac(nplc=self.multi.nplc,
                                         range=self.multi.range,
                                         nrdgs=self.multi.nrdgs,
                                         resolution=self.multi.resolution)
                self.nrdgs = self.multi.nrdgs
                print self.nrdgs, self.multi.nplc, self.multi.range, self.multi.nrdgs, self.multi.resolution
            except:
                logger.error("Multimeter not available")
                raise BeamPatternGeneralError("open_devices",
                                              "Multimeter not available")

        if self.devices.use_synth:
            try:
                self.syn = HP83620A()
                self.syn.set_mult(self.synth.mult)
                time.sleep(0.2)
                logger.info("HP83620A synthesizer pulse mod setup")
                self.syn.setup_pulse()
                logger.info("HP83620A synthesizer available and online")
            except:
                logger.error("HP83620A not available")
                raise BeamPatternGeneralError("open_devices",
                                              "HP83620A not available")

        if self.devices.use_fluke:
            try:
                self.flukemeter = Fluke()
                logger.info("Fluke is online")
                time.sleep(0.5)
                self.nrdgs = self.fluke.nrdgs
            except:
                logger.error("Fluke 287 is not available. Error: %s" %
                             sys.exc_info())
                raise BeamPatternGeneralError("open_devices",
                                              "Fluke 287 not available")
        if self.debug:
            print "Opened devices"