Source
emsg = "Single dish simulation has a flux recovery issue when using a components list as an input.\nPlease generate compskymodel image first by obsmode='' and use the image as the skymodel input.\nSorry for the inconvenience."
from __future__ import absolute_import
import os
import re
import pylab as pl
from casatasks.private.casa_transition import is_CASA6
if is_CASA6:
from casatools import ctsys, quanta, imager
from casatasks import casalog
from .simutil import *
from .simutil import is_array_type
qa = quanta()
else:
from taskinit import *
from simutil import *
from casa_stack_manip import stack_frame_find
from simutil import is_array_type
imager = imtool
def simobserve(
project=None,
skymodel=None, inbright=None, indirection=None, incell=None,
incenter=None, inwidth=None, # innchan=None,
complist=None, compwidth=None, comp_nchan=1,
setpointings=None,
ptgfile=None, integration=None, direction=None, mapsize=None,
maptype=None, pointingspacing=None, caldirection=None, calflux=None,
# observe=None,
obsmode=None,
refdate=None, hourangle=None,
totaltime=None, antennalist=None,
sdantlist=None,
sdant=None,
outframe=None,
thermalnoise=None,
user_pwv=None, t_ground=None, t_sky=None, tau0=None, seed=None,
leakage=None,
graphics=None,
verbose=None,
overwrite=None
):
# Collect a list of parameter values to save inputs
in_params = locals()
try:
#########################
# some hardcoded variables
pbcoeff = 1.13 ## PB defined as pbcoeff*lambda/d
nyquist = 0.5/pbcoeff ## Nyquist spacing = PB*nyquist
gridratio_int = 1./pl.sqrt(3) # times lambda/d
gridratio_tp = 1./3
relmargin = .5 # number of PB between edge of model and ptg centers
scanlength = 1 # number of integrations per scan
# RI TODO for inbright=unchanged, need to scale input image to jy/pix
# according to actual units in the input image
casalog.origin('simobserve')
if verbose: casalog.filter(level="DEBUG2")
if not is_CASA6:
myf = stack_frame_find( )
# create the utility object
# this is the dir of the observation (could be "")
util = simutil(direction)
if verbose: util.verbose = True
msg = util.msg
# it was requested to make the user interface "observe" for what
# is sm.observe and sm.predict.
# interally the code is clearer if we stick with predict so
predict = obsmode.startswith('i') or obsmode.startswith('s')
if predict:
uvmode = obsmode.startswith('i')
if not uvmode: antennalist = sdantlist
elif sdantlist != "":
if antennalist == "":
uvmode = False
antennalist = sdantlist
else:
#uvmode = True
#msg("Both antennalist and sdantlist are defined. sdantlist will be ignored",priority="warn")
emsg = "Both antennalist and sdantlist are defined. Define one of them."