openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Allow on-the-fly read of tracks.h5

Open MicahGale opened this issue 1 year ago • 0 comments

Description

HDF5 is well-known for efficient random-reads. Currently openmc.Tracks reads in the entirety of a tracks.h5 to RAM before returning. This can be very difficult to work with for large tracks.

Another object similar to openmc.StatePoint should be implemented to allow on-the-fly accessing. Feedback on object design would be appreciated.

Initial concept:

with openmc.TracksOTF("tracks.h5") as tracks:
   for track in tracks.filter(batch = range(1,10)):
       for particle_track in track.filter(particle="neutron"):
           for state in particle_track.filter(E=(1,10e5), r.x > 5):
              ...

Alternatives

Just let the user do it themselves with h5py.

Compatibility

This would only add features.

MicahGale avatar Apr 27 '24 21:04 MicahGale