ratt-ru / QuartiCal

CubiCal, but with greater power.
MIT License
8 stars 4 forks source link

Investigate interaction of robust reweighting, uv-cut and writing of corrected weight. #283

Open JSKenyon opened 1 year ago

JSKenyon commented 1 year ago

Describe the bug Writing out the corrected weight/weight when using a uv-cut may result in zero weight on baselines deselected by the cut. This is both a bug and a sharp edge although it is connected to relatively specialised functionality. I had begun fixing this in #225 but I never came to a definitive conclusion about the correct approach. The problem is also further exacerbated by the fact that QuartiCal currently only allows for one instance of the weight column (for memory reasons). However, this is problematic in cases where the robust solver is in use as the user may want to use the robust weights during calibration but write out the corrected weights based on the current contents of WEIGHT_SPECTRUM. This is necessary as imaging with the robust weights can (will) suppress unmodelled flux.

To Reproduce Run QC with the robust solver and write out corrected_weight.

Expected behavior QC should:

  1. Treat the UV-cut correctly during reweighting.
  2. Support writing out corrected weight using contents of WEIGHT_SPECTRUM even when robust reweighting is enabled.

Workaround Running QC again with solver.robust=False and loading the previously solved gains will allow writing corrected weight from either SIGMA_SPECTRUM/WEIGHT_SPECTRUM. This is obviously tedious but should work in the interim.

ktrehaeven commented 9 months ago

Hi @JSKenyon would I also be able to peel during the first and/or second run of QC?

JSKenyon commented 9 months ago

Hi @JSKenyon would I also be able to peel during the first and/or second run of QC?

In general? There is nothing stopping you from peeling from the outset if you have the relevant model components. Not sure if that answers your question though.

ktrehaeven commented 9 months ago

Yup, thanks.

To test if there is actually any benefit from including the second run, I imaged the corrected data from run1 (uv cut and solver.robust). Then used exactly the same config to do run2, just with solver.robust=False and added the corrected_weight output (see attached configs) and imaged again. The images after run1 and run2 are almost exactly the same. After run2 i imaged with the corrected data from run1 and run2 and both images came out almost exactly the same. So it doesn't seem like the second run improves anything. Am I missing something? Do you actually have to update the input model when doing run2?

run1.qc.txt run2.qc.txt