Пример #1
0
        # snap some data
        pylab.figure()
        n_plots = len(corr.fengs)
        for fn, feng in enumerate(corr.fengs):
            adc = feng.snap('snapshot_adc', man_trig=True, format='b')
            pylab.subplot(n_plots, 1, fn)
            pylab.plot(adc)
            pylab.title('ADC values: ROACH %s, ADC %d, (ANT %d, BAND %s)' %
                        (feng.roachhost.host, feng.adc, feng.ant, feng.band))

        # some non-general code to snap from the X-engine
        print 'Snapping data...'
        d = corr.snap_corr()

        print 'Plotting data...'

        pylab.figure()
        pylab.subplot(4, 1, 1)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),helpers.dbs(d['corr00']))
        pylab.plot(helpers.dbs(d['corr00']))
        pylab.subplot(4, 1, 2)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),helpers.dbs(d['corr11']))
        pylab.plot(helpers.dbs(d['corr11']))
        pylab.subplot(4, 1, 3)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),helpers.dbs(np.abs(d['corr01'])))
        pylab.plot(helpers.dbs(np.abs(d['corr01'])))
        pylab.subplot(4, 1, 4)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),np.unwrap(np.angle(d['corr01'])))
        pylab.plot(np.unwrap(np.angle(d['corr01'])))
        pylab.show()
Пример #2
0
        # turn off noise switch so we can sample powers
        feng.noise_switch_enable(False)
        time.sleep(1)
        if load_new:
            print "Computing new coefficients"
            d = np.zeros(vec_width)
            for n in range(opts.samples):
                print '%d: Snapping data from ANT: %d, BAND: %s'%(n,feng.ant,feng.band)
                d += feng.get_spectra()
            # calculate target mean power, scaled for 4 bits
            d /= float(opts.samples)
            mean_power = np.mean(d)
            lowlimit = mean_power / float(opts.cutoff)
            if opts.plot:
                pylab.figure(1)
                pylab.plot(dbs(d),label='ANT %d, BAND %s'%(feng.ant,feng.band))
                pylab.axhline(y=10*np.log10(lowlimit),label='ANT %d, BAND %s limit'%(feng.ant,feng.band), color=pylab.gca().lines[-1].get_color())
                pylab.legend()
                pylab.title("Autocorrelation Passbands")
                pylab.ylabel("Power (db)")
                pylab.xlabel("Decimated Channel Number")

            eq = (np.sqrt(1./d)) * opts.targetpower
            #eq[eq>np.mean(eq)*opts.cutoff] = 0
            eq[d<lowlimit] = 0
            eq = eq[::decimation]
            if opts.plot:
                pylab.figure(2)
                pylab.plot(eq,label='ANT %d, BAND %s'%(feng.ant,feng.band))
                pylab.title("EQ coefficients")
                pylab.ylabel("Amplitude (linear)")
Пример #3
0
    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)

    pylab.ylabel('Power (dB)')
    pylab.legend()
    pylab.show()
Пример #4
0
        for fn,feng in enumerate(corr.fengs):
            adc = feng.snap('snapshot_adc', man_trig=True, format='b')
            pylab.subplot(n_plots,1,fn)
            pylab.plot(adc)
            pylab.title('ADC values: ROACH %s, ADC %d, (ANT %d, BAND %s)'%(feng.roachhost.host,feng.adc,feng.ant,feng.band))

        # some non-general code to snap from the X-engine
        print 'Snapping data...'
        d = corr.snap_corr()

        print 'Plotting data...'

        pylab.figure()
        pylab.subplot(4,1,1)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),helpers.dbs(d['corr00']))
        pylab.plot(helpers.dbs(d['corr00']))
        pylab.subplot(4,1,2)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),helpers.dbs(d['corr11']))
        pylab.plot(helpers.dbs(d['corr11']))
        pylab.subplot(4,1,3)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),helpers.dbs(np.abs(d['corr01'])))
        pylab.plot(helpers.dbs(np.abs(d['corr01'])))
        pylab.subplot(4,1,4)
        #pylab.plot(corr.fengs[0].gen_freq_scale(),np.unwrap(np.angle(d['corr01'])))
        pylab.plot(np.unwrap(np.angle(d['corr01'])))
        pylab.show()




Пример #5
0
    time.sleep(1)

    for feng in corr.fengs:
        print "Computing new coefficients"
        d = np.zeros(vec_width)
        for n in range(opts.samples):
            print '%d: Snapping data from ANT: %d, BAND: %s' % (n, feng.ant,
                                                                feng.band)
            d += feng.get_spectra()
        # calculate target mean power, scaled for 4 bits
        d /= float(opts.samples)
        mean_power = np.mean(d)
        lowlimit = mean_power / float(opts.cutoff)
        if opts.plot and (feng.ant in ants_to_plot):
            pylab.figure(1)
            pylab.plot(dbs(d), label='ANT %d, BAND %s' % (feng.ant, feng.band))
            pylab.axhline(y=10 * np.log10(lowlimit),
                          label='ANT %d, BAND %s limit' %
                          (feng.ant, feng.band),
                          color=pylab.gca().lines[-1].get_color())
            pylab.legend()
            pylab.title("Autocorrelation Passbands")
            pylab.ylabel("Power (db)")
            pylab.xlabel("Decimated Channel Number")

        eq = np.sqrt((1. / d) * opts.targetpower)
        #eq[eq>np.mean(eq)*opts.cutoff] = 0
        eq[d < lowlimit] = 0
        eq = eq[::decimation]
        if feng.ant in zero_ants:
            eq[:] = 0
Пример #6
0
        feng.noise_switch_enable(False)
        time.sleep(1)
        if load_new:
            print "Computing new coefficients"
            d = np.zeros(vec_width)
            for n in range(opts.samples):
                print '%d: Snapping data from ANT: %d, BAND: %s' % (
                    n, feng.ant, feng.band)
                d += feng.get_spectra()
            # calculate target mean power, scaled for 4 bits
            d /= float(opts.samples)
            mean_power = np.mean(d)
            lowlimit = mean_power / float(opts.cutoff)
            if opts.plot:
                pylab.figure(1)
                pylab.plot(dbs(d),
                           label='ANT %d, BAND %s' % (feng.ant, feng.band))
                pylab.axhline(y=10 * np.log10(lowlimit),
                              label='ANT %d, BAND %s limit' %
                              (feng.ant, feng.band),
                              color=pylab.gca().lines[-1].get_color())
                pylab.legend()
                pylab.title("Autocorrelation Passbands")
                pylab.ylabel("Power (db)")
                pylab.xlabel("Decimated Channel Number")

            eq = (np.sqrt(1. / d)) * opts.targetpower
            #eq[eq>np.mean(eq)*opts.cutoff] = 0
            eq[d < lowlimit] = 0
            eq = eq[::decimation]
            if opts.plot:
Пример #7
0
    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)

    pylab.ylabel('Power (dB)')
    pylab.legend()
    pylab.show()