Open CFGrote opened 4 years ago
i think that's a solid plan.
-- Dr. Carsten Fortmann-Grote PaNOSC WP5 leader
On 6/11/20 12:08 PM, shervin86 wrote:
Two things can be done and it might be useful to do both:
- write an openPMDin and openPMDout components for McStas
- write a converter between MCPL and openPMD
We should asses the performance running using openPMD or MCPL with McStas. In case of significant slower running with openPMD, it might be useful to still use MCPL whenever the same MCPL file is used multiple times as input source and then convert it to openPMD to have it publicly available. In this scenario the converter would be necessary.
There is already a python module to read MCPL files: https://github.com/mctools/mcpl/blob/0e2a51a716b01d5e045f27d4d2b57a0041664284/src/python/mcpl.py
with a convert2ascii function. We could extend it with a convert2openPMD using the python openPMD API
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/PaNOSC-ViNYL/ViNYL-project/issues/32#issuecomment-642549106, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWCQR3HKN6SY6FQQ7K7IJTRWCULNANCNFSM4NBQ77DA.
After discussion with McStas developers and MCPL developers, I think it would be best to make the openPMD input / output components for McStas directly.
The MCPL developers are open for adding write capability to their python module which would make a converter a lot more elegant, but admit the timeline would be long. An issue was created on the subject:
A basic version of a converter from MCPL to openPMD is available here: https://github.com/PaNOSC-ViNYL/mcpl/tree/mcpl_to_openpmd you can run it as follows:
python3 src/python/mcpl.py --openpmd input.mcpl output.h5
The new function is added in a very preliminary version and it is not very fast.
I just realized that the openPMD API is in C++ and not C. I actually don't know how to proceed. Does it make sense to make a wrapper library? What about compiling McStas as it was C included in a C++ project?
A basic version of a converter from MCPL to openPMD is available here: https://github.com/PaNOSC-ViNYL/mcpl/tree/mcpl_to_openpmd you can run it as follows:
python3 src/python/mcpl.py --openpmd input.mcpl output.h5
The new function is added in a very preliminary version and it is not very fast.
very good. regarding performance, the developers of openpmd-api may have some tips.
Two things can be done and it might be useful to do both:
We should asses the performance running using openPMD or MCPL with McStas. In case of significant slower running with openPMD, it might be useful to still use MCPL whenever the same MCPL file is used multiple times as input source and then convert it to openPMD to have it publicly available. In this scenario the converter would be necessary.
There is already a python module to read MCPL files: https://github.com/mctools/mcpl/blob/0e2a51a716b01d5e045f27d4d2b57a0041664284/src/python/mcpl.py
with a convert2ascii function. We could extend it with a convert2openPMD using the python openPMD API
I forked the mcpl repository and started to work on it. But I have problems in understanding the openPMD-api logic and functions. Documentation is not really great.