Source
print 'Fld=',ifld,'Spw=',ispw,'(B='+str(bandnames[ispw])+', PA offset='+str(bandpa(bandnames[ispw])*180/pi+paoffset)+'deg)','Gx/Gy=',R[ispw,ifld],'Q=',Q[ispw,ifld],'U=',U[ispw,ifld],'P=',P,'X=',X
#!/usr/bin/env python
#
# almapolhelpers.py
#
# History:
# v1.0 (gmoellen; 2013Oct02) initial distributed version
# v1.1 (gmoellen; 2015Sep16,25) fixed spw name resolution, B7 pos ang
#
# This script defines several functions useful for ALMA Polarization processing.
#
# To access these functions, type (at the CASA prompt):
#
# from recipes.almapolhelpers import *
#
# enable local tools (tb)
import taskinit
import os
from math import pi,floor,atan2,sin,cos,sqrt
import pylab as pl
import glob as glob
from recipes.almahelpers import tsysspwmap
def bandname(spwname):
# spwname can be an ALMA name, or a string containing a digit
if spwname.isdigit():
return spwname # just return what was specified
# Attempt resolution according to ALMA conventions
lo=spwname.find('ALMA_RB_')
if lo>-1:
lo+=8 # 2-digit band name starts 8 chars later
return spwname[lo:].split("#")[0]
else:
print "Can't discern an ALMA bandname from: "+str(spwname)
return spwname
def bandpa(name):
# From rhills (CSV-481, 2012Sep04)
# B7 corrected according to CSV-2778 (2015Sep25)
# B1: [ 135.0, 225.0]
# B2: [ 45.0, 135.0]
# B3: [-10.0, 80.0]
# B4: [-170.0, -80.0]
# B5: [-45.0, 45.0]
# B6: [-135.0, -45.0]
# B7: [-53.55,36.45] {old: [-52.5, 37.5] ( +37.5 from radial)}
# B8: [ 0.0, 90.0]
# B9: [-180.0, -90.0]
# B10: [ 90.0, 180.0]
bparad=pl.array([0.0,135.,45.,-10.,-170.,-45.,-135.,-53.55,0.,-180.,90.])*pi/180.0 # in rad
iband=0
if (type(name)==type(1)):
iband=name
else:
# process as a stringspecified string
bn=bandname(str(name))
if (bn.isdigit()):
iband=int(bn)
else: