Example #1
0
infile  = arg.getstr('in',exist=True)
cols    = arg.getlistint('cols',length=4,min=1)
outfile = arg.getstr('out',exist=False)
scale   = arg.getfloat('scale')
color   = arg.getstr('color')
width   = arg.getint('width')
coord   = arg.getstr('coord',option=['fk5','physical'])
mag     = arg.getstr('mag',option=['p','u'])

from numpy import loadtxt,pi,sin,cos

cols = [a - 1 for a in cols] # make zero-based
data = loadtxt(infile,usecols=cols)

if coord == 'fk5':
   arg.warning("fk5 doesn't work correctly yet!")
   scale = scale/3600.
if mag == 'p':
   data[:,2] = scale*data[:,2]
else:
   data[:,2] = scale

# find coordinates of tail of vector (since ds9 references from tail, not center
angle = pi/180.*data[:,3]
if coord == 'fk5':
   dec = cos(pi/180.*data[:,1])
   data[:,0] = data[:,0] + 0.5*data[:,2]*sin(angle)/dec
else:
   data[:,0] = data[:,0] + 0.5*data[:,2]*sin(angle)
data[:,1] = data[:,1] - 0.5*data[:,2]*cos(angle)