Commits
252 252 | (1) do direction plane smoothing of input casa image (execute imsmooth) |
253 253 | (2) convert casa image into MeasurementSet (a pixel of image corresponds to a line of MS) |
254 254 | (3) do spectral smoothing of MS (execute sdsmooth) |
255 255 | (4) do baselining (execute sdbaseline) |
256 256 | (5) convert MS into casa image, and subtract results |
257 257 | """ |
258 258 | __validate_imagename(imagename) |
259 259 | linefile = __prepare_linefile(linefile, imagename) |
260 260 | |
261 261 | with stack_manager(imagename) as (image_stack, ms_stack): |
262 - | input_image_shape = get_image_shape(image_stack.peak().path) |
263 - | |
264 - | # do direction plane smoothing |
265 - | execute_imsmooth(dirkernel, major, minor, pa, kimage, scale, image_stack) |
262 + | try: |
263 + | input_image_shape = get_image_shape(image_stack.peak().path) |
266 264 | |
267 - | # convert casaimage into MeasurementSet |
268 - | execute_image2ms(DATACOLUMN, input_image_shape, image_stack, ms_stack) |
265 + | # do direction plane smoothing |
266 + | execute_imsmooth(dirkernel, major, minor, pa, kimage, scale, image_stack) |
269 267 | |
270 - | # do spectral smoothing |
271 - | execute_sdsmooth(DATACOLUMN, spkernel, kwidth, image_stack, ms_stack, input_image_shape) |
268 + | # convert casaimage into MeasurementSet |
269 + | execute_image2ms(DATACOLUMN, input_image_shape, image_stack, ms_stack) |
272 270 | |
273 - | # do baselining |
274 - | execute_sdbaseline(DATACOLUMN, bloutput, maskmode, chans, thresh, avg_limit, minwidth, |
275 - | edge, blfunc, order, npiece, applyfft, fftthresh, addwn, rejwn, blparam, |
276 - | clipniter, clipthresh, image_stack, ms_stack, input_image_shape) |
271 + | # do spectral smoothing |
272 + | execute_sdsmooth(DATACOLUMN, spkernel, kwidth, image_stack, ms_stack, input_image_shape) |
277 273 | |
278 - | # convert MeasurementSet into image and subtract results |
279 - | execute_image_subtraction(linefile, image_stack) |
274 + | # do baselining |
275 + | execute_sdbaseline(DATACOLUMN, bloutput, maskmode, chans, thresh, avg_limit, minwidth, |
276 + | edge, blfunc, order, npiece, applyfft, fftthresh, addwn, rejwn, blparam, |
277 + | clipniter, clipthresh, image_stack, ms_stack, input_image_shape) |
280 278 | |
281 - | if output_cont: |
282 - | get_continuum_image(image_stack) |
279 + | # convert MeasurementSet into image and subtract results |
280 + | execute_image_subtraction(linefile, image_stack) |
283 281 | |
284 - | do_post_processing(linefile) |
282 + | if output_cont: |
283 + | get_continuum_image(image_stack) |
284 + | finally: |
285 + | do_post_processing(linefile) |
285 286 | |
286 287 | |
287 288 | def execute_imsmooth(dirkernel: str=None, major: str=None, minor: str=None, pa: str=None, kimage: str=None, scale: float=None, |
288 289 | stack: AbstractFileStack=None) -> None: |
289 290 | """Call casatasks.imsmooth task if dirkernel is specified.""" |
290 291 | if not __require_imsmooth(dirkernel): |
291 292 | casalog.post('omit image smoothing', 'INFO') |
292 293 | return |
293 294 | |
294 295 | casalog.post('execute image smoothing', 'INFO') |