Skip to content

Commit

Permalink
retire energy flux per source
Browse files Browse the repository at this point in the history
  • Loading branch information
mlincett committed Jan 10, 2023
1 parent 47b32d8 commit 38f26c4
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions flarestack/core/unblinding.py
Expand Up @@ -237,11 +237,13 @@ def calculate_upper_limits(self):

flux_uls = []
fluence_uls = []
e_per_source_uls = []
energy_flux = []
x_axis = []

# e_per_source_uls = []

for subdir in sorted(os.listdir(self.pickle_dir)):
# this is a loop over different `gamma` values!

root = os.path.join(self.unblind_dict["background_ts"], subdir)

Expand Down Expand Up @@ -316,9 +318,10 @@ def calculate_upper_limits(self):

fluence_uls.append(astro_dict[key] * inj_time)

e_per_source_uls.append(
astro_dict["Mean Luminosity (erg/s)"] * inj_time
)
# this functionality has been retired
# e_per_source_uls.append(
# astro_dict["Mean Luminosity (erg/s)"] * inj_time
# )

energy_flux.append(astro_dict[key])
x_axis.append(float(subdir))
Expand All @@ -345,10 +348,10 @@ def calculate_upper_limits(self):

plt.figure()
ax1 = plt.subplot(111)
ax2 = ax1.twinx()
# ax2 = ax1.twinx()

ax1.plot(x_axis, fluence_uls, marker="o")
ax2.plot(x_axis, e_per_source_uls, marker="o")
# ax2.plot(x_axis, e_per_source_uls, marker="o")

if self.mock_unblind:
ax1.text(
Expand All @@ -360,16 +363,20 @@ def calculate_upper_limits(self):
transform=ax1.transAxes,
)

ax2.grid(True, which="both")
ax1.grid(True, which="both")
# ax2.grid(True, which="both")
ax1.set_xlabel("Gamma")
ax2.set_xlabel("Gamma")
# ax2.set_xlabel("Gamma")
ax1.set_ylabel(r"Total Fluence [GeV cm$^{-2}$ s$^{-1}$]")
ax2.set_ylabel(r"Isotropic-Equivalent Luminosity $L_{\nu}$ (erg/s)")
# ax2.set_ylabel(r"Isotropic-Equivalent Luminosity $L_{\nu}$ (erg/s)")
ax1.set_yscale("log")
ax2.set_yscale("log")
# ax2.set_yscale("log")

axes = [ax1] # was: axes = [ax1, ax2]
ordinates = [fluence_uls] # was: [fluence_uls, e_per_source_uls]

for k, ax in enumerate([ax1, ax2]):
y = [fluence_uls, e_per_source_uls][k]
for k, ax in enumerate(axes):
y = ordinates[k]
ax.set_ylim(0.95 * min(y), 1.1 * max(y))

plt.tight_layout()
Expand All @@ -387,7 +394,7 @@ def calculate_upper_limits(self):
"flux": flux_uls,
"energy_flux": energy_flux,
"fluence": fluence_uls,
"energy": e_per_source_uls,
# "energy": e_per_source_uls,
}

with open(self.limit_path, "wb") as f:
Expand Down

0 comments on commit 38f26c4

Please sign in to comment.