Skip to content

Commit b753779

Browse files
committed
Fix TypeError for openpmd plugin
1 parent ad7b4b8 commit b753779

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

lib/python/picongpu/picmi/diagnostics/checkpoint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def get_as_pypicongpu(
108108
pypicongpu_by_picmi_species: Dict,
109109
time_step_size: float,
110110
num_steps: int,
111+
simulation_box=None, # Added to match OpenPMD signature, not used
111112
) -> PyPIConGPUCheckpoint:
112113
self.check()
113114

lib/python/picongpu/picmi/diagnostics/energy_histogram.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def get_as_pypicongpu(
7979
dict_species_picmi_to_pypicongpu: dict[PICMISpecies, PyPIConGPUSpecies],
8080
time_step_size,
8181
num_steps,
82+
simulation_box=None, # Added to match OpenPMD signature, not used
8283
) -> PyPIConGPUEnergyHistogram:
8384
self.check()
8485

lib/python/picongpu/picmi/diagnostics/macro_particle_count.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_as_pypicongpu(
4949
dict_species_picmi_to_pypicongpu: dict[PICMISpecies, PyPIConGPUSpecies],
5050
time_step_size,
5151
num_steps,
52+
simulation_box=None, # Added to match OpenPMD signature, not used
5253
) -> PyPIConGPUMacroParticleCount:
5354
self.check()
5455

lib/python/picongpu/picmi/diagnostics/png.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def get_as_pypicongpu(
189189
dict_species_picmi_to_pypicongpu: dict[PICMISpecies, PyPIConGPUSpecies],
190190
time_step_size,
191191
num_steps,
192+
simulation_box=None, # Added to match OpenPMD signature, not used
192193
) -> PyPIConGPUPNG:
193194
self.check()
194195

lib/python/picongpu/pypicongpu/output/openpmd.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,19 @@ def _get_serialized(self) -> typing.Dict:
8080
Serialize the OpenPMD object to a JSON-compatible dictionary.
8181
"""
8282
self.check()
83+
84+
# Convert RangeSpec to string format
85+
range_context = self.range._get_serialized() if self.range is not None else None
86+
if range_context:
87+
specs = range_context["specs"]
88+
range_str = ",".join(f"{spec['start']}:{spec['stop']}" for spec in specs)
89+
else:
90+
range_str = None
91+
8392
return {
8493
"period": self.period._get_serialized(),
8594
"source": [s._get_serialized() for s in self.source] if self.source is not None else None,
86-
"range": self.range._get_serialized() if self.range is not None else None,
95+
"range": range_str,
8796
"file": self.file,
8897
"ext": self.ext,
8998
"infix": self.infix,

0 commit comments

Comments
 (0)