Don't throw exceptions when freq is off
This exception is triggered in some legitimate cases inside WSClean (reported by Bjorn A)
Merge request reports
Activity
requested review from @dijkema
assigned to @offringa
Maybe a check should be done at a higher level, not so deep like this. Use case: If you image two measurement sets with different frequencies and with multiple output channels, wsclean can ask for solutions that belong to all channels of the band but that are not in that particular measurement set. The freq grid then not necessarily matches the measurement set (is what I found out empirically, not saying I completely understand what happens). WSClean expects than that the nearest neighbour is returned.
Making the exception optional is possible but does require quite some propagation of the parameter (because it is so deep). This would then in the end be an extra parameter to the JonesParameters constructor. Another alternative is to add a function somewhere that performs (just) the check. This is imho a bit cleaner but requires changes at the caller's side. Happy to hear other solutions too though ;).
I don't think I understand the use case. If you have two MSs to be imaged, I imagine you also have two H5Parms with the solutions for them (if you have one H5Parm with the combined solution the problem would not occur). You would not want the solutions of the one subband to be applied to the other subband. The frequency grid does not need to match, currently it is just checked that solutions are not applied outside the frequency range from which they were deduced.
If you want to stretch the validity range in the H5Parm, the following lines would do:
import h5py def stretch_freqs(name, node): """ Overwrite first frequency with 0Hz and last with 1GHz""" if name.split("/")[-1] == "freq": node[0] = 0 # Hz node[-1] = 1e9 # Hz with h5py.File('my.h5', 'r+') as f: f.visititems(stretch_freqs)
I though I understood the reason for this occurring but it turned out to be a bit different
(so thanks for being persistent ;) ). I thought that if MS A had band B and MS C had higher band D, that an output channel that crossed the boundary of band B would cause this, but this isn't the case after all.It turns out there was an indexing problem in WSClean: in the gridder a measurement list could be filtered if it would fall outside the output channel's freq range, but it would still index the solution files as if the measurement set weren't filtered. I've fixed this in https://gitlab.com/aroffringa/wsclean/-/merge_requests/694 . I'll close this MR.