HERA-Team / hera_pspec

HERA power spectrum estimation code and data formats
http://hera-pspec.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Adding uvpspec objects re-orders polarizations #405

Open jsdillon opened 3 weeks ago

jsdillon commented 3 weeks ago

I got an error trying to add together 3 or more uvpspec objects. When I add the first two together, it changes the order of polarizations, which then doesn't match the order in the 3rd object. This manifests in a AssertionError: scalar_array must be the same for all uvps given concatenation along blpairts. which presumably is a consequence of the scalar_array depending on the beam.

I found this by doing

print(uvps_time_avg[0].polpair_array)
print(uvps_time_avg[1].polpair_array)
print((uvps_time_avg[0] + uvps_time_avg[1]).polpair_array)

and got

[2424 2121 2323 2222]
[2424 2121 2323 2222]
[2121 2222 2323 2424]

which means that the order was pV, pI, pU, pQ before the sum and pI, pQ, pU, pV after.

The work around here is to just ensure that the UVData object going into power spectrum estimation has polarizations in numerical/alphabetical order. But this still feels like a bug to me.

jsdillon commented 3 weeks ago

@philbull I brought this up in today's pspec meeting and @acliu told me to tag you.