Skip to content

Commit 136256f

Browse files
authored
PyTorch Example: HDF5 (#902)
In CI/Examples we use `.h5` for the `BeamMonitor`, because it is easier to more install/broadly available in environments. Update this for our PyTorch example to be in sync with the other examples we have.
1 parent b131f7b commit 136256f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/pytorch_surrogate_model/analyze_ml_surrogate_15_stage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_moments(beam):
3535

3636

3737
# initial/final beam
38-
series = io.Series("diags/openPMD/monitor.bp", io.Access.read_only)
38+
series = io.Series("diags/openPMD/monitor.h5", io.Access.read_only)
3939
last_step = list(series.iterations)[-1]
4040
initial = series.iterations[1].particles["beam"].to_df()
4141
final = series.iterations[last_step].particles["beam"].to_df()

examples/pytorch_surrogate_model/run_ml_surrogate_15_stage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def set_lens(self, pc, step, period):
332332
lpa.threadsafe = False
333333
lpa_stages.append(lpa)
334334

335-
monitor = elements.BeamMonitor("monitor")
335+
monitor = elements.BeamMonitor("monitor", backend="h5")
336336
for i in range(N_stage):
337337
sim.lattice.extend(
338338
[

examples/pytorch_surrogate_model/visualize_ml_surrogate_15_stage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def plot_beam_df(
395395

396396
######## plot phase spaces ###########
397397
beam_impactx_surrogate_series = io.Series(
398-
"diags/openPMD/monitor.bp", io.Access.read_only
398+
"diags/openPMD/monitor.h5", io.Access.read_only
399399
)
400400
impactx_surrogate_steps = list(beam_impactx_surrogate_series.iterations)
401401

0 commit comments

Comments
 (0)