from __future__ import absolute_import
from casatasks.private.casa_transition import is_CASA6
from casatools import componentlist, imager, measures, quanta
from casatasks import casalog
from .setjy_helper import testerrs
from . import solar_system_setjy as SSSetjy
from casatasks.private.predictcomp_helper import *
from taskinit import casalog, cltool, imtool, metool, qa
from plotcomp import plotcomp
from predictcomp_helper import *
def predictcomp(objname=None, standard=None, epoch=None,
minfreq=None, maxfreq=None, nfreqs=None, prefix=None,
antennalist=None, showplot=None, savefig=None, symb=None,
include0amp=None, include0bl=None, blunit=None, bl0flux=None):
Writes a component list named clist to disk and returns a dict of
'angdiam': angular diameter in radians (if used in clist),
'freqs': numpy.array of frequencies, in GHz,
'uvrange': numpy.array of baseline lengths, in m,
'amps': numpy.array of predicted visibility amplitudes, in Jy,
'savedfig': False or, if made, the filename of a plot.}
objname: An object supported by standard.
standard: A standard for calculating flux densities, as in setjy.
Default: 'Butler-JPL-Horizons 2010'
epoch: The epoch to use for the calculations. Irrelevant for
minfreq: The minimum frequency to use.
maxfreq: The maximum frequency to use.
Example: '', anything <= 0, or None: use minfreq.
nfreqs: The number of frequencies to use.
Default: 1 if minfreq == maxfreq,
prefix: The component list will be saved to
prefix + '<objname>_spw0_<minfreq><epoch>.cl'
antennalist: An array configuration file as used by simdata.
If given, a plot of S vs. |u| will be made.
Default: '' (None, just make clist.)
showplot: Whether or not to show the plot on screen.
Subparameter of antennalist.
Default: Necessarily False if antennalist is not specified.
savefig: Filename for saving a plot of S vs. |u|.
Subparameter of antennalist.
Default: False (necessarily if antennalist is not specified)
Examples: True (save to prefix + '.png')
'myplot.png' (save to myplot.png)
symb: One of matplotlib's codes for plot symbols: .:,o^v<>s+xDd234hH|_
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
bl0flux: show zero baseline flux
casalog.origin('predictcomp')
raise Exception("Error, objname is undefined")
raise Exception("Error, minfreq is undefined")
minfreqq = _qa.quantity(minfreq)
minfreqHz = _qa.convert(minfreqq, 'Hz')['value']
maxfreqq = _qa.quantity(maxfreq)