-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleAnalysis.py
More file actions
99 lines (84 loc) · 3.18 KB
/
ExampleAnalysis.py
File metadata and controls
99 lines (84 loc) · 3.18 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python
from PocarChroma.geometry_manager import GeometryManager
from PocarChroma.run_manager import RunManager
from PocarChroma.material_manager import MaterialManager
from PocarChroma.surface_manager import SurfaceManager
from PocarChroma.analysis_manager import AnalysisManager
# from PocarChroma.document_manager import document_manager
import time
import numpy as np
"""
Example showing how to run a simulation with a script file rather than from the command line.
Here perhaps include description of what the simulation is testing for archival reasons.
Run this file from within the Chroma container with `python ./ExampleAnalysis.py`
"""
def main():
experiment_name = "8Silicon35_87"
num_particles = 2_000_000
seed = np.random.randint(0,10000)
plots = [
# "plot_all_tracks" ,
# "plot_detected_tracks" ,
# "plot_undetected_tracks" ,
# "plot_reflected_tracks" ,
# "plot_filtered_scattered_tracks" ,
# "plot_detected_reflected_tracks" ,
# "plot_specular_reflected_tracks" ,
# "plot_diffuse_reflected_tracks" ,
# "plot_refl_multiplicity" ,
# "photon_shooting_angle" ,
# "photon_incident_angle_emission_angle_correlation" ,
# "plot_angle_hist" ,
# "plot_refl_angle" ,
# "plot_position_hist" ,
]
# e = [1, 2, 3, 4, 5, 6, 7, 8] #exclude outer
# e = [2, 3, 4, 5, 6, 7, 8, 9] #exclude outer
# e = [4,6,7,8] # excludes short silicon outer
# e = [9, 10, 11, 12, 13, 14, 15, 16] #exclude outer
e = [1, 3, 5, 7] #exclude outer
e = [f"reflector{i}" for i in e]
# e = None
# e = ["copper reflector"]
print(f"Experiment Name: {experiment_name}")
print(f"Number of particles: {num_particles}")
print(f"Random seed: {seed}")
print(f"Plots: {plots}")
print(f"Exclusions: {e}")
mm = MaterialManager(experiment_name=experiment_name)
sm = SurfaceManager(material_manager = mm, experiment_name = experiment_name)
gm = GeometryManager(experiment_name=experiment_name,surf_manager = sm)
rm = RunManager(geometry_manager=gm,random_seed=seed, num_particles=num_particles, batch_size = 2_500_000)
photons, photon_tracks, particle_histories = rm.get_simulation_results()
am = AnalysisManager(
gm,
experiment_name,
plots,
photons,
photon_tracks,
seed,
particle_histories,
save = False,
show = False,
print = True,
)
photons, photon_tracks, particle_histories = rm.get_simulation_results()
am = AnalysisManager(
gm,
experiment_name,
plots,
photons,
photon_tracks,
seed,
particle_histories,
save = False,
show = False,
print = True,
)
# dm = document_manager(am, LABEL)
# dm.compile()
if __name__ == "__main__":
s = time.time()
main()
e = time.time()
print(f"The simulation run time is: {e - s} s")