Closed StevE-Ong closed 1 year ago
Hello @StevE-Ong,
I see two small issues:
Data is only read when explicitly flushing. So before printing the data, you would need to insert a series.flush()
call, else you get uninitialized memory.
x = electrons["position"]["x"][()]
# no data yet in x
series.flush()
# now, x is filled
print(x)
Much like the charge, also the scaling is a scalar record, i.e. you need to write something like w = electrons["weighting"][io.Record_Component.SCALAR][()]
. (This is a confusing API design on our side and will hopefully no longer be necessary once #1154 is finished)
Otherwise this looks good at first glance. Do tell if you run into any further problems.
Hi @franzpoeschel,
Thanks. It works fine now.
Just another small question. Is it possible to read openpmd input using fortran?
Is it possible to read openpmd input using fortran?
Not with the openPMD-api, no. The best alternatives are:
Hi, I am trying to access the particle data created from picongpu using the following script. But I am not sure it read correctly. The result of the particle position is weird with one very large value and the other very small. The weighting also cannot be read. I appreciate any one could point out the correct reading of particle data. Thanks.
OUTPUT