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

Error when using ParticleMonitor in feature/multibunch_feedback #105

Open
michuschenk opened this issue Aug 2, 2019 · 0 comments
Open
Labels

Comments

@michuschenk
Copy link
Collaborator

When using ParticleMonitor in multi-bunch branch, the following error occurs, coming from
line 454
dims = bunch.get_coords_n_momenta_dict().values()[0][::self.stride].shape

leads to:

Traceback (most recent call last):
File "sps_multibunch.py", line 212, in
run(xi=xi)
File "sps_multibunch.py", line 188, in run
particlemonitor_dict[str(bb.bucket_id[0])].dump(bb)
File "/hpcscratch/user/mischenk/PyHEADTAIL/monitors/monitors.py", line 424, in dump
self.write_data_to_file(bunch, arrays_dict)
File "/hpcscratch/user/mischenk/PyHEADTAIL/monitors/monitors.py", line 454, in write_data_to_file
dims = bunch.get_coords_n_momenta_dict().values()[0][::self.stride].shape # more robust implementation
File "/hpcscratch/user/mischenk/PyHEADTAIL/particles/particles.py", line 203, in get_coords_n_momenta_dict
return {coord: getattr(self, np.copy('
'+coord)) for coord in self.coords_n_momenta}
File "/hpcscratch/user/mischenk/PyHEADTAIL/particles/particles.py", line 203, in
return {coord: getattr(self, np.copy('
'+coord)) for coord in self.coords_n_momenta}
TypeError: getattr(): attribute name must be string

Bug is linked to ParticleView(..) class. Permanent fix desired, but there is a workaround for now::
Comment out line 454 and use line 453 instead (solution less robust according to comment in code):

dims = (bunch.macroparticlenumber // self.stride,)

Thanks to Hannes and Carlo for spotting the error.

@michuschenk michuschenk added the bug label Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant