HERA-Team / hera_cal

Library for HERA data reduction, including redundant calibration, absolute calibration, and LST-binning.
MIT License
12 stars 8 forks source link

Speed up `expand_omni_sol` #831

Closed jsdillon closed 1 year ago

jsdillon commented 1 year ago

This PR speeds up expand_omni_sol by avoiding (if possible) a chi^2 calculation that's unnecessary under normal redcal operation (for example, when not using a min_bl_cut or max_bl_cut). It also adds a dictionary to a RedundantCalibrator object that prevents a lot of unnecessarily repeated list comprehension.

Here's the before:

image

(This takes 31.4 s on my laptop when not running inside snakeviz.)

Here's the after:

Screen Shot 2022-09-21 at 7 01 59 PM

(This takes 13.2 s on my laptop when not running inside snakeviz.)

codecov[bot] commented 1 year ago

Codecov Report

Base: 97.29% // Head: 97.15% // Decreases project coverage by -0.14% :warning:

Coverage data is based on head (da49a16) compared to base (8d7d090). Patch coverage: 100.00% of modified lines in pull request are covered.

:exclamation: Current head da49a16 differs from pull request most recent head c0ba658. Consider uploading reports for the commit c0ba658 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #831 +/- ## ========================================== - Coverage 97.29% 97.15% -0.15% ========================================== Files 16 18 +2 Lines 8067 8478 +411 ========================================== + Hits 7849 8237 +388 - Misses 218 241 +23 ``` | [Impacted Files](https://codecov.io/gh/HERA-Team/hera_cal/pull/831?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team) | Coverage Δ | | |---|---|---| | [hera\_cal/redcal.py](https://codecov.io/gh/HERA-Team/hera_cal/pull/831/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team#diff-aGVyYV9jYWwvcmVkY2FsLnB5) | `99.31% <100.00%> (+<0.01%)` | :arrow_up: | | [hera\_cal/apply\_cal.py](https://codecov.io/gh/HERA-Team/hera_cal/pull/831/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team#diff-aGVyYV9jYWwvYXBwbHlfY2FsLnB5) | `94.54% <0.00%> (ø)` | | | [hera\_cal/\_\_init\_\_.py](https://codecov.io/gh/HERA-Team/hera_cal/pull/831/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team#diff-aGVyYV9jYWwvX19pbml0X18ucHk=) | `91.30% <0.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=HERA-Team)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.