Commits
149 149 | casalog.post('Apply Pressed-out method') |
150 150 | |
151 151 | # CAS-5410 Use private tools inside task scripts |
152 152 | ia = iatool() |
153 153 | |
154 154 | # mask |
155 155 | self.image = ia.newimagefromimage(infile=self.infiles, outfile=self.tmpmskname) |
156 156 | # back-up original mask name |
157 157 | is_initial_mask = (self.image.maskhandler('default')[0] != '') |
158 158 | temp_maskname = "temporal" |
159 - | imshape = self.image.shape() |
160 - | ndim = len(imshape) |
161 - | nx = imshape[0] |
162 - | ny = imshape[1] |
159 + | # imshape = self.image.shape() |
160 + | # ndim = len(imshape) |
161 + | # nx = imshape[0] |
162 + | # ny = imshape[1] |
163 163 | if len(self.thresh) == 0: |
164 164 | casalog.post('Use whole region') |
165 165 | else: |
166 166 | # mask pixels beyond thresholds |
167 167 | maskstr = ("mask('%s')" % self.tmpmskname) |
168 168 | if self.thresh[0] != self.nolimit: |
169 169 | maskstr += (" && '%s'>=%f" % (self.tmpmskname, self.thresh[0])) |
170 170 | if self.thresh[1] != self.nolimit: |
171 171 | maskstr += (" && '%s'<=%f" % (self.tmpmskname, self.thresh[1])) |
172 172 | # Need to flush to image once to calcmask ... sigh |
340 340 | ### |
341 341 | casalog.post('Apply Basket-Weaving') |
342 342 | |
343 343 | # CAS-5410 Use private tools inside task scripts |
344 344 | ia = iatool() |
345 345 | |
346 346 | # initial setup |
347 347 | outimage = ia.newimagefromimage( |
348 348 | infile=self.infiles[0], outfile=self.outfile, overwrite=self.overwrite) |
349 349 | imshape_out = outimage.shape() |
350 - | ndim_out = len(imshape_out) |
350 + | # ndim_out = len(imshape_out) |
351 351 | coordsys = outimage.coordsys() |
352 352 | axis_types = coordsys.axiscoordinatetypes() |
353 353 | # direction axis should always exist |
354 354 | try: |
355 355 | direction_axis0 = axis_types.index('Direction') |
356 356 | direction_axis1 = axis_types[direction_axis0 + 1:].index('Direction') \ |
357 357 | + direction_axis0 + 1 |
358 358 | except IndexError: |
359 359 | raise RuntimeError('Direction axes don\'t exist.') |
360 360 | finally: |
397 397 | if not self.realimage.getchunk(getmask=True).all(): |
398 398 | casalog.post("Replacing masked pixels with 0.0 in %d-th image" % (i)) |
399 399 | self.realimage.replacemaskedpixels(0.0) |
400 400 | self.realimage.close() |
401 401 | self.imagimage.close() |
402 402 | |
403 403 | # Below working images are all 4D regardless of dimension of input images |
404 404 | # image shape for temporary images (always 4D) |
405 405 | ia.open(self.tmprealname[0]) |
406 406 | imshape = ia.shape() |
407 - | ndim = len(imshape) |
407 + | # ndim = len(imshape) |
408 408 | ia.close() |
409 409 | |
410 410 | if len(self.thresh) == 0: |
411 411 | casalog.post('Use whole region') |
412 412 | else: |
413 413 | for i in range(nfile): |
414 414 | self.realimage = ia.newimage(self.tmprealname[i]) |
415 415 | for iaxis2 in range(imshape[2]): |
416 416 | for iaxis3 in range(imshape[3]): |
417 417 | pixmsk = self.realimage.getchunk([0, 0, iaxis2, iaxis3], |