Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 13, 2024
1 parent e32d49d commit b0fb1ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion strax/processing/hitlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ def _conditional_entropy(hitlets, template, flat=False, square_data=False):
import numba
import strax


@export
@numba.njit(cache=True)
def _compute_simple_edges(interval_indices, dt):
Expand All @@ -511,6 +512,7 @@ def _compute_simple_edges(interval_indices, dt):
right = interval_indices[1, np.argmax(interval_indices[1, :])] * dt
return left, right


@export
@numba.njit(cache=True)
def _compute_fractional_edges(interval_indices, data, area_fraction_amplitude, dt):
Expand All @@ -535,6 +537,7 @@ def _compute_fractional_edges(interval_indices, data, area_fraction_amplitude, d
right_edge = (right + 0.5 + fr) * dt
return left_edge, right_edge


@export
def highest_density_region_width(
data, fractions_desired, dt=1, fractional_edges=False, _buffer_size=100
Expand All @@ -551,6 +554,7 @@ def highest_density_region_width(
Returns:
np.ndarray: Array of shape (len(fractions_desired), 2) containing left and right edges
"""
res = np.zeros((len(fractions_desired), 2), dtype=np.float32)
data = np.maximum(data, 0)
Expand Down Expand Up @@ -581,7 +585,8 @@ def highest_density_region_width(
res[index_area_fraction, 1] = right
else:
left, right = _compute_fractional_edges(
interval_indices, data, area_fraction_amplitude, dt)
interval_indices, data, area_fraction_amplitude, dt
)
res[index_area_fraction, 0] = left
res[index_area_fraction, 1] = right

Expand Down

0 comments on commit b0fb1ce

Please sign in to comment.