RadioAstronomySoftwareGroup / pyuvdata

A pythonic interface for radio astronomy interferometry data (uvfits, miriad, others)
https://pyuvdata.readthedocs.io/en/latest/index.html
BSD 2-Clause "Simplified" License
82 stars 27 forks source link

External phasing test fails #148

Closed adampbeardsley closed 6 years ago

adampbeardsley commented 7 years ago

We received a couple test files from David Kaplan to check our phasing code. I created a branch (phasing_test) to incorporate those files into our unittests. That passes, but only because I downselected the files to a single baseline which happens to line up well enough. However, when I test the full files, phasing does not work. Here's what I'm doing: We have two files, which I have converted to uvfits, and are located on enterprise at: /data4/beards/phasing_test_data/1133866760.uvfits /data4/beards/phasing_test_data/1133866760_rephase.uvfits The first, according to DK is phased to 01h39m00.0s -17d57m00s, and the second is phased to 00h00m00.0s -18d00m00s.

Ideally I would like to read in both files, phase the first to the second's phase center, and they should be equal. They are not equal, and in fact very much different. So instead let's try to unphase both to drift, which results in a much closer result, but still not equal. After reading in the files:

>>> uv1.unphase_to_drift()
>>> uv2.unphase_to_drift()
>>> uv1 == uv2
data_array parameter value is array, values are not close
uvw_array parameter value is array, values are not close
False

I thought maybe the flagged data were not flagged in DK's file, so I zeroed flagged data:

>>> uv1.data_array *= (1 - uv1.flag_array.astype(np.float64))
>>> uv2.data_array *= (1 - uv2.flag_array.astype(np.float64))
>>> uv1 == uv2
data_array parameter value is array, values are not close
uvw_array parameter value is array, values are not close
False

The uvw values being different is indicative of an incorrect rotation. So how different are they? Plotting the difference between the two objects vs the value from the second. image image image

adampbeardsley commented 7 years ago

Ah, the plot makes more sense when I do magnitude(du) vs magnitude(u). image

adampbeardsley commented 7 years ago

Here's another fun one: image

bhazelton commented 6 years ago

I believe this test now passes in PR #287 (to the accuracy I'd expect given the data files are sourced from MWA code that has some precision limits). The notebook that demonstrates this is here: https://github.com/bhazelton/random_stuff/blob/master/jupyter_notebooks/external_phasing_test.ipynb