Пример #1
0
o.add_option('-f',
             '--flux',
             dest='flux',
             type='float',
             default=None,
             help='Manually set the flux of beam track to this value.')
a.scripting.add_standard_options(o, cal=True, src=True)

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

_coeffs = beamuv.coeffs_from_file(opts.beam)

print _coeffs.shape

k = opts.src
beam = beamuv.BeamUV(_coeffs, .150, size=1000., pol='y')
aa = a.cal.get_aa(opts.cal, n.array([.150]))
srclist, cutoff, catalogs = a.scripting.parse_srcs(k, opts.cat)
cat = a.cal.get_catalog(opts.cal, srclist)
cat.compute(aa)

for file in args:
    npz = n.load(file)
    alt, az, times = [], [], []
    for t in npz['times']:
        aa.set_jultime(t)
        times.append(aa.sidereal_time())
        cat[k].compute(aa)
        alt.append(cat[k].alt)
        az.append(cat[k].az)
    alt = n.array(alt)
Пример #2
0
             dest='npz1',
             default=None,
             help='The first source data npz file to use.')
o.add_option('--n2',
             dest='npz2',
             default=None,
             help='The second source data npz file to use.')
a.scripting.add_standard_options(o, cal=True, src=True)

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

_coeffs1 = beamuv.coeffs_from_file(opts.beam1)
_coeffs2 = beamuv.coeffs_from_file(opts.beam2)

k = opts.src
beam1 = beamuv.BeamUV(_coeffs1, .150, size=500, pol='y')
beam2 = beamuv.BeamUV(_coeffs2, .150, size=500, pol='y')

aa = a.cal.get_aa(opts.cal, n.array([.150]))
srclist, cutoff, catalogs = a.scripting.parse_srcs(k, opts.cat)
cat = a.cal.get_catalog(opts.cal, srclist)
cat.compute(aa)

for file in args:
    npz = n.load(file)
    alt, az, times = [], [], []
    for t in npz['times']:
        aa.set_jultime(t)
        times.append(aa.sidereal_time())
        cat[k].compute(aa)
        alt.append(cat[k].alt)
Пример #3
0
             default=None,
             help='The beam file to use (can be npz or fits).')

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

afreqs = n.load(args[0])['afreqs']
srctimes, srcfluxes, x, y, z = C.jcp.read_srcnpz(args, verbose=True)
for src in srcfluxes:
    srcfluxes[src] = n.mean(srcfluxes[src], axis=1)

srcs = srctimes.keys()

if opts.beam.endswith('npz'):
    import beamuv
    _coeffs = beamuv.coeffs_from_file(opts.beam)
    beam = beamuv.BeamUV(_coeffs, .150, size=1000)
    response = lambda x, y, z: beam.response(x, y, z)**2
else:
    h = a.map.Map(fromfits=opts.beam)
    h.set_interpol(True)
    #h.set_interpol(False)
    response = lambda x, y, z: h[x, y, z]

newflux = {}

for k in srcs:
    beamtrack = response(x[k], y[k], z[k])
    newflux[k] = n.abs(n.sum(beamtrack * srcfluxes[k]) / n.sum(beamtrack**2))
    if not opts.outfile:
        import pylab as p
        p.semilogy(srctimes[k], beamtrack * newflux[k])
Пример #4
0
             help='The beam to use.')
a.scripting.add_standard_options(o, cal=True, src=True)

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

srcs = [f.split('.s__')[0] for f in args]
srcstring = ''
for src in srcs:
    srcstring += src + ','
srcstring = srcstring.rstrip(',')

afreqs = n.load(args[0])['afreqs']
_coeffs = beamuv.coeffs_from_file(opts.beam)
fluxcal = opts.fluxcal

beam = beamuv.BeamUV(_coeffs, .150, size=500, pol='y')
aa = a.cal.get_aa(opts.cal, afreqs)
srclist, cutoff, catalogs = a.scripting.parse_srcs(srcstring, opts.cat)
cat = a.cal.get_catalog(opts.cal, srclist)
cat.compute(aa)

srctimes, srctrack = {}, {}
beamtrack, newflux = {}, {}
x, y, z, = {}, {}, {}
scale = 1.

for k, npz in zip(srcs, args):
    try:
        f = n.load(npz)
    except:
        print 'Load file failed.'