Skip to content
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

openpmd-api backend forgets modes m>1 #310

Closed
soerenjalas opened this issue Mar 2, 2021 · 5 comments · Fixed by #313
Closed

openpmd-api backend forgets modes m>1 #310

soerenjalas opened this issue Mar 2, 2021 · 5 comments · Fixed by #313
Assignees
Labels

Comments

@soerenjalas
Copy link
Member

soerenjalas commented Mar 2, 2021

Hi,
this might a bit of an edge case issue but it caused a bit of confusion for me so I thought it might be good to document. I have the case where I load a timeseries (fbpic) in a jupyter notebook via d = LpaDiagnostics('lab_diags/hdf5', backend='openpmd-api'), and retrieve the fields with d.get_field(). Now I changed reran the simulation (going from 2 to 3 theta modes). After rerunning the cell to import the timeseries get_field() still returns the old fields now. With backend='h5py' I get the new data as expected.
Is there some sort of caching going on with the openpmd-api that needs to be cleared?

@soerenjalas
Copy link
Member Author

Hi,
sorry I think I misinterpreted the issue, I think the openpmd-api backend is returning the correct data. However it is missing the additional mode when calling get_field(m=2)

@RemiLehe
Copy link
Member

RemiLehe commented Mar 3, 2021

Thanks for reporting this!
Do you mean that get_field(m=2) essentially returns an array filled with 0?
or does it raise a Python exception?

@ax3l
Copy link
Member

ax3l commented Mar 4, 2021

Hi @soerenjalas, can you please post a tiny example file and python example that demonstrates this for debugging?

I looked at the code but cannot spot an obvious bug right away.

@soerenjalas
Copy link
Member Author

soerenjalas commented Mar 5, 2021

Hi all,
sorry for the messy issue. I tried to create a small repro example:
data00000000.zip

The file contains an (empty) hdf5 output from fbpic with 3 modes.

Running,

d = OpenPMDTimeSeries('.', backend='h5py')
d.get_field(iteration=0, field='rho', m=2)

works fine, but

d = OpenPMDTimeSeries('.', backend='openpmd-api')
d.get_field(iteration=0, field='rho', m=2)

raises an OpenPMDException as if the file didn't contain mode 2.

OpenPMDException: The requested mode '2' is not available.
The available modes are: 
 - all
 - 0
 - 1

It looks like on the viewer side the code for h5py and openpmd-api is quite analogue, could this be an issue within the api?

Tested with this constellation:
openpmd-api 0.13.2
openpmd-viewer 1.1.0

@ax3l
Copy link
Member

ax3l commented Mar 25, 2021

Thank you for the details, this is great!
Sorry for the slight delay - I proposed a fix in #313 based on your example data.

@ax3l ax3l changed the title openpmd-api backend does not update data openpmd-api backend forgets modes m>1 Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants