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 Dec 13, 2024
1 parent 09eb1a1 commit 68f0c5e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/simweights/_weighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,21 @@ def effective_area(
effective_area_binned = np.asarray(hist_val / (e_width * 2 * np.pi * z_width * nspecies), dtype=np.float64)
elif callable(flux):
flux_pdgids = [pdgid.value for pdgid in flux.pdgids]

Check warning on line 209 in src/simweights/_weighter.py

View check run for this annotation

Codecov / codecov/patch

src/simweights/_weighter.py#L208-L209

Added lines #L208 - L209 were not covered by tests

def flux_func(energy: ArrayLike) -> NDArray[np.float64]:
return sum(flux._funcs[flux_pdgids.index(np.unique(self.get_weight_column("pdgid")[maska])[i_species])](energy) for i_species in range(nspecies))
return sum(

Check warning on line 212 in src/simweights/_weighter.py

View check run for this annotation

Codecov / codecov/patch

src/simweights/_weighter.py#L211-L212

Added lines #L211 - L212 were not covered by tests
flux._funcs[flux_pdgids.index(np.unique(self.get_weight_column("pdgid")[maska])[i_species])](energy)
for i_species in range(nspecies)
)

from scipy.integrate import quad

Check warning on line 217 in src/simweights/_weighter.py

View check run for this annotation

Codecov / codecov/patch

src/simweights/_weighter.py#L217

Added line #L217 was not covered by tests
flux_integrals = np.asarray([quad(flux_func, energy_bins[bin_index], energy_bins[bin_index+1])[0] for bin_index in range(len(energy_bins)-1)])

flux_integrals = np.asarray(

Check warning on line 219 in src/simweights/_weighter.py

View check run for this annotation

Codecov / codecov/patch

src/simweights/_weighter.py#L219

Added line #L219 was not covered by tests
[
quad(flux_func, energy_bins[bin_index], energy_bins[bin_index + 1])[0]
for bin_index in range(len(energy_bins) - 1)
]
)
e_width, z_width = np.meshgrid(flux_integrals, np.ediff1d(czbin))
effective_area_binned = np.asarray(1e-4 * hist_val / (e_width * 2 * np.pi * z_width), dtype=np.float64)

Check warning on line 226 in src/simweights/_weighter.py

View check run for this annotation

Codecov / codecov/patch

src/simweights/_weighter.py#L225-L226

Added lines #L225 - L226 were not covered by tests
else:
Expand Down

0 comments on commit 68f0c5e

Please sign in to comment.