Beispiel #1
0
    from optparse import OptionParser

    p = OptionParser()
    p.set_usage('%prog [options] [CONFIG_FILE]')
    p.set_description(__doc__)
    p.add_option('-n',
                 '--noise',
                 dest='noise_switch',
                 action='store_true',
                 default=False,
                 help='Use the noise switches. Default = False')

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

    if args == []:
        config_file = None
    else:
        config_file = args[0]

    # construct the correlator object, which will parse the config file and try and connect to
    # the roaches
    # If passive is True, the connections will be made without modifying
    # control software. Otherwise, the connections will be made, the roaches will be programmed and control software will be reset to 0.
    corr = AMI.AmiSbl(config_file=config_file, passive=True, skip_prog=True)
    time.sleep(0.1)

    for feng in corr.fengs:
        feng.noise_switch_enable(opts.noise_switch)
        print feng.host, feng.adc
        print feng.get_adc_power()
        ctrl.connect_sockets()

        # first get some meta data, as this encodes the source name
        # which we will use to name the output file

        while (ctrl.try_recv() is None):
            print "Waiting for meta data"
            time.sleep(1)

        print "Got meta data"
        print "Current status", ctrl.meta_data.obs_status
        print "Current source", ctrl.meta_data.obs_name
        print "Current RA,dec", ctrl.meta_data.ra, ctrl.meta_data.dec
        print "Current nsamp,HA", ctrl.meta_data.nsamp, ctrl.meta_data.ha_reqd

    corr = AMI.AmiSbl(config_file=config_file, passive=True)
    time.sleep(0.1)

    xeng = corr.xengs[0]

    # some initial values for the loop
    cnt=0
    datavec = np.zeros([corr.n_chans*corr.n_bands,corr.n_bls,corr.n_pols,2],dtype=np.int64)
    current_obs = None
    mcnt_old = xeng.read_uint('mcnt_lsb')
    receiver_enable = False
    last_meta_timestamp = time.time()
    # Catch keyboard interrupt and kill signals (which are initiated by amisa over ssh)
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)
    while(True):
Beispiel #3
0
                 default=False,
                 help='Plot adc and spectra values')

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

    if args == []:
        config_file = None
    else:
        config_file = args[0]

    # construct the correlator object, which will parse the config file and try and connect to
    # the roaches
    # If passive is True, the connections will be made without modifying
    # control software. Otherwise, the connections will be made, the roaches will be programmed and control software will be reset to 0.
    corr = AMI.AmiSbl(config_file=config_file,
                      passive=opts.passive,
                      skip_prog=opts.skip_prog)
    time.sleep(0.1)

    COARSE_DELAY = 16 * 10
    if opts.phase_switch == -1:
        #don't override
        corr.set_phase_switches(override=None)
    else:
        corr.set_phase_switches(override=bool(opts.phase_switch))

    corr.all_fengs('set_fft_shift', corr.c_correlator['fft_shift'])
    corr.all_fengs('set_coarse_delay', COARSE_DELAY)

    #corr.fengs[0].set_coarse_delay(COARSE_DELAY)
    #corr.fengs[1].set_coarse_delay(COARSE_DELAY+100)
Beispiel #4
0
                 default=False,
                 help='Plot adc and spectra values')

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

    if args == []:
        config_file = None
    else:
        config_file = args[0]

    # construct the correlator object, which will parse the config file and try and connect to
    # the roaches
    # If passive is True, the connections will be made without modifying
    # control software. Otherwise, the connections will be made, the roaches will be programmed and control software will be reset to 0.
    corr = AMI.AmiSbl(config_file=config_file,
                      verbose=True,
                      passive=opts.skip_prog)
    time.sleep(0.1)

    COARSE_DELAY = 16 * 10
    corr.all_fengs('phase_switch_enable', opts.phase_switch)
    corr.all_fengs('set_fft_shift', corr.c_correlator.getint('fft_shift'))
    corr.all_fengs('set_coarse_delay', COARSE_DELAY)

    #corr.fengs[0].set_coarse_delay(COARSE_DELAY)
    #corr.fengs[1].set_coarse_delay(COARSE_DELAY+100)
    corr.all_fengs('tvg_en', corner_turn=opts.tvg)
    corr.all_xengs('set_acc_len')
    if not opts.skip_arm:
        print "Arming sync generators"
        print "Sending manual sync?", opts.manual_sync