Skip to content

Commit

Permalink
Allow short simulations to be performed
Browse files Browse the repository at this point in the history
  • Loading branch information
sgriswol committed Jul 1, 2024
1 parent 05969ba commit 1265b7a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/asteria/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1265b7a

Please sign in to comment.