示例#1
0
    def initialise_Roaches(self):
        """ Read the configuration info from the config file, and initialise connections """

        args = sys.argv[1:]
        if args==[]:
            print 'Please specify a configuration file! \nExiting.'
            exit()

        lh=log_handlers.DebugLogHandler()
            
        # Parse the config file and connect to the ROACHs
        print 'Loading configuration file and connecting...',
        self.im = medInstrument.fEngine(args[0],lh,program=False)
        print 'done'
            
        self.Nchans = self.im.config.fengine.n_chan
        self.Nants_real = self.im.config.fengine.n_ants_sp
        self.is_dual_pol = (self.im.config.fengine.pols_per_ant==2)
        self.Nants = self.Nants_real
        self.int_len = self.im.config.xengine.xeng_acc_len

        # Populate listview
        self.fpgaListItems=[]
        self.antListItems=[]
        for fn, fpga in enumerate(self.im.fpgas):
            x = gui.QListWidgetItem()
            x.setText("FPGA %d" %(fn))
            x.fpga_index = fn
            self.fpgaListItems.append(x)
            self.mainWidget.fpgaList.addItem(x)
        for i in range(self.Nants_real):
            x = gui.QListWidgetItem()
            x.setText("Antenna %d" % i)
            x.ant_index = i
            self.antListItems.append(x)
            self.mainWidget.antennaList.addItem(x)
        self.plot_types = ['fft','amp EQ', 'phase EQ', 'quantised (seng)', 'quantised (xeng)']
        self.add_plot_types()
    p.add_option('-r', '--chan_range', dest='chan_range', default='0_-1', 
        help='Use this flag to limit calculation and uploading of coefficients in the channel range <start_chan>_<end_chan>. Default: 0_-1 (use all)')
    p.add_option('-t', '--tolerance', dest='tolerance', type='float', default=0.02, 
        help='Fractional error allowed in the EQ. Default: 0.02')

    opts, args = p.parse_args(sys.argv[1:])

    if args==[]:
        print 'Please specify a configuration file! \nExiting.'
        exit()

lh=log_handlers.DebugLogHandler()

try:
    print ' Connecting...',
    im = medInstrument.fEngine(args[0],lh,program=False)
    print 'done'
    start_t = time.time()

    Nchans = im.fConf.n_chan
    Nants = im.fConf.n_ants_sp
    Npols = im.fConf.pols_per_ant
    

    # Initialise Amp EQ brams
    print ''' Getting Current Amplitude Equalization...'''
    im.eq_init_amp(load_pickle=True)
    #We can now access coefficients via im.eq_amp.coeff['master'][n_ant,n_pol(x:0,y:1),nchan]

    # Set up snap blocks
    print ''' Initialising Snap blocks...'''
        help='Be verbose about errors.')

    opts, args = p.parse_args(sys.argv[1:])

    if args==[]:
        print 'Please specify a configuration file! \nExiting.'
        exit()
    verbose=opts.verbose

lh=log_handlers.DebugLogHandler()

try:
    print 'Loading configuration file and connecting...',
    xeng=medInstrument.xEngine(args[0],lh,program=False)
    print 'done'
    feng=medInstrument.fEngine(args[0],lh,program=False,check_adc=False)

    print 'Loading source observation file...'
    src=xmlParser.xmlObject(args[1]).xmlobj
    print 'done'

    print ''' Issuing static metadata...''',
    sys.stdout.flush()
    xeng.spead_static_meta_issue()
    print 'SPEAD packet sent.'

    print ''' Issuing timing metadata...''',
    sys.stdout.flush()
    xeng.spead_time_meta_issue()
    print 'SPEAD packet sent.'
示例#4
0
    p.set_description(__doc__)
    p.add_option('-v', '--verbose', dest='verbose',action='store_true', default=False, 
        help='Be verbose about errors.')

    opts, args = p.parse_args(sys.argv[1:])

    if args==[]:
        print 'Please specify a configuration file! \nExiting.'
        exit()
    verbose=opts.verbose

lh=log_handlers.DebugLogHandler()

try:
    print 'Loading configuration file and connecting...',
    inst=medInstrument.fEngine(args[0],lh)
    print 'done'

    # SET INITIAL EQUALIZATION LEVELS
    print ''' Setting X-Engine Amplitude Equalization...''',
    inst.eq_set_default_all('xengine','amp',verbose=False)
    time.sleep(0.1)
    sys.stdout.flush()
    print 'done.'

except KeyboardInterrupt:
    exit_clean()
except:
    exit_fail()