Picongpu: EnergyHistogramData broken?

Created on 9 Jan 2020  路  1Comment  路  Source: ComputationalRadiationPhysics/picongpu

The example here
https://picongpu.readthedocs.io/en/latest/usage/plugins/energyHistogram.html#data-reader

from picongpu.plugins.data import EnergyHistogramData

eh_data = EnergyHistogramData('/path/to/your/sim/eg/this/one/lwfa_001')
# load data for a given iteration
counts, bins_keV = eh_data.get('e', species_filter='all', iteration=2000)

seams to be broken and results in

TypeError: get() takes 1 positional argument but 2 were given

Changing to

counts, bins_keV = eh_data.get(species='e', species_filter='all', iteration=2000)

does not work either and results in

ValueError: too many values to unpack (expected 2)

because this also returns into the

d, bins, iteration, dt = ...

signature now.

bug plugin tools

Most helpful comment

You are right, the example needs to be updated to reflect the two additional return values. Thanks for spotting that.
Your first code example doesn't work since the implementation of the .get method expects only keyword arguments, see here (https://github.com/ComputationalRadiationPhysics/picongpu/blob/4a90da17cc39678c79b915257fa66aa973338088/lib/python/picongpu/plugins/data/base_reader.py#L69).

Maybe that should be changed to

def get(self, *args, **kwargs):

This shouldn't break anything from what I see now.

I will take care on that coming monday!

>All comments

You are right, the example needs to be updated to reflect the two additional return values. Thanks for spotting that.
Your first code example doesn't work since the implementation of the .get method expects only keyword arguments, see here (https://github.com/ComputationalRadiationPhysics/picongpu/blob/4a90da17cc39678c79b915257fa66aa973338088/lib/python/picongpu/plugins/data/base_reader.py#L69).

Maybe that should be changed to

def get(self, *args, **kwargs):

This shouldn't break anything from what I see now.

I will take care on that coming monday!

Was this page helpful?
0 / 5 - 0 ratings