示例#1
0
#import _beamuv as beamuv
import beamuv

o = optparse.OptionParser()
o.set_usage('srcpredict.py -C [calfile] -s [src] [npzfile]')
o.add_option('-b','--beam',dest='beam',default=None,
    help='The beam npz file to use.')
o.add_option('-n','--npz',dest='npz',default=None,
    help='The source data npz file to use.')
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)
示例#2
0
文件: srcpredict.py 项目: nkern/capo
o.add_option('-n',
             '--npz',
             dest='npz',
             default=None,
             help='The source data npz file to use.')
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)
示例#3
0
文件: filter_beam.py 项目: nkern/capo
import aipy as a, numpy as n, pylab as p, sys, os, optparse
from mpl_toolkits.basemap import Basemap
import beamuv

o = optparse.OptionParser()
o.set_description(__doc__)
a.scripting.add_standard_options(o, cmap=True, max=True, drng=True)
o.add_option('--nmodes', dest='nmodes',type='int',default=6,
    help="Number of CLEAN components to use in the smooth reconstruction.")
o.add_option('-s','--size',dest='size',type='int',default=1000,
    help="Size of the uv matrix in pixels.  Default is 1000.")

opts,args = o.parse_args(sys.argv[1:])
center = opts.size/2

_coeffs = beamuv.coeffs_from_file(args[0])
offset = _coeffs.shape[0]/2
_beam = n.zeros((opts.size,opts.size),dtype=n.complex64)
_beam[center-offset:center+offset+1,center-offset:center+offset+1] = _coeffs

_sbeam = _beam.copy()
_sbeam[:,:center-opts.nmodes] = 0.
_sbeam[:,center+opts.nmodes+1:] = 0.
_sbeam[:center-opts.nmodes,:] = 0.
_sbeam[center+opts.nmodes+1:,:] = 0.

beam = n.fft.ifft2(a.img.recenter(_beam,(-center,-center)))*_beam.size
sbeam = n.fft.ifft2(a.img.recenter(_sbeam,(-center,-center)))*_sbeam.size

outnamea,outnameb = args[0].split('_')
outname = outnamea + '_f%s_' % opts.nmodes + outnameb
示例#4
0
#! /usr/bin/env python
import aipy as a, numpy as n, pylab as p, optparse, sys
import beamuv

o = optparse.OptionParser()
o.set_usage("srcpredict.py -C [calfile] -s [src] [npzfile]")
o.add_option("--b1", dest="beam1", default=None, help="The first beam npz file to use.")
o.add_option("--b2", dest="beam2", default=None, help="The second beam npz file to use.")
o.add_option("--n1", 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, 0.150, size=500, pol="y")
beam2 = beamuv.BeamUV(_coeffs2, 0.150, size=500, pol="y")

aa = a.cal.get_aa(opts.cal, n.array([0.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)
示例#5
0
文件: rebeam_test.py 项目: nkern/capo
             dest='beam2',
             default=None,
             help='The second beam npz file to use.')
o.add_option('--n1',
             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']: