SixTrack / sixtracklib

Library for single charged particle simulations in accelerators
GNU Lesser General Public License v2.1
12 stars 16 forks source link

fix object creation #138

Closed rdemaria closed 3 years ago

rdemaria commented 3 years ago

allow (with the new version of cobjets)

import sixtracklib
a=sixtracklib.Elements.fromfile("local/sixtracklib/./tests/testdata/lhc_no_bb/beam_elements.bin")
b=sixtracklib.Elements()

for el in reversed( a.get_elements() ):
  getattr(b,el.__class__.__name__)(**el.to_dict())
martinschwinzerl commented 3 years ago

Thanks, I had searched for something along those lines but did not find anything, hence the very simple and piece-meal implementation in my example! There is currently no to_dict() method available in CObject, correct?

rdemaria commented 3 years ago

i put to_dict in my fork, now it is in SixTrack