Commit ea4d05d0 authored by teresa.bister's avatar teresa.bister
Browse files

[simulations] soften need for crpropa installation / give redshift through attenuate_matrix

parent c4f37db3
Pipeline #412029 canceled with stages
......@@ -617,9 +617,13 @@ class SourceBound(BaseSimulation):
library_path = PATH + '/simulation/crpropa3__emin_18.5__emax_21.0__IRB_Gilmore12.npz'
data = np.load(library_path, allow_pickle=True)
self.dis_bins, self.log10e_bins = data['distances'], data['log10e_bins']
if evolution != 0:
import crpropa as crp
self.redshift_bins = np.array([crp.comovingDistance2Redshift(dis * crp.Mpc) for dis in self.dis_bins])
try:
self.redshift_bins = data['redshift']
print(self.redshift_bins)
except KeyError: # only needed if simulation with not flat evolution is wanted
if evolution != 0:
import crpropa as crp
self.redshift_bins = np.array([crp.comovingDistance2Redshift(dis * crp.Mpc) for dis in self.dis_bins])
if self.universe.has_sources():
# Assign distance indices for all simulated soures, shape: (self.nsets, self.universe.n_src)
dis_bin_idx = self.universe.distance_indices(self.dis_bins)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment