Open paoloserra opened 4 years ago
Two questions: is there a way to tell AOflagger to respect scan boundaries? Is this problem specific to AOflagger only, and Tricolour won't be affected?
Answer 1: No way to do that I know. Also, it has been a while since I took at the gory details of the flagging worker, but should it not be flagging only the calibrators in the first round anyway? The target is flagged separately in flagging__2? We could add field specifiers in the aoflagger call or if you really want to preserve the old behaviour, include aoflagger inside transform_data with current strategies, before transforming it. Yet another option is to use new strategies which do a better job.
Answer 2: Don't really know of Tricolour is affected, @bennahugo would know best.
Also, it has been a while since I took at the gory details of the flagging worker, but should it not be flagging only the calibrators in the first round anyway? The target is flagged separately in flagging__2? We could add field specifiers in the aoflagger call or if you really want to preserve the old behaviour, include aoflagger inside transform_data with current strategies, before transforming it. Yet another option is to use new strategies which do a better job.
@KshitijT yes, the target is flagged separately. This issue is entirely about the flagging of the calibrators, not of the target.
The target is relevant because if you flag the secondary calibrator from an .MS which contains the target then the target separates the calibrator's scans, and AOflagger flags those scans independent of one another. On the contrary, if you flag the secondary from an .MS where there is no longer a target then AOflagger puts all calibrator's scans together before flagging them, which results in different flagging results -- as shown above.
Let me know whether that makes sense.
Also, it has been a while since I took at the gory details of the flagging worker, but should it not be flagging only the calibrators in the first round anyway? The target is flagged separately in flagging__2? We could add field specifiers in the aoflagger call or if you really want to preserve the old behaviour, include aoflagger inside transform_data with current strategies, before transforming it. Yet another option is to use new strategies which do a better job.
@KshitijT yes, the target is flagged separately. This issue is entirely about the flagging of the calibrators, not of the target.
The target is relevant because if you flag the secondary calibrator from an .MS which contains the target then the target separates the calibrator's scans, and AOflagger flags those scans independent of one another. On the contrary, if you flag the secondary from an .MS where there is no longer a target then AOflagger puts all calibrator's scans together before flagging them, which results in different flagging results -- as shown above.
Let me know whether that makes sense.
Yes, it makes sense, I was merely pointing out that we should be flagging only the calibrators in the first round anyway. Of course the presence of intervening scan seems to make a difference to aoflagger. From the case above, I am not sure aoflagger is actually doing a worse job - it might be that it flaggs better now, so do we want to go back to the old behaviour for flagging? In case we want to do that, we either need to change the flagging strategies or shift the aoflagger run to before mstransform run.
This is definitely a bug in AOflagger. It should respect scan boundaries, or at least be able to tell that there is missing time between the scans. @sjperkins tricolour will respect scan boundaries right?
Yes, it makes sense, I was merely pointing out that we should be flagging only the calibrators in the first round anyway.
But I was doing that. Sorry @KshitijT, I'm missing something! :(
Of course the presence of intervening scan seems to make a difference to aoflagger. From the case above, I am not sure aoflagger is actually doing a worse job - it might be that it flaggs better now, so do we want to go back to the old behaviour for flagging? In case we want to do that, we either need to change the flagging strategies or shift the aoflagger run to before mstransform run.
Well, I'm not really sure what the right thing to do is. I'm just not happy with the fact that there is a difference. :)
This is definitely a bug in AOflagger. It should respect scan boundaries, or at least be able to tell that there is missing time between the scans. @sjperkins tricolour will respect scan boundaries right?
Yes, it specifically partitions on SCAN_NUMBER, FIELD_ID and DATA_DESC_ID
This is definitely a bug in AOflagger. It should respect scan boundaries, or at least be able to tell that there is missing time between the scans. @sjperkins tricolour will respect scan boundaries right?
Yes, it specifically partitions on SCAN_NUMBER, FIELD_ID and DATA_DESC_ID
I can confirm that. I've just run the same test as above and with tricolour there is no difference between new and old workflow.
How is the quality of the flagged data from tricolour compared to AOFlagger? If the difference is not too big we should switch to tricolour. Or just replicate current flagging AOFlagger strategies in the tricolour standard and do the switch either way.
But I was doing that. Sorry @KshitijT, I'm missing something! :(
My bad, the cross cal does flag just calibrators. Sorry !
How is the quality of the flagged data from tricolour compared to AOFlagger? If the difference is not too big we should switch to tricolour. Or just replicate current flagging AOFlagger strategies in the tricolour standard and do the switch either way.
That'll take a while to establish. Anyway, on to learning about the Tricolour options in Caracal!
See if this still an issue with the new AOFlagger release
The new workflow implemented in https://github.com/ska-sa/meerkathi/pull/892 allows users to run the pipeline without ever modifying the input .MS. Among other things, the calibrators are first split off the input .MS, then flagged. This is different from the old workflow, where the calibrators were flagged from within the input .MS. (Note that the old workflow can still be used -- more below.)
The new workflow has consequences for the calibrators' flags. It results in AOflagger running on an .MS with no target scans in between calibrators scans. Secondary calibrator scans, which were originally separated by target scans, are now processed together by AOflagger, without respecting the original scan boundaries. This results in different flags compared to when the calibrators were flagged from the input .MS respecting the scan boundaries.
Below I compare the flags obtained with the two workflows.
New workflow config file:
New workflow pipeline run:
Old workflow config. file:
Old workflow pipeline run:
So the new workflow flags 31.7% of the secondary visibilities, compared to the 17% of the old workflow.
Below is a visual example for one particular baseline (left = new workflow; right = old workflow).
Two questions: is there a way to tell AOflagger to respect scan boundaries? Is this problem specific to AOflagger only, and Tricolour won't be affected?