import pipeline.infrastructure as infrastructure
import pipeline.infrastructure.basetask as basetask
import pipeline.infrastructure.callibrary as callibrary
import pipeline.infrastructure.vdp as vdp
from pipeline.h.heuristics import caltable as caltable_heuristic
from pipeline.infrastructure import casa_tasks
from . import resultobjects
LOG = infrastructure.get_logger(__name__)
[docs]class GainCurves(basetask.StandardTaskTemplate):
Inputs = GainCurvesInputs
[docs] def prepare(self):
inputs = self.inputs
gencal_args = inputs.to_casa_args()
gencal_job = casa_tasks.gencal(**gencal_args)
self._executor.execute(gencal_job)
callist = []
calto = callibrary.CalTo(vis=inputs.vis)
calfrom = callibrary.CalFrom(gencal_args['caltable'], caltype='gc', interp='', calwt=False)
calapp = callibrary.CalApplication(calto, calfrom)
callist.append(calapp)
return resultobjects.GainCurvesResults(pool=callist)
[docs] def analyse(self, result):
# double-check that the caltable was actually generated
on_disk = [ca for ca in result.pool
if ca.exists() or self._executor._dry_run]
result.final[:] = on_disk
missing = [ca for ca in result.pool
if ca not in on_disk and not self._executor._dry_run]
result.error.clear()
result.error.update(missing)
return result