caracal-pipeline / caracal

Containerized Automated Radio Astronomy Calibration (CARACal) pipeline
GNU General Public License v2.0
28 stars 6 forks source link

regrid clean mask cube to broader channel width fails #1570

Open Fil8 opened 5 months ago

Fil8 commented 5 months ago

the line_worker fails when regridding the mask to clean the datacube.

The user may want to create a datacube with a different binsize than the original dataset (the input .ms file). When this happens, sofia creates a cleanmask with naxis3 of same size of the requested output datacube.

Then the pipeline crashes when checking the size of the cleanmask, right before cleaning.

# 2024-01-06 02:19:34: Running mProjectCube /stimela_mount/input/NGC3557_r10_t90_3kms_3kms_cleanmask_0_mask_01.fits /stimela_mount/output/NGC3557_r10_t90_3kms_3kms_cleanmask_
0_mask_comb_NGC3557_regrid.fits /stimela_mount/input/tmp.hdr
# [struct stat="OK", module="mProjectCube", time=5.0]
# INFO:    Converting SIF file to temporary sandbox...
# INFO:    Cleaning up image...
2024-01-06 02:19:40 CARACal.Stimela.reprojectMask-field0 INFO: job complete at 2024-01-06 02:19:40.344020 after 0:00:15.385101
2024-01-06 02:19:40 CARACal.Stimela.line__comb INFO: Saving pipeline information in .last_line__comb.json
2024-01-06 02:19:40 CARACal.Stimela.line__comb INFO: Recipe executed successfully
2024-01-06 02:19:40 CARACal INFO: Reprojecting mask NGC3557_r10_t90_3kms_3kms_cleanmask_0_mask_comb_NGC3557_regrid.fits to match the spectral axis of the cube.
2024-01-06 02:19:40 CARACal ERROR: Requested channels are not contained in mask NGC3557_r10_t90_3kms_3kms_cleanmask_0_mask_comb_NGC3557_regrid.fits. [OSError]
Fil8 commented 5 months ago

I suspect it is because in this case the pipeline enters in this loop, because it does not enter in any other ifs.

https://github.com/caracal-pipeline/caracal/blob/5bafd404cd318760d8ced375304b1bd1c914bb81/caracal/workers/line_worker.py#L981

Fil8 commented 5 months ago

or maybe is because of this typo:

https://github.com/caracal-pipeline/caracal/blob/5bafd404cd318760d8ced375304b1bd1c914bb81/caracal/workers/line_worker.py#L968

Fil8 commented 1 week ago

I also found out that the pipeline fails if a binned mask is given as input.

For example one can make cube_0 binning channels, run sofia to create a mask and then make cube_1. At this point line_worker.py fails because it counter checks the size of the mask against the size of the ms-file and product for binchans is forgotten at this line.

https://github.com/caracal-pipeline/caracal/blob/2d338e2afc5ed8fc723be95e74b071890d4a7bed/caracal/workers/line_worker.py#L979

this is now solved in maskForn repo:

https://github.com/caracal-pipeline/caracal/blob/f5aeb81510341f3898b9a9ed7ce7e5435040a99f/caracal/workers/line_worker.py#L960

The issue above still needs to be solved.