Skip to content

Empty ParticleGroup unable to be saved to HDF5 #157

Description

@ken-lauer

This fails here:

File ~/Repos/openPMD-beamphysics/beamphysics/particles.py:1467, in ParticleGroup.write(self, h5, name)
   1464 else:
   1465     g = h5
-> 1467 write_pmd_bunch(g, self, name=name)

File ~/Repos/openPMD-beamphysics/beamphysics/writers.py:79, in write_pmd_bunch(h5, data, name)
     76     u = pg_units(key)
     78     # Write
---> 79     write_component_data(g, g2_name, data[key], unit=u)
     81 # Optional id. This does not have any units.
     82 if "id" in data:

File ~/Repos/openPMD-beamphysics/beamphysics/writers.py:137, in write_component_data(h5, name, data, unit)
    128 """
    129 Writes data to a dataset h5[name]
    130
   (...)    134
    135 """
    136 # Check for constant component
--> 137 dat0 = data.flat[0]
    139 if np.all(data == dat0):
    140     g = h5.create_group(name)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions