Source
if not ( (self.weightpars['type'] == 'natural') or (self.weightpars['type'] == 'radial')) : ## For natural and radial, this array isn't created at all.
from __future__ import absolute_import
import os
import math
import shutil
import string
import time
import re;
import copy
import pdb
from casatasks.private.casa_transition import is_CASA6
if is_CASA6:
from casatools import synthesisimager, synthesisnormalizer
from casatasks import casalog
from .imager_base import PySynthesisImager
from .parallel_imager_helper import PyParallelImagerHelper
synth_imager_name = 'synthesisimager'
synth_imager_import = 'from casatools import synthesisimager'
else:
from taskinit import *
from imagerhelpers.imager_base import PySynthesisImager
from imagerhelpers.parallel_imager_helper import PyParallelImagerHelper
synthesisimager = casac.synthesisimager
synthesisnormalizer = casac.synthesisnormalizer
synth_imager_name = 'casac.synthesisimager'
synth_imager_import = 'pass'
'''
An implementation of parallel continuum imaging, using synthesisxxxx tools
Datasets are partitioned by row and major cycles are parallelized.
Gathers and normalization are done before passing the images to a
non-parallel minor cycle. The output model image is them scattered to
all the nodes for the next parallel major cycle.
There are N synthesisimager objects.
There is 1 instance per image field, of the normalizer and deconvolver.
There is 1 iterbot.
'''
#############################################
#############################################
## Parallelize only major cycle.
#############################################
class PyParallelContSynthesisImager(PySynthesisImager):
def __init__(self,params=None):
PySynthesisImager.__init__(self,params)
self.PH = PyParallelImagerHelper()
self.NN = self.PH.NN
self.selpars = self.allselpars;
self.allselpars = self.PH.partitionContDataSelection(self.allselpars)
# self.allcflist = self.PH.partitionCFCacheList(self.cfcachepars['cflist']);
# self.allcflist = self.PH.partitionCFCacheList(self.allgridpars['0']);
self.listOfNodes = self.PH.getNodeList();
self.coordsyspars = {};
self.toolsi=None
#############################################
def resetSaveModelParams(self, params=None):
mainparams = params.getSelPars()
for n in self.allselpars: # for all nodes
for v in self.allselpars[n]: # for all MSes
self.allselpars[n][v]['readonly']=mainparams[v]['readonly']
self.allselpars[n][v]['usescratch']=mainparams[v]['usescratch']
#############################################
def initializeImagers(self):
### Drygridding, and Coordsys comes from a single imager on MAIN node.
### No startmodel confusion. It's created only once and then scattered.
self.initializeImagers()
### Note : Leftover from CAS-9977
### There is a coord system mismatch at scatter/gather, if the MAIN version already
### exists on disk. With startmodel, it's xxx.model. With aproject, it's xxx.residual.
### There is an exception in SIImageStore::openImage to handle this.
### Turn on casalog.filter('DEBUG1') to see the warning message.
#############################################
def initializeImagersBase(self,thisSelPars,partialSelPars):
if partialSelPars==False: ## Init only on the zero'th node