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

Implement `pol_convention` in `pstokes` module #404

Closed adeliegorce closed 1 month ago

adeliegorce commented 1 month ago

This PR introduces some changes to the pstokes module for two purposes

  1. Take into account the new pol_convention attribute of UVData objects (see this PR) when constructing pseudo-Stokes polarizations whilst ensuring backwards compatibility (if there is no pol_convention, then there is a warning and avg is assumed). This is commit 6ffd0dc.
  2. As per @jsdillon's request, create a new method called _combine_pol_arrays (final name still open to debate) which takes lists of data, flags, and nsamples arrays and combines them into pseudo-Stokes following the appropriate pol_convention (i.e. avg and sum). Although I see how useful this method can be, it does make the code slightly heavy so, reviewers, please let me know if you have any suggestions on how to make things cleaner. This is commit 2601670. I added new tests and modified existing ones accordingly.
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 97.72727% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.09%. Comparing base (8950367) to head (7a030d4).

Files Patch % Lines
hera_pspec/pstokes.py 97.72% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #404 +/- ## ======================================= Coverage 96.09% 96.09% ======================================= Files 17 17 Lines 6121 6152 +31 ======================================= + Hits 5882 5912 +30 - Misses 239 240 +1 ``` | [Flag](https://app.codecov.io/gh/HERA-Team/hera_pspec/pull/404/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/HERA-Team/hera_pspec/pull/404/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team) | `96.09% <97.72%> (+<0.01%)` | :arrow_up: | 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.

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

adeliegorce commented 1 month ago

Hi @jsdillon, I made the requested changes. Let me know if you're happy with the new version.

adeliegorce commented 1 month ago

Done!

jsdillon commented 1 month ago

Looks good, thanks @adeliegorce!