HERA-Team / hera_qm

HERA Data Quality Metrics
MIT License
2 stars 2 forks source link

Add `ant_class` module for classifying antennas based on absolute bounds for various metrics #419

Closed jsdillon closed 2 years ago

jsdillon commented 2 years ago

This PR adds a new module ant_class and the AntennaClassification object, which allows for the flexible categorization of ant-pol tuples.

It is initialized like AntennaClassification(good=[(0, 'Jee'), (1, 'Jee')], whatever=[(0, 'Jnn'), (10, 'Jee')]) and takes arbitrary categorizations. Allows setting and getting of a specific antenna's classification using [], as well as .ants and .classes properties and a .get_all(classification) function.

However, there are three special "quality" classifications (by default "good", "suspect", and "bad", but they can be modified) that are queried via the property e.g. .good_ants or the function .is_good(ant). Furthermore, these classifications the sensible enable combination of AntennaClassification objects by overloading + such that good + good = good, good + bad = bad, good + suspect = suspect, bad + suspect = bad, and bad + bad = bad.

This PR adds also a new function antenna_bounds_checker() to ant_class designed for turning scalar antenna metrics into AntennaClassification objects. This function is very general and I plan to add absolute limits checkers built on top of it.

This PR lays the groundwork for future absolute limits checking. Eventually, the goal here is to implement new absolute limit checking on antenna power, bandpass slope, etc. as has been prototyped by @AaronParsons in https://github.com/HERA-Team/hera_notebook_templates/blob/ef53071cfac322a6fe9d629d0ed508028bd1fe3c/notebooks/fastcal_inspect.ipynb

codecov[bot] commented 2 years ago

Codecov Report

Merging #419 (ae56f3f) into main (707d415) will decrease coverage by 0.03%. The diff coverage is 96.06%.

@@            Coverage Diff             @@
##             main     #419      +/-   ##
==========================================
- Coverage   96.92%   96.89%   -0.04%     
==========================================
  Files           9       10       +1     
  Lines        3256     3382     +126     
==========================================
+ Hits         3156     3277     +121     
- Misses        100      105       +5     
Impacted Files Coverage Δ
hera_qm/ant_class.py 96.00% <96.00%> (ø)
hera_qm/__init__.py 88.23% <100.00%> (+0.73%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 707d415...ae56f3f. Read the comment docs.

jsdillon commented 2 years ago

Ok, fixed. Thanks @tyler-a-cox!