Commits

Srikrishna Sekhar authored 03739099c27
CAS-14184 : Bugfix for niter=0 peakres calculation

If no mask was passed in for the niter=0 case, the `ImagingDict` class set the `mask` parameter to -1 (instead of the pixel mask). peakRes was always calcualted as `np.amax(image_pixels * mask_pixels)` so when mask = -1 it picked the highest negative as the peakRes. This commit fixes that bug, and has been confirmed to pass the previously failing task_tclean tests. Additionally, removed a check in test_task_tclean that asserted len(summaryminor) == 0 for niter = 0.

casatasks/src/private/imagerhelpers/imager_return_dict.py

Modified
514 514 mask = -1 # No mask, so everything is unmasked
515 515
516 516 # If model image exists, calc model flux, else set to 0
517 517 model_sum = 0
518 518 if os.path.exists(self.modelname):
519 519 ia.open(self.modelname)
520 520 model_data = ia.getchunk(blc, trc, dropdeg=True)
521 521 model_sum = np.sum(model_data)
522 522 ia.close()
523 523
524 - peak_resid = np.amax(data*mask)
524 + if mask > 0:
525 + peak_resid = np.amax(data*mask)
526 + else:
527 + peak_resid = np.amax(data)
528 +
525 529 if fullsummary:
526 530 peak_resid_NM = np.amax(data)
527 531 mask_sum = np.sum(mask)
528 532
529 533 summaryparams = dict()
530 534 # This entire function is only invoked in the special case of niter=0
531 535 summaryparams['iterDone'] = [0.0,]
532 536 summaryparams['peakRes'] = [peak_resid,]
533 537 # model flux has to be zero because no iterations were performed
534 538 summaryparams['modelFlux'] = [model_sum,]

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut