@@ -99,6 +99,19 @@ parser.add_argument(
99
99
),
100
100
)
101
101
102
+ parser .add_argument (
103
+ "-n" ,
104
+ "--run-names" ,
105
+ required = False ,
106
+ default = None ,
107
+ nargs = "*" ,
108
+ help = (
109
+ "Overwrite the names given to each run? If not present, the default names "
110
+ "from the snapshots are used, and in the case where there are multiple "
111
+ "redshifts, we append the redshift."
112
+ ),
113
+ )
114
+
102
115
103
116
if __name__ == "__main__" :
104
117
# Parse our lovely arguments and pass them to the velociraptor library
@@ -158,13 +171,32 @@ if __name__ == "__main__":
158
171
load_snapshot (f"{ input } /{ snapshot } " )
159
172
for input , snapshot in zip (args .input , args .snapshots )
160
173
]
161
- run_names = [data .metadata .run_name for data in snapshots ]
174
+ if args .run_names is not None :
175
+ run_names = args .run_names
176
+ print_if_debug ("Using custom run names:" )
177
+ print_if_debug (" " .join (run_names ))
178
+ else :
179
+ # First, check if the snapshots are all at the same redshift
180
+ redshifts = {data .metadata .redshift for data in snapshots }
181
+ if len (redshifts ) == len (snapshots ):
182
+ # All different redshifts!
183
+ run_names = [data .metadata .run_name for data in snapshots ]
184
+ else :
185
+ # Need to append appropriate redshifts to names.
186
+ run_names = [
187
+ f"{ data .metadata .run_name } (z={ data .metadata .redshift :1.3f} )"
188
+ for data in snapshots
189
+ ]
190
+ print_if_debug ("Using default run names from snapshot:" )
191
+ print_if_debug (" " .join (run_names ))
162
192
163
193
observational_data_path = (
164
194
f"{ config .config_directory } /{ config .observational_data_directory } /data"
165
195
)
166
196
167
- if len (args .snapshots ) == 1 :
197
+ is_comparison = len (args .snapshots ) > 1
198
+
199
+ if not is_comparison :
168
200
# Run the pipeline based on the arguments if only a single simulation is
169
201
# included and generate the metadata yaml file.
170
202
print_if_debug (
@@ -213,7 +245,7 @@ if __name__ == "__main__":
213
245
f"{ args .input [0 ]} /{ args .metadata } _{ args .snapshots [0 ][- 9 :- 5 ]} .yml"
214
246
)
215
247
print_if_debug (f"Creating and writing metadata to { metadata_filename } " )
216
-
248
+
217
249
try :
218
250
auto_plotter_metadata .write_metadata (metadata_filename )
219
251
except (OSError , PermissionError ) as e :
@@ -283,7 +315,9 @@ if __name__ == "__main__":
283
315
if args .debug :
284
316
config .scripts = tqdm (config .scripts , desc = "Running Scripts" )
285
317
286
- for script in config .scripts :
318
+ scripts_to_use = config .comparison_scripts if is_comparison else config .scripts
319
+
320
+ for script in scripts_to_use :
287
321
full_script_path = f"{ config .config_directory } /{ script .filename } "
288
322
289
323
run (
@@ -310,7 +344,7 @@ if __name__ == "__main__":
310
344
print_if_debug ("Creating webpage." )
311
345
webpage = WebpageCreator ()
312
346
webpage .add_auto_plotter_metadata (auto_plotter_metadata = auto_plotter_metadata )
313
- webpage .add_config_metadata (config = config )
347
+ webpage .add_config_metadata (config = config , is_comparison = is_comparison )
314
348
webpage .add_metadata (page_name = " | " .join (run_names ))
315
349
webpage .add_run_metadata (config = config , snapshots = snapshots )
316
350
webpage .render_webpage ()
0 commit comments