Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for event weights when calculating percentile cuts #225

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

gschwefer
Copy link

Pull request implementing issue #224 . Solution as described there, the weighted quantile function is custom.

@codecov
Copy link

codecov bot commented Apr 19, 2023

Codecov Report

Patch coverage: 98.00% and project coverage change: +0.15 🎉

Comparison is base (52e1297) 92.46% compared to head (b4783af) 92.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #225      +/-   ##
==========================================
+ Coverage   92.46%   92.62%   +0.15%     
==========================================
  Files          49       49              
  Lines        2005     2048      +43     
==========================================
+ Hits         1854     1897      +43     
  Misses        151      151              
Impacted Files Coverage Δ
pyirf/cuts.py 96.82% <94.73%> (+0.99%) ⬆️
pyirf/tests/test_cuts.py 99.09% <100.00%> (+0.31%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -44,9 +92,14 @@ def calculate_percentile_cut(
min_events: int
Bins with less events than this number are replaced with ``fill_value``
"""

if weights is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer it (and it's probably also faster) if the weights=None case would use the existing code instead of the weighted_quantile method with weights=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants