def _fillweight(vis): if not os.path.exists(vis): return casalog.post('fill WEIGHT and SIGMA columns for %s ...' % (vis)) # work with private cb tool with sdutil.cbmanager(vis, compress=False, addcorr=False, addmodel=False) as cb: status = cb.initweights() if status: # cb.initweights() succeeded so try to apply Tsys to # weight column # procedure: # 1. generate temporary Tsys caltable # 2. apply temporary Tsys caltable to vis # 3. remove temporary Tsys caltable import time from gencal import gencal from applycal import applycal caltable = 'temporary_caltable%s.tsys' % (str(time.time()).replace( '.', '')) casalog.post('tempolary caltable name: %s' % (caltable)) try: gencal(vis=vis, caltable=caltable, caltype='tsys') # add 0.5*INTERVAL to the TIME values in caltable to make them time of # integration midpoint, because gencal currently sets (TIME_VIS - # INTERVAL_VIS/2), namely start time, into TIME in its output based on # ALMA's conventions...(2014/6/17 WK) with sdutil.tbmanager(caltable, nomodify=False) as tbcal: with sdutil.tbmanager(vis) as tbvis: interval = tbvis.getcol('INTERVAL')[0] tbcal.putcol('TIME', tbcal.getcol('TIME') + 0.5 * interval) applycal(vis=vis, docallib=False, gaintable=[caltable], applymode='calonly') except Exception, e: # Tsys application failed so that reset WEIGHT and SIGMA to 1.0 _resetweight(vis) raise e finally:
def _fillweight(vis): if not os.path.exists(vis): return casalog.post('fill WEIGHT and SIGMA columns for %s ...'%(vis)) # work with private cb tool with sdutil.cbmanager(vis, compress=False, addcorr=False, addmodel=False) as cb: status = cb.initweights() if status: # cb.initweights() succeeded so try to apply Tsys to # weight column # procedure: # 1. generate temporary Tsys caltable # 2. apply temporary Tsys caltable to vis # 3. remove temporary Tsys caltable import time from gencal import gencal from applycal import applycal caltable = 'temporary_caltable%s.tsys'%(str(time.time()).replace('.','')) casalog.post('tempolary caltable name: %s'%(caltable)) try: gencal(vis=vis, caltable=caltable, caltype='tsys') # add 0.5*INTERVAL to the TIME values in caltable to make them time of # integration midpoint, because gencal currently sets (TIME_VIS - # INTERVAL_VIS/2), namely start time, into TIME in its output based on # ALMA's conventions...(2014/6/17 WK) with sdutil.tbmanager(caltable, nomodify=False) as tbcal: with sdutil.tbmanager(vis) as tbvis: interval = tbvis.getcol('INTERVAL')[0] tbcal.putcol('TIME', tbcal.getcol('TIME') + 0.5*interval) applycal(vis=vis, docallib=False, gaintable=[caltable], applymode='calonly') except Exception, e: # Tsys application failed so that reset WEIGHT and SIGMA to 1.0 _resetweight(vis) raise e finally:
def setUp(self): super(tsdsmooth_test_weight, self).setUp() # initialize WEIGHT_SPECTRUM with sdutil.cbmanager(self.infile) as cb: cb.initweights()
def setUp(self): super(sdsmooth_test_weight, self).setUp() # initialize WEIGHT_SPECTRUM with sdutil.cbmanager(self.infile) as cb: cb.initweights()