Skip to content

Commit c32a7bf

Browse files
committed
Deleted all benchmarks except montecarlo numba and tardis;
1 parent 5d364e8 commit c32a7bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+372
-4691
lines changed

benchmarks/benchmark_base.py

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def get_absolute_path(self, partial_path):
5050

5151
@property
5252
def tardis_config_verysimple(self):
53-
filename = self.get_absolute_path("tardis/io/configuration/tests/data/tardis_configv1_verysimple.yml")
53+
filename = self.get_absolute_path(
54+
"tardis/io/configuration/tests/data/tardis_configv1_verysimple.yml"
55+
)
5456
return yaml_load_file(
5557
filename,
5658
YAMLLoader,
@@ -60,7 +62,7 @@ def tardis_config_verysimple(self):
6062
def tardis_ref_path(self):
6163
# TODO: This route is fixed but needs to get from the arguments given in the command line.
6264
# /app/tardis-refdata
63-
return '/app/tardis-refdata'
65+
return "/app/tardis-refdata"
6466

6567
@property
6668
def atomic_dataset(self) -> AtomData:
@@ -74,10 +76,15 @@ def atomic_dataset(self) -> AtomData:
7476

7577
@property
7678
def atomic_data_fname(self):
77-
atomic_data_fname = f"{self.tardis_ref_path}/atom_data/kurucz_cd23_chianti_H_He.h5"
79+
atomic_data_fname = (
80+
f"{self.tardis_ref_path}/atom_data/kurucz_cd23_chianti_H_He.h5"
81+
)
7882

7983
if not Path(atomic_data_fname).exists():
80-
atom_data_missing_str = f"{atomic_data_fname} atomic datafiles " f"does not seem to exist"
84+
atom_data_missing_str = (
85+
f"{atomic_data_fname} atomic datafiles "
86+
f"does not seem to exist"
87+
)
8188
raise Exception(atom_data_missing_str)
8289

8390
return atomic_data_fname
@@ -92,22 +99,24 @@ def hdf_file_path(self):
9299
# ASV create a temporal directory in runtime per test: `tmpiuxngvlv`.
93100
# The ASV and ASV_Runner, not has some way to get this temporal directory.
94101
# The idea is use this temporal folders to storage this created temporal file.
95-
_, path = mkstemp('-tardis-benchmark-hdf_buffer-test.hdf')
102+
_, path = mkstemp("-tardis-benchmark-hdf_buffer-test.hdf")
96103
return path
97104

98105
def create_temporal_file(self, suffix=None):
99106
# TODO: Delete this files after ASV runs the benchmarks.
100107
# ASV create a temporal directory in runtime per test: `tmpiuxngvlv`.
101108
# The ASV and ASV_Runner, not has some way to get this temporal directory.
102109
# The idea is use this temporal folders to storage this created temporal file.
103-
suffix_str = '' if suffix is None else f'-{suffix}'
110+
suffix_str = "" if suffix is None else f"-{suffix}"
104111
_, path = mkstemp(suffix_str)
105112
return path
106113

107114
@property
108115
def gamma_ray_simulation_state(self):
109116
self.gamma_ray_config.model.structure.velocity.start = 1.0 * u.km / u.s
110-
self.gamma_ray_config.model.structure.density.rho_0 = 5.0e2 * u.g / u.cm ** 3
117+
self.gamma_ray_config.model.structure.density.rho_0 = (
118+
5.0e2 * u.g / u.cm**3
119+
)
111120
self.gamma_ray_config.supernova.time_explosion = 150 * u.d
112121

113122
return SimulationState.from_config(
@@ -116,9 +125,7 @@ def gamma_ray_simulation_state(self):
116125

117126
@property
118127
def gamma_ray_config(self):
119-
yml_path = (
120-
f"{self.example_configuration_dir}/tardis_configv1_density_exponential_nebular_multi_isotope.yml"
121-
)
128+
yml_path = f"{self.example_configuration_dir}/tardis_configv1_density_exponential_nebular_multi_isotope.yml"
122129

123130
return config_reader.Configuration.from_yaml(yml_path)
124131

@@ -137,7 +144,9 @@ def example_csvy_file_dir(self):
137144
@property
138145
def simulation_verysimple(self):
139146
atomic_data = deepcopy(self.atomic_dataset)
140-
sim = Simulation.from_config(self.config_verysimple, atom_data=atomic_data)
147+
sim = Simulation.from_config(
148+
self.config_verysimple, atom_data=atomic_data
149+
)
141150
sim.iterate(4000)
142151
return sim
143152

@@ -149,11 +158,11 @@ def config_verysimple(self):
149158

150159
class CustomPyTestRequest:
151160
def __init__(
152-
self,
153-
tardis_regression_data_path: str,
154-
node_name: str,
155-
node_module_name: str,
156-
regression_data_dir: str,
161+
self,
162+
tardis_regression_data_path: str,
163+
node_name: str,
164+
node_module_name: str,
165+
regression_data_dir: str,
157166
):
158167
self.tardis_regression_data_path = tardis_regression_data_path
159168
self.node_name = node_name
@@ -165,7 +174,7 @@ def config(self):
165174
class SubClass:
166175
@staticmethod
167176
def getoption(option):
168-
if option == '--tardis-regression-data':
177+
if option == "--tardis-regression-data":
169178
return self.tardis_regression_data_path
170179
return None
171180

@@ -190,6 +199,7 @@ def __init__(self, parent):
190199
@property
191200
def __name__(self):
192201
return self.parent.node_module_name
202+
193203
return SubSubClass(self.parent)
194204

195205
return SubClass(self)
@@ -219,12 +229,16 @@ def packet(self):
219229

220230
@property
221231
def verysimple_packet_collection(self):
222-
return self.nb_simulation_verysimple.transport.transport_state.packet_collection
232+
return (
233+
self.nb_simulation_verysimple.transport.transport_state.packet_collection
234+
)
223235

224236
@property
225237
def nb_simulation_verysimple(self):
226238
atomic_data = deepcopy(self.atomic_dataset)
227-
sim = Simulation.from_config(self.config_verysimple, atom_data=atomic_data)
239+
sim = Simulation.from_config(
240+
self.config_verysimple, atom_data=atomic_data
241+
)
228242
sim.iterate(10)
229243
return sim
230244

@@ -238,7 +252,8 @@ def verysimple_numba_model(self):
238252
@property
239253
def verysimple_opacity_state(self):
240254
return opacity_state_initialize(
241-
self.nb_simulation_verysimple.plasma, line_interaction_type="macroatom"
255+
self.nb_simulation_verysimple.plasma,
256+
line_interaction_type="macroatom",
242257
)
243258

244259
@property
@@ -275,13 +290,17 @@ def verysimple_3vpacket_collection(self):
275290

276291
@property
277292
def verysimple_numba_radial_1d_geometry(self):
278-
return self.nb_simulation_verysimple.simulation_state.geometry.to_numba()
293+
return (
294+
self.nb_simulation_verysimple.simulation_state.geometry.to_numba()
295+
)
279296

280297
@property
281298
def simulation_verysimple_vpacket_tracking(self):
282299
atomic_data = deepcopy(self.atomic_dataset)
283300
sim = Simulation.from_config(
284-
self.config_verysimple, atom_data=atomic_data, virtual_packet_logging=True
301+
self.config_verysimple,
302+
atom_data=atomic_data,
303+
virtual_packet_logging=True,
285304
)
286305
sim.last_no_of_packets = 4000
287306
sim.run_final()
@@ -304,5 +323,7 @@ def tardis_ref_data(self):
304323
mode = "w"
305324
else:
306325
mode = "r"
307-
with pd.HDFStore(f"{self.tardis_ref_path}/unit_test_data.h5", mode=mode) as store:
326+
with pd.HDFStore(
327+
f"{self.tardis_ref_path}/unit_test_data.h5", mode=mode
328+
) as store:
308329
yield store

benchmarks/benchmark_template.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

benchmarks/energy_input_energy_source.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

benchmarks/energy_input_gamma_ray_grid.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

benchmarks/energy_input_gamma_ray_interactions.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)