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

Fix residual issues with future_array_shapes affecting noise calculation #386

Closed jsdillon closed 1 year ago

jsdillon commented 1 year ago

This PR replaces a couple of lingering freq_array[0] with np.squeeze() which works for both past and future array shapes.

I've added a unit test that fails on the current main branch and passes (I hope!) on this branch.

Finally, while searching the repo for freq_array[0] I found a couple of calculations of delta nu that aren't quite right (they take the middle freq of the first and last bin and divide by the number of bins, when really want you want to do is a diff... that calculation will be wrong by a factor of 2 in the limit where there are only 2 frequency channels). So I fixed those too.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f716161) 95.99% compared to head (f3f271d) 95.99%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #386 +/- ## ======================================= Coverage 95.99% 95.99% ======================================= Files 17 17 Lines 6113 6113 ======================================= Hits 5868 5868 Misses 245 245 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `95.99% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/HERA-Team/hera_pspec/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team) | Coverage Δ | | |---|---|---| | [hera\_pspec/utils.py](https://app.codecov.io/gh/HERA-Team/hera_pspec/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team#diff-aGVyYV9wc3BlYy91dGlscy5weQ==) | `91.02% <100.00%> (ø)` | | | [hera\_pspec/uvwindow.py](https://app.codecov.io/gh/HERA-Team/hera_pspec/pull/386?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team#diff-aGVyYV9wc3BlYy91dndpbmRvdy5weQ==) | `98.16% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.