Closed steven-murray closed 1 year ago
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
A more robust, but still a bit hacky, way to handle this would be to replace any gains equal to 0 with 1s (not necessarily for all times and frequencies) and to make sure that anywhere you do that it's also flagged in the gains (and if it wasn't flagged, we'll have to figure out what to do about the visibility solutions).
Still, it'd be nice to know precisely what's causing the issue. What failure mode is being caught in this way?
I think what you suggest makes sense, and will be a little more robust. My only question would be whether we should instead remove this class of flagged antennas from being expanded into later in the notebook (this was flagged on the even_odd_zeros_checker
). But perhaps that checker flags ants that are less bad than this one turned out to be, and we don't always want to completely exclude them. In that case, maybe there should just be another flagger towards the start that checks for this catastrophic case.
I've implemented this solution in dfa52379eeb0c8a314e2126b144207646a357b70. Sorry to bypass your PR.
As you noted on Slack, this issue arises in a strange edge case where antenna cross-correlations are all 0 but auto-correlations are not. When autos are 0, the noise on the visibility is zero, so it gets infinite weight which leads to nans/infs in the gains, which are separately handled. In this case, the weight is finite so 0 is in some sense the proper gain solution for these already flagged antennas. But since that creates problems elsewhere, I've just set the gains to 1 and made sure that they are flagged.
I was having a problem where some gains were completely zero after expanding the solutions to flagged antennas. I tried to fix this at the lower level in
hera_cal
but ended up causing other problems. This fix to the notebook does the job (but perhaps @jsdillon you know a better way to achieve this)