Skip to content

Commit

Permalink
Merge pull request #266 from cta-observatory/doc-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobychev authored Oct 30, 2023
2 parents 5346e00 + fdd61c2 commit 58b65a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/changes/266.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarified some documentation.
9 changes: 7 additions & 2 deletions pyirf/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ def create_bins_per_decade(e_min, e_max, bins_per_decade=5):

def calculate_bin_indices(data, bins):
"""
Calculate bin indices for given data array and bins.
Underflow will be `UNDERFLOW_INDEX` and overflow `OVERFLOW_INDEX`.
Calculate bin indices of inidividula entries of the given data array using
the supplied binning. Underflow will be indicated by `UNDERFLOW_INDEX` and
overflow by `OVERFLOW_INDEX`.
If the bins already include underflow / overflow bins, e.g.
`bins[0] = -np.inf` and `bins[-1] = np.inf`, using the result of this
Expand All @@ -152,6 +153,10 @@ def calculate_bin_indices(data, bins):
Indices of the histogram bin the values in data belong to.
Under- and overflown values will have values of `UNDERFLOW_INDEX`
and `OVERFLOW_INDEX` respectively.
valid: np.ndarray[bool]
Boolean mask indicating if a given value belongs into one of the defined bins.
False indicates that an entry fell into the over- or underflow bins.
"""

if hasattr(data, "unit"):
Expand Down
7 changes: 7 additions & 0 deletions pyirf/cuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ def evaluate_binned_cut(values, bin_values, cut_table, op):
A function taking two arguments, comparing element-wise and
returning an array of booleans.
Must support vectorized application.
Returns
-------
result: np.ndarray[bool]
A mask for each entry in ``values`` indicating if the event
passes the bin specific cut given in cut table.
"""
if not isinstance(cut_table, QTable):
raise ValueError('cut_table needs to be an astropy.table.QTable')
Expand Down

0 comments on commit 58b65a7

Please sign in to comment.