-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestPlugin.py
46 lines (36 loc) · 1.08 KB
/
testPlugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import sys
from crpropa import *
sys.path.append('build')
import grplinst as plinst
ebl = IRB_Gilmore12()
cmb = CMB()
z = 0.14 # 1ES 0209+200
nIGM = 1e-7 # cm^-3
L = 1e38 # W
T = 1e5 # K
model = 'C'
obs = Observer()
obs.add(ObserverPoint())
output = TextOutput('test.txt', Output.Event1D)
output.setEnergyScale(eV)
output.set(output.WeightColumn, True)
obs.onDetection(output)
sim = ModuleList()
sim.add(SimplePropagation(1e-10 * kpc, 10 * kpc))
sim.add(Redshift())
sim.add(EMPairProduction(cmb, True))
sim.add(EMPairProduction(ebl, True))
sim.add(EMInverseComptonScattering(cmb, True))
sim.add(EMInverseComptonScattering(ebl, True))
sim.add(plinst.PlasmaInstability(nIGM, T, L, model))
sim.add(MaximumTrajectoryLength(4000 * Mpc))
sim.add(MinimumEnergy(1e9 * eV))
sim.add(obs)
source = Source()
source.add(SourcePowerLawSpectrum(1e9 * eV, 1e14 * eV, -1))
source.add(SourceParticleType(22))
source.add(SourcePosition(Vector3d(redshift2ComovingDistance(z), 0, 0)))
source.add(SourceRedshift1D())
source.add(SourceDirection(Vector3d(-1, 0, 0)))
sim.setShowProgress(True)
sim.run(source, 10000, True)