ratt-ru / QuartiCal

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

BDA fixes #186

Closed JSKenyon closed 2 years ago

JSKenyon commented 2 years ago

@bennahugo @Kincaidr This PR makes some minor changes to the BDA code which should get it into a running (although likely imperfect) state. I will get this merged into the stimelation branch as soon as possible. I will play around a little bit more just to confirm that the solvers are handling the data correctly.

bennahugo commented 2 years ago

Thanks Jon

Much appreciated. We can perhaps start running the dE case with the stimulation branch once merged.

We are looking at getting the two images level in terms of decorrelation - something is not quite right in the averaging parameters, so until we sort that out a comparison of quality would be rather hard. Hopefully we can fix that this week and finalize the 3GC reduction script for this cluster.

On Wed, Aug 3, 2022 at 11:47 AM JSKenyon @.***> wrote:

@bennahugo https://github.com/bennahugo @Kincaidr https://github.com/Kincaidr This PR makes some minor changes to the BDA code which should get it into a running (although likely imperfect) state. I will get this merged into the stimelation branch as soon as possible. I will play around a little bit more just to confirm that the solvers are handling the data correctly.

You can view, comment on, or merge this pull request online at:

https://github.com/ratt-ru/QuartiCal/pull/186 Commit Summary

File Changes

(6 files https://github.com/ratt-ru/QuartiCal/pull/186/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/ratt-ru/QuartiCal/pull/186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6SUAP6NJUN6HEYSMJLVXI5ZXANCNFSM55OFVLKA . You are receiving this because you were mentioned.Message ID: @.***>

--

Benjamin Hugo

PhD. student, Centre for Radio Astronomy Techniques and Technologies Department of Physics and Electronics Rhodes University

Junior software developer Radio Astronomy Research Group South African Radio Astronomy Observatory Black River Business Park Observatory Cape Town

JSKenyon commented 2 years ago

@bennahugo @Kincaidr This has been merged into main and stimelation. Should be good to go on your experiments. Do note that I have never tested the BDA functionality with DDEs, so there may still be some lingering issues.

sjperkins commented 2 years ago

I have some long-term thoughts on reimplementing BDA that would hopefully reduce the need for these (unfortunately necessary!) heuristics by re-averaging into predefined grid-aligned windows using 2D Interval/Range Trees.

I think this will change computational complexity of averaging from O(TC) to O(T log T C log C) where T= TIME and C = NUM_CHAN, but it may be worth reducing the need to deal with fiddly cases like this.

I have no immediate plans to implement this and would only do so after further discussion.

Kincaidr commented 2 years ago

Hi Jonathan,

The Quartical has been working well for both BDA and regular timechannel-averaging data. Here are the results so far:

Note: This is xova applied ontop of the CASA regular averaging.

xova TimeChannel left and xova BDA right:

After K-solve:

Deep masking :

K + de solve with deep mask:

The last de quartical run has over-subtracted slightly, I have lowered the solution intervals to prevent capturing of excess flux by changing de.time_interval 32 to de.time_interval 15. Is there any other parameter I could change to lower this?

After I get this last step right, I will repeat the whole process with the same xova paramaters applied to without the CASA averaging data. This will probably remove that smearing you see in the first After K-solve of the xova TimeChannel image.

bennahugo commented 2 years ago

I will just add that the artifacts seen in the first set of images are due to cleaning without a mask into the frequency smeared (radial) far sidelobes of the bright sources to the top. I will just look at the 'deep' mask images.

The total amount of smearing is confirmed comparable but the regular averaging is not only smeared in time but also frequency, hence the slightly worse sidelobes - worsened by cleaning into them...

Thanks for the work on this Robert. I have a suspicion that some of the negative errors are due to overaveraging - the visibilities are not subtracting properly from your smeared model. I suspect you will get better results once you removed the initial casa averaging.

Note: You might try the robust solver on the de term though if you see evidence for flux absorption.

On Thu, 11 Aug 2022, 21:31 Kincaidr, @.***> wrote:

Hi Jonathan,

The Quartical has been working well for both BDA and regular timechannel-averaging data. Here are the results so far:

Note: This is xova applied ontop of the CASA regular averaging.

xova TimeChannel left and xova BDA right:

After K-solve:

https://user-images.githubusercontent.com/53697426/184221772-32f45cfc-a9b9-4b08-b20c-96eddf21bc49.png https://user-images.githubusercontent.com/53697426/184222045-420cca3c-3335-452e-85e5-36ebf68f9acc.png

Deep masking :

https://user-images.githubusercontent.com/53697426/184222244-adb68887-adb1-4685-9c09-374521c480ef.png https://user-images.githubusercontent.com/53697426/184222317-528bfb54-1b60-41a2-94b2-27ba24c9ddc0.png

K + de solve with deep mask:

https://user-images.githubusercontent.com/53697426/184222459-10a2c3df-118b-4d38-a327-cb876a313186.png https://user-images.githubusercontent.com/53697426/184222483-4598659c-a3cb-48cb-b013-261d13adfb4a.png

The last de quartical run has over-subtracted slightly, I have lowered the solution intervals to prevent capturing of excess flux by changing de.time_interval 32 to de.time_interval 15. Is there any other parameter I could change to lower this?

After I get this last step right, I will repeat the whole process with the same xova paramaters applied to without the CASA averaging data. This will probably remove that smearing you see in the first After K-solve of the xova TimeChannel image.

— Reply to this email directly, view it on GitHub https://github.com/ratt-ru/QuartiCal/pull/186#issuecomment-1212401819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6XYHBFWX2BEQ4PG6ATVYVIIDANCNFSM55OFVLKA . You are receiving this because you were mentioned.Message ID: @.***>

JSKenyon commented 2 years ago

Great work @Kincaidr! Apologies for not replying sooner. I am glad that things seem to be working.

The last de quartical run has over-subtracted slightly, I have lowered the solution intervals to prevent capturing of excess flux by changing de.time_interval 32 to de.time_interval 15. Is there any other parameter I could change to lower this?

The over-subtraction can be tricky to pin down. I suspect that you may need a deeper model (which captures as much of the diffuse flux as possible) to eliminate the over-subtraction as the gain solutions will tend to move flux that unmodelled flux into the peeled sources. That said, I do not know what your CLEAN model image looks like - one needs to be very careful about negative components/artifacts entering the model.

bennahugo commented 2 years ago

@Kincaidr something that @JSKenyon mentioned during our meeting is to also run the pipeline on the non-averaged data ie. the raw CASA 1GC'd data as a dual comparison to see if the oversubtraction is due to overaveraging -- it might be the quickest way to establish that.

IanHeywood commented 2 years ago

one needs to be very careful about negative components/artifacts entering the model.

Taking this issue off-topic here, but this has been a source of much debate for at least as long as I've been doing radio astronomy. I can remember people arguing 20 years ago about whether to cut AIPS CL tables at the first negative component or not when doing selfcal.

Definitely don't want artefacts, postive or negative, entering the model. But the argument againt "no negatives whatsoever" is that for real sources you need the negative components in there because of how CLEAN works, things like the loop gain in conjunction with the fact that even unresolved sources might not being registered at the centre of a pixel once an image is formed. The thinking is that negative components are required to best characterise the source once CLEAN has done its thing.

I've always leant towards the "allow negatives" philosophy, especially when there is a good mask in place (which I maintain is always good practice). Would be keen to hear everyone's thoughts on this.

Cheers.

JSKenyon commented 2 years ago

@IanHeywood I have created a discussion here: https://github.com/ratt-ru/QuartiCal/discussions/189, where we can discuss how CLEAN models affect calibration.

@bennahugo, @Kincaidr feel free to open a discussion for BDA results as this PR is closed and not very visible.