Source
# casalog.post("Model visibilities may not have been saved in the MS even though you have asked for it. Please check the logger for the phrases 'Run (Last) Major Cycle' and '" + wstr +"'. If these do not appear, then please save the model via a separate tclean run with niter=0,calcres=F,calcpsf=F. It will pick up the existing model from disk and save/predict it. Reason for this : For performance reasons model visibilities are saved only in the last major cycle. If the X button on the interactive GUI is used to terminate a run before this automatically detected 'last' major cycle, the model isn't written. However, a subsequent tclean run as described above will predict and save the model. ","WARN")
import os
import math
import shutil
import string
import time
import re
import copy
from typing import TYPE_CHECKING
from casatools import (
synthesisimager,
synthesisdeconvolver,
synthesisnormalizer,
iterbotsink,
ctsys,
table,
image,
)
from casatasks import casalog
from casatasks.private.imagerhelpers.summary_minor import SummaryMinor
if TYPE_CHECKING:
from casatasks.private.imagerhelpers.input_parameters import ImagerParameters
ctsys_hostinfo = ctsys.hostinfo
_tb = table()
_ia = image()
"""
A set of helper functions for tclean.
Summary...
"""
#############################################
class PySynthesisImager:
def __init__(self,params: 'ImagerParameters'):
################ Tools
self.initDefaults()
# Check all input parameters, after partitioning setup.
# Selection Parameters. Dictionary of dictionaries, indexed by 'ms0','ms1',...
self.allselpars = params.getSelPars()
# Imaging/Deconvolution parameters. Same for serial and parallel runs
self.alldecpars = params.getDecPars()
self.allimpars = params.getImagePars()
self.allgridpars = params.getGridPars()
self.allnormpars = params.getNormPars()
self.weightpars = params.getWeightPars()
# Iteration parameters
self.iterpars = params.getIterPars() ## Or just params.iterpars
# CFCache params
self.cfcachepars = params.getCFCachePars()
## Number of fields ( main + outliers )
self.NF = len(self.allimpars.keys())
self.stopMinor = {} ##[0]*self.NF
for immod in range(0, self.NF):
self.stopMinor[str(immod)] = 1.0
## Number of nodes. This gets set for parallel runs
## It can also be used serially to process the major cycle in pieces.