Commits
Neal Schweighart authored 486c7cf22f1 Merge
1 1 | import os |
2 2 | import math |
3 3 | import shutil |
4 4 | import string |
5 5 | import time |
6 6 | import re |
7 7 | import copy |
8 8 | from typing import TYPE_CHECKING |
9 9 | |
10 + | |
10 11 | from casatools import ( |
11 12 | synthesisimager, |
12 13 | synthesisdeconvolver, |
13 14 | synthesisnormalizer, |
14 15 | iterbotsink, |
15 16 | ctsys, |
16 17 | table, |
17 18 | image, |
18 19 | ) |
19 20 | from casatasks import casalog |
108 109 | # nimpars = copy.deepcopy(self.allimpars) |
109 110 | # for fld in range(0,self.NF): |
110 111 | # self.SItool.defineimage( **( nimpars[str(fld)] ) ) |
111 112 | |
112 113 | # If cfcache directory already exists, assume that it is |
113 114 | # usable and is correct. makeCFCache call then becomes a |
114 115 | # NoOp. |
115 116 | |
116 117 | cfCacheName='' |
117 118 | exists=False |
118 - | if(self.allgridpars['0']['gridder'].startswith('awpr') or self.allgridpars['0']['gridder'].startswith('awph') ): |
119 + | if(self.allgridpars['0']['gridder'].startswith('awpr') ): |
119 120 | cfCacheName=self.allgridpars['0']['cfcache']; |
120 121 | if (cfCacheName == ''): |
121 122 | cfCacheName = self.allimpars['0']['imagename'] + '.cf' |
122 123 | self.allgridpars['0']['cfcache']= cfCacheName |
123 124 | exists = (os.path.exists(cfCacheName) and os.path.isdir(cfCacheName)); |
124 125 | else: |
125 126 | cfCacheName='' |
126 127 | exists=True |
127 128 | |
128 129 | for fld in range(0,self.NF): |
137 138 | ###all images have the same normtype etc..so first one is good enough |
138 139 | self.SItool.normalizerinfo(self.allnormpars["0"]) |
139 140 | ###commenting this out so that tuneSelect is done after weighting |
140 141 | ###CAS-11687 |
141 142 | # For cube imaging: align the data selections and image setup |
142 143 | |
143 144 | #if self.allimpars['0']['specmode'] != 'mfs' and self.allimpars['0']['specmode'] != 'cubedata': |
144 145 | # self.SItool.tuneselectdata() |
145 146 | ###For cubes create cfcache ahead of each partition trying |
146 147 | ### to create it as it is not multiprocess safe |
147 - | if("cube" in self.allimpars['0']['specmode']): |
148 + | if(("cube" in self.allimpars['0']['specmode']) or ("awphpg" in self.allgridpars['0']['gridder'])): |
148 149 | self.makeCFCache(exists); |
150 + | ### Warning about awp2/mosaic not having conjbeam thus will not be correct on first major cycles |
151 + | ## CAS-14146 : Krishna : Moved this warning to task_tclean.py along with the other warnings there. |
152 + | #if( ("mfs" in self.allimpars['0']['specmode']) and ("mtmfs" in self.allimpars['0']['deconvolver']) and (self.allgridpars['0']['gridder'] in ['awp2', 'mosaic']) ): |
153 + | # casalog.post( |
154 + | # "You may consider using specmode=mvc with "+self.allgridpars['0']['gridder'] |
155 + | # +" as this gridder does not use conjbeams \n thus need a couple of major cycle to converge to the correct answer", |
156 + | # "WARN" |
157 + | # ) |
158 + | |
149 159 | |
150 160 | ############################################# |
151 161 | |
152 162 | def initializeDeconvolvers(self): |
153 163 | for immod in range(0, self.NF): |
154 164 | self.SDtools.append(synthesisdeconvolver()) |
155 165 | self.SDtools[immod].setupdeconvolution(decpars=self.alldecpars[str(immod)]) |
156 166 | |
157 167 | ############################################# |
158 168 | ## Overloaded by ParallelCont |
422 432 | self.allimpars["0"]["specmode"] == "mfs" |
423 433 | or self.allimpars["0"]["deconvolver"] == "mtmfs" |
424 434 | ) |
425 435 | |
426 436 | ### Gather PSFs (if needed) and normalize by weight |
427 437 | for immod in range(0, self.NF): |
428 438 | # for cube normalization is done in C++ |
429 439 | if divideInPython: |
430 440 | self.PStools[immod].gatherpsfweight() |
431 441 | self.PStools[immod].dividepsfbyweight() |
442 + | # continuum A style gridders need their .weight divided by sumwt except for awphpg |
443 + | if(("awphpg" not in self.allgridpars['0']['gridder'])): |
444 + | self.PStools[immod].divideweightbysumwt() |
445 + | |
432 446 | self.check_psf(immod) |
433 447 | |
434 448 | def check_psf(self, immod): |
435 449 | if self.SDtools != []: |
436 450 | if immod <= len(self.SDtools) - 1: |
437 451 | self.SDtools[immod].checkrestoringbeam() |
438 452 | |
439 453 | ############################################# |
440 454 | def calcVisAppSens(self): |
441 455 | |