Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/continous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down
10 changes: 4 additions & 6 deletions flarestack/core/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ def f(x, a, b, c):

# this trick could be replaced by calling f on the vector of best fit parameters
best_f = None
interpolated_flux = np.nan

try:
res = scipy.optimize.curve_fit(
Expand All @@ -739,13 +740,10 @@ def best_f(x):
# estimate the solution flux
interpolated_flux = scipy.stats.gamma.ppf(0.5, best_a, best_b, best_c)

# "disc_potential" and "disc_potential_25" attributes are set here
# use of `setattr` makes the code a bit obscure and could be improved
discovery_flux[zval] = k_to_flux(interpolated_flux)

except RuntimeError as e:
logger.warning(f"RuntimeError for discovery potential!: {e}")
# interpolated_flux = np.nan

discovery_flux[zval] = k_to_flux(interpolated_flux)

# now plot the whole ordeal
xrange = np.linspace(0.0, 1.1 * max(x), 1000)
Expand All @@ -765,7 +763,7 @@ def best_f(x):
ax1.axvline(k_to_flux(interpolated_flux), lw=2, color="red")
ax1.set_ylim(0.0, 1.0)
ax1.set_xlim(0.0, k_to_flux(max(xrange)))
ax1.set_ylabel(r"Overfluctuations relative to f{zval}$\sigma$ threshold")
ax1.set_ylabel(rf"Overfluctuations relative to {zval}$\sigma$ threshold")
plt.xlabel(r"Flux Normalisation @ 1GeV [ GeV$^{-1}$ cm$^{-2}$ s$^{-1}$]")

if not np.isnan(self.flux_to_ns):
Expand Down
Loading