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

    if args==[]:
        config_file = None
        print 'Using default config file'
    else:
        config_file = args[0]

    verbose=opts.verbose
    prog_fpga=opts.prog_fpga

lh=log_handlers.DebugLogHandler()

try:
    print 'Loading configuration file and connecting...'
    seng = medInstrument.sEngine(config_file,lh,program=opts.prog_fpga)

    sConf = seng.config.sengine
    rec_conf = seng.config.receiver.sengine
    f_conf = seng.config.fengine
    s_conf = seng.sConf
    tx_dest_ip = rec_conf.rx_ip
    tx_dest_port = rec_conf.rx_port
    tx_script_name = '/root/medicina/corr_tx_spead.py'
    int_time = 2*f_conf.n_chan * s_conf.int_acc_len * s_conf.acc_len / float(f_conf.adc.clk)

    print '\n======================'
    print 'Initial configuration:'
    print '======================'

    # Set the x-fft shifting schedule (3 stages)
        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)
    s = medInstrument.sEngine(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
    acc_len = s.sConf.int_acc_len
    

    #Parse channel range option
    start_chan, stop_chan = map(int,opts.chan_range.split('_'))
    start_ant, stop_ant = map(int,opts.ant_range.split('_'))
    chan_range = range(Nchans)[start_chan:stop_chan]
    Nchan_range = len(chan_range)
    ant_range = range(Nants)[start_ant:stop_ant]
    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...',
    seng=medInstrument.sEngine(args[0],lh,program=False,passive=True)
    feng=medInstrument.fEngine(args[0],lh,program=False,check_adc=False,passive=True)
    print 'done'

    
    seng.load_eq(verbose=opts.verbose)
    print ''' Issuing static metadata...''',
    sys.stdout.flush()
    seng.spead_static_meta_issue()
    seng.seng_spead_eq_meta_issue()
    print 'SPEAD packet sent.'
    
    print ''' Issuing timing metadata...''',
    sys.stdout.flush()
    seng.spead_dynamic_meta_issue()
    print 'SPEAD packet sent.'