From 1265b7a8ce01ee608b8162b4eed86fb64e70258a Mon Sep 17 00:00:00 2001 From: Spencer Griswold Date: Mon, 1 Jul 2024 15:58:05 -0400 Subject: [PATCH] Allow short simulations to be performed --- python/asteria/simulation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/asteria/simulation.py b/python/asteria/simulation.py index 9084673..6b1f6e2 100644 --- a/python/asteria/simulation.py +++ b/python/asteria/simulation.py @@ -312,11 +312,14 @@ def compute_energy_per_vol(self, *, part_size=1000): idx = 0 # Perform integration over spectrum - if part_size < self.time.size: + if part_size <= self.time.size: for idx in np.arange(0, self.time.size, part_size): spectrum = self.get_combined_spectrum(self.time[idx:idx + part_size], self.energy, flavor, self._mixing) result[idx:idx + part_size] = np.trapz(spectrum, self.energy.value, axis=1) + else: + spectrum = self.get_combined_spectrum(self.time, self.energy, flavor, self._mixing) + result = np.trapz(spectrum, self.energy.value, axis=1) result *= ( H2O_in_ice * # Target Molecule (H2O) density