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

Cannot get momentum #4650

Closed
cbontoiu opened this issue Aug 17, 2023 · 6 comments
Closed

Cannot get momentum #4650

cbontoiu opened this issue Aug 17, 2023 · 6 comments
Labels
bug a bug in the project's code component: plugin in PIConGPU plugin duplicate duplicate issue or pull-request (link main issue!)

Comments

@cbontoiu
Copy link
Contributor

I have a model for which none of ux, uy,uz can be retrieved from the .bp data. The remaining variables, x, y,z and w can be obtained. I used openpmd viewer to read data from the .bp archives. There is nothing wrong with my installation because it can get ux, uy,uz from data saved a few months ago, so therefore with an older dev release of PIConGPU. Something happened in between.

In my speciesDefinition.param file I always have
using DefaultParticleAttributes = MakeSeq_t< position<position_pic>, momentum, weighting, particleId >;

This is the error I get:

uz = ts_particles.get_particle( var_list=['uz'], iteration=ITER[nnRef], species='e', plot=True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[37], line 1
----> 1 uz = ts_particles.get_particle( var_list=['uz'], iteration=ITER[nnRef], species='e', plot=True)

File ~/anaconda3/lib/python3.10/site-packages/openpmd_viewer/openpmd_timeseries/main.py:274, in OpenPMDTimeSeries.get_particle(self, var_list, species, t, iteration, select, plot, nbins, plot_range, use_field_mesh, histogram_deposition, **kw)
    272 data_list = []
    273 for quantity in var_list:
--> 274     data_list.append( self.data_reader.read_species_data(
    275         iteration, species, quantity, self.extensions))
    276 # Apply selection if needed
    277 if isinstance( select, dict ):

File ~/anaconda3/lib/python3.10/site-packages/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py:293, in DataReader.read_species_data(self, iteration, species, record_comp, extensions)
    290     return h5py_reader.read_species_data(
    291             filename, iteration, species, record_comp, extensions )
    292 elif self.backend == 'openpmd-api':
--> 293     return io_reader.read_species_data(
    294             self.series, iteration, species, record_comp, extensions )

File ~/anaconda3/lib/python3.10/site-packages/openpmd_viewer/openpmd_timeseries/data_reader/io_reader/particle_reader.py:83, in read_species_data(series, iteration, species_name, component_name, extensions)
     81     if (macro_weighted == 1) and (weighting_power != 0):
     82         w_component = next(species['weighting'].items())[1]
---> 83         w = get_data( w_component )
     84         data *= w ** (-weighting_power)
     86 # - Return positions, with an offset

TypeError: get_data() missing 1 required positional argument: 'record_component'

Here is a snapshot from my data series as a .bp archive
https://drive.google.com/file/d/1Acf8bKL_RQJOvyhViyup6fdKsFCsPih8/view?usp=drive_link

Hopefully, this is an easy fix.
Many thanks, for your help.

@pordyna
Copy link
Member

pordyna commented Aug 18, 2023

Probably introduced with #4636 since this part of the code was not executed in the reader for PIConGPU output from before that PR. At first glance, it looks like it is a bug in the openpmd-viewer. Maybe try opening an issue over there and link this one.

@cbontoiu
Copy link
Contributor Author

@pordyna thanks for your reply. I will log an issue for openpmd-viewer, of course. However openpmd-viewer works with old PIConGPU data. Does it mean that the latest PIConGPU release changed something which openpmd-viewer cannot handle, just for momentum components?

@cbontoiu
Copy link
Contributor Author

@pordyna
Copy link
Member

pordyna commented Aug 18, 2023

@cbontoiu the PR mentioned above added information in the metadata that the output uses the PIC extension to the openPMD stadard. The part of the code in the viewer that fails is only executed for data with this extension. That code is supposed to automatically take care of dividing the momentum by weighting to get single particle momenta. So take care, when you get it to work, you shouldn't divide it yourself anymore.

@PrometheusPi
Copy link
Member

This issue was investigated in #4633, reported in #4635 and fixed with #4635.
Please see also the comment on how to fix your PIConGPU version and how to fix your adios files here: openPMD/openPMD-viewer#391

Since this is a fixed bug, I will close the issue. Feel free to reopen, in case I misinterpreted the issue.

@PrometheusPi PrometheusPi added bug a bug in the project's code duplicate duplicate issue or pull-request (link main issue!) component: plugin in PIConGPU plugin labels Aug 18, 2023
@PrometheusPi
Copy link
Member

The error was caused by an error in the openPMD-viewer: openPMD/openPMD-viewer#393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the project's code component: plugin in PIConGPU plugin duplicate duplicate issue or pull-request (link main issue!)
Projects
None yet
Development

No branches or pull requests

3 participants