Example #1
0
                 default=False,
                 help='Reset stats counters before starting printing')
    p.set_description(__doc__)

    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.AmiDC(config_file=config_file, passive=True, skip_prog=True)
    time.sleep(0.1)

    if opts.reset:
        for xeng in corr.xengs:
            xeng.reset_ctrs()

    stats = {}
    roachhosts = [xeng.roachhost for xeng in corr.xengs]
    packets_per_spectra = corr.xengs[0].n_chans
    print roachhosts
    while (True):
        #for port in range(4):
        #    stats['lb errors'] = corr.do_for_all('read_uint', roachhosts, 'network_stats%s_lb_err_ctr'%port)
        #    #stats['lb packet errs'] = corr.do_for_all('read_uint', corr.xengs, 'network_stats%s_lb_pkt_err_ctr'%port)
        #    #stats['lb order errs'] = corr.do_for_all('read_uint', corr.xengs, 'network_stats%s_lb_order_err_ctr'%port)
Example #2
0
        help='Use this flag to issue a manual sync (useful when no PPS is connected). Default: Do not issue sync')
    p.add_option('-P', '--plot', dest='plot',action='store_true', 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.AmiDC(config_file=config_file, passive=opts.passive, skip_prog=opts.skip_prog)
    time.sleep(0.1)

    COARSE_DELAY = 64
    corr.set_walsh()
    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)
Example #3
0
        '-p',
        '--phs2src',
        dest='phs2src',
        action='store_true',
        default=False,
        help='Phase the data to the source indicated by the ra,dec meta data')

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

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

    # This initiates connections to the ROACHs, which isn't really necessary
    corr = AMI.AmiDC()
    time.sleep(0.1)

    writer = fw.H5Writer(config_file=config_file)
    writer.set_bl_order(corr.bl_order)

    # Set some status counters
    corr.redis_host.set('corr_grab:n_integrations', 0)
    corr.redis_host.set('corr_grab:n_tge_rearms', 0)
    corr.redis_host.set('corr_grab:n_lost_packets', 0)

    # get the mapping from xeng_id, chan_index -> total channel number
    corr_chans = corr.n_chans * corr.n_bands
    chans_per_xeng = corr_chans / corr.n_xengs
    chan_map = np.zeros(corr_chans, dtype=int)
    for xn in range(corr.n_xengs):
Example #4
0
        dest='plot',
        type='string',
        default=None,
        help=
        'Antennas to plot. "all": all antennas plotted, "1,2,3": ants 1,2,3 plotted'
    )

    opts, args = p.parse_args(sys.argv[1:])
    load_new = opts.new
    if args == []:
        config_file = None
    else:
        config_file = args[0]

    # initialise connection to correlator
    corr = AMI.AmiDC(config_file=config_file, passive=True)
    time.sleep(0.1)

    if opts.zero is not None:
        zero_ants = map(int, opts.zero.split(','))
    else:
        zero_ants = []

    # load the existing coefficients
    coeffs = {}
    if not load_new:
        print "trying to load EQ coefficients over redis"
        for feng in corr.fengs:
            keyname = 'ANT%d_%s' % (feng.ant, feng.band)
            c = corr.redis_host.get(keyname)
            if c is None:
if __name__ == '__main__':
    from optparse import OptionParser

    p = OptionParser()
    p.set_usage('%prog [options] [CONFIG_FILE]')
    p.set_description(__doc__)

    opts, args = p.parse_args(sys.argv[1:])
    if args == []:
        config_file = None
    else:
        config_file = args[0]

    # initialise connection to correlator
    corr = AMI.AmiDC(config_file=config_file)
    time.sleep(0.1)

    for feng in corr.fengs:
        feng.noise_switch_enable(False)

    s = corr.do_for_all(
        'get_spectra', corr.fengs
    )  #flush one to give time for the noise switch state to chance
    s = corr.do_for_all('get_spectra', corr.fengs)
    for fn, feng in enumerate(corr.fengs):
        pylab.plot(dbs(s[fn]),
                   label='ANT %d, %s band' % (feng.ant + 1, feng.band))

    for feng in corr.fengs:
        feng.noise_switch_enable(True)
import numpy as np
import corr
import adc5g as adc
import time
import struct
import sys
import pylab
import ami.ami as AMI

ROACH = 'alice'
ADC = 1
SNAP = 'feng_snapshot_adc%d' % ADC

corr = AMI.AmiDC(config_file=None, verbose=True, passive=False)

time.sleep(0.1)

COARSE_DELAY = 0
corr.all_fengs('phase_switch_enable', False)
corr.all_fengs('set_fft_shift', -1)
#corr.all_fengs('set_coarse_delay',COARSE_DELAY)

print "CALIBRATING AGAIN!"
corr.all_fengs('calibrate_adc', verbosity=2)
exit()