bwheelz36 / ParticlePhaseSpace

Import, analysis, and export of particle phase space data
https://bwheelz36.github.io/ParticlePhaseSpace/
GNU General Public License v3.0
13 stars 8 forks source link

Added TOPAS binary exporter #173

Closed icmeyer closed 5 months ago

icmeyer commented 5 months ago

Have been finding this module very useful. I added a TOPAS binary exporter using the numpy.ndarray.tofile() function. This is in line with the reverse operation of the topas2numpy's import using numpy.fromfile().

The one drawback of the binary format is that it can't be transferred across systems of different endianness. I believe this is baked into the format for all TOPAS users, so maybe we add a warning along these lines when exporting to binary?

Added a test to the testsuite, and tested the binary import with OpenTOPAS v4.0.0

bwheelz36 commented 5 months ago

Thanks for this, this is a functionality I have been wanting to add for a while!

icmeyer commented 5 months ago

Fixed up the docstring and added in a warning about the binary format