-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate h5 file after filtering by particle ID #1109
Comments
Hello, if I understand your question correctly, you are looking for a way to post process a H5 beam and write the result in a new H5 file to use it with another hipace simulation. Please correct me if that’s not the case. For H5 post-processing, I suggest using a python script with openPMD-api to read and write the H5 beam data. There is such a script to write a beam at https://github.com/Hi-PACE/hipace/blob/development/tools/write_beam.py. It is based on the openPMD-api tutorial to write a file, https://openpmd-api.readthedocs.io/en/latest/usage/firstwrite.html. There is a similar tutorial to read data https://openpmd-api.readthedocs.io/en/latest/usage/firstread.html. Note that the tutorials are for fields (“meshes”) whereas the beam data would be stored under “particles”. Once you have the particle data (position, momentum, weighting, ID) in python you can apply any transformation to them, including splitting particles into two groups based on ID or energy. One thing to look out for is when you read in a file that was generated using the from_file injection_type, the ID from the file will not be read in and instead new IDs will be assigned to the particles. Also make sure to use a recent development version of hipace as a bug was fixed not long ago where beam IDs could be repeated under certain conditions. |
Dear AlexanderSinn, |
Hello,
the mean value for z is at The I opened PRs #1119, #1120 and #1121 to add more warnings for zero-particle/zero-weight beams and fix the crash in case the beam has no particles. |
How to generate a new H5 file by filtering the particle ID in the H5 output file?
That is, the particle ID is divided into two parts according to the particle energy in the original output file, and all the output information of the two parts of the particle is placed in two different H5 files according to the ID, and the particle information is read into the input file by using the from_file injection_type.
The text was updated successfully, but these errors were encountered: