EoRImaging / FHD

Fast Holographic Deconvolution
BSD 2-Clause "Simplified" License
20 stars 10 forks source link

Floating point truncation issue when reading header from uvfits #84

Open aelanman opened 7 years ago

aelanman commented 7 years ago

fhd_core/visibility_manipulation/vis_header_extract.pro

Frequency channel information is stored in uvfits headers in units of Hz. Pyuvdata currently allows for a precision in frequency information down to a mHz. Thus, a channel width or reference frequency can be specified by around 10 digits.

The trouble arises when the channel width is specified to Hz precision (CDELT4 in the uvfits header). Line 22 of vis_header_extract generates the full frequency array as 32 bit floats. But these can hold at most 6 or 7 digits. Specifying channel width to too high an accuracy will cause jumps in the frequency array due to the truncation. This will pass just fine in FHD, but pyuvdata will throw an error when reading the saved visibility files.

To avoid this --- Don't let CDELT4 be specified to Hz precision. Round it to the nearest 10Hz.

In the future, we may convert the frequency array to long ints, allowing for Hz precision without too much additional memory overhead.

aelanman commented 6 years ago

At Nichole's suggestion, I've run some tests on this recently. Until now, I've been using a version of pyuvdata that sidesteps the issue.

The last time I tried Ian's branch in PR 83, it didn't fix the issue, but now it seems to be working... So I'm going to review and merge the pull request and then close the issue.

aelanman commented 6 years ago

I spoke too soon. A recent test with Ian's fix still leads to unevenly-spaced frequency channels.