from taskinit import casalog, metool, qa, smtool, tbtool
from simutil import simutil
def plotcomp(compdict, showplot=True, wantdict=False, symb=',',
include0amp=False, include0bl=False, blunit='', bl0flux=0.0):
{'clist': component list,
'shape': component shape dict, including direction.
'freqs (GHz)': pl.array of frequencies,
'antennalist': An array configuration file as used by simdata,
'savedfig': False or, if specified, the filename to save the plot to,
'standard': setjy fluxstandard type},
and symb: One of matplotlib's codes for plot symbols: .:,o^v<>s+xDd234hH|_
default: ',': The smallest points I could find,
make a plot of visibility amplitude vs. baseline length for clist at epoch.
If antennalist is not found as is, it will look for antennalist in
os.getenv('CASAPATH').split(' ')[0] + '/data/alma/simmos/'.
showplot: Whether or not to show the plot on screen.
If wantdict is True, it returns a dictionary with the amplitudes and
baselines on success. Otherwise, it returns True or False as its estimated
include0amp: Force the lower limit of the amplitude axis to 0.
include0bl: Force the lower limit of the baseline length axis to 0.
blunit: unit of the baseline length (='' used the unit in the data or klambda)
bl0flux: Zero baseline flux
Returns an appropriate failure value.
Note that mydict.update(plotcomp(wantdict=True, ...)) would give a
confusing error message if plotcomp returned False.
clist = compdict['clist']
objname = compdict['objname']
epoch = compdict['epoch']
epstr = mepoch_to_str(epoch)
antennalist = compdict['antennalist']
print "compdict['antennalist'] must be set!"
print "Try something in", os.getenv("CASAPATH").split(' ')[0] + "/data/alma/simmos/"
if not os.path.exists(antennalist):
repodir = os.getenv("CASAPATH").split(' ')[0] + "/data/alma/simmos/"
antennalist = repodir + antennalist
stnx, stny, stnz, diam, padnames, antnames, telescopename, obsmeas = su.readantenna(antennalist)
posobs = myme.observatory(telescopename)
azel = myme.measure(compdict['shape']['direction'], 'azel')
azeldegs = tuple([qa.convert(azel[m], 'deg')['value'] for m in ('m0', 'm1')])
casalog.post("(az, el): (%.2f, %.2f) degrees" % azeldegs)
casalog.post('Rise and set times of ' + objname + " from " + telescopename + ':')
if 'JPL' in compdict.get('standard', 'JPL'):
approx = "APPROXIMATE. The times do not account for the apparent motion of "\
casalog.post(" (" + approx + ")")