RadioAstronomySoftwareGroup / pyuvsim

A ultra-high precision package for simulating radio interferometers in python on compute clusters.
https://pyuvsim.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
42 stars 7 forks source link

pyuvsim ignoring (and not updating) `UVData.uvw_array` #473

Closed kartographer closed 4 months ago

kartographer commented 5 months ago

I stumbled upon an interesting feature when helping out a user who was running into an issue taking a UVData object from a prior observation, passing it through pyuvsim, and then writing out the result as an MS file (via the UVData.write_ms method). Long story short, what we found was that when passing a UVData object, run_uvdata_uvsim does not use the uvw_array values for calculating the interferometer response, favoring instead using the antenna positions to internally generate ENUs (and then calculating fringe response from there). This would be fine, except that run_uvdata_uvsim does not appear to update uvw_array when it returns the object, which means that an object with incorrect uvw coordinates gets passed back.

At a minimum it would be helpful to raise an error when the values in uvw_array are not consistent w/ the antenna position-based values, though I think a better solution would be to simply overwrite the uvw_array values and wipe out any info on the phase centers (though I don't know the downstream ramifications of this, and figure this is a question for a more experienced dev/user to address). Happy to a write up a PR if someone wants to recommend which path to take.

mkolopanis commented 5 months ago

Yeah great catch. I can see why this happens. In the case where pyuvim creates the uvdata object, it has already set the uvws before calling run_uvdata_uvsim to populate the data array. It already assumes the object has the desired uvws.