caracal-pipeline / caracal

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

crosscal: delay calibration fails #1451

Open henedler opened 1 year ago

henedler commented 1 year ago

Hi, I want to calibrate a recent MeerKAT observation, however, I get the following error during the step 'delay_cal-kgb-0-0-primary:: K calibration':

Found good K Jones solutions in 0 solution intervals.
Spectral window(s) 0, could not be solved due to missing (pre-)calibration in one or more of the specified tables. 
Please check your results carefully! No output calibration table written. 

This looks a lot like #1356, but my data is not fully flagged - the field of J1939-6342 is flagged at ~58%. Also I tried different flag starts (aoflagger/firstpass_QUV.rfis & tfcrop) and different models.

Any idea what could cause this error?

Some further info: the data is at 32k channels and 8s integration. log-crosscal-delay_cal-kgb-0-0-primary-20221021-151405.txt log-caracal.txt

henedler commented 1 year ago

I think I found the problem, I only counted the flags and they were reasonable, however the WEIGHT_SPECTRUM is all zero... The prep_init_ws step that is supposed to populate that column does run without errors, but afterwards the WEIGHT_SPECTRUM column is still zero - if using initweiths(vis=vis, mode='nyq') instead of mode='weight', I get non-zero WEIGHT_SPECTRUM and the K-calibration works. Still trying to figure out why mode='weight' does not work in my case.

paoloserra commented 1 year ago

@henedler thanks for continuing looking into this. Just adding a link to https://github.com/caracal-pipeline/caracal/issues/1392 in case it is relevant.

spectram commented 1 year ago

Thank you for reporting this and linking relevant discussions to the issue. I am encountering the same issue and I suspect it to be due to the same reason. The suggested solution in this issue and in #1392 seems to be to re-estimate the WEIGHT_SPECTRUM and SIGMA_SPECTRUM columns using casa task initweights. The easier approach may be to disable the specweights parameter in the prep worker and use the default columns. But this might be an issue if the columns are not present and if the data was obtained from a previous version of katdal issue 346. Like @henedler pointed out in #1454, I am also working on (rather foolishly) a dataset with calibration solutions applied by katdal (see question). If the dataset in this issue was obtained in a similar manner as the one in #1454 and my dataset, then this issue could be due to a bug in katsdpcal or katdal. I can see that the original data (default calibrated from katdal) also has '0' in WEIGHTS and WEIGHT_SPECTRUM and 'inf' in SIGMA_SPECTRUM. I suppose this could mean that caracal does not replace existing values in the WEIGHT_SPECTRUM column? I will try running caracal on the raw data once I have obtained it. Please do let me know if I am missing something or if I should try something else also.

Athanaseus commented 7 months ago

Add an option to initialise both WEIGHTS and WEIGHT_SPECTRUM. Then keep SIGMA_SPECTRUM to keep track of the original weights. Use file (SEFD per channel) / uniform weights

check msutils class