ColwynGulliford / lume-gpt

Apache License 2.0
3 stars 4 forks source link

Distgen does not have setter for input -> affects sectormagnet example #7

Closed petr-lanl closed 1 year ago

petr-lanl commented 1 year ago

examples/elements/sectormagnet.ipynb cell 6 contains: gen.input['x_dist']={'type':'uniform', 'min_x': -0.1*unit_registry('m'), 'max_x': +0.1*unit_registry('m')}

It assumes that distgen has a setter for property input. The version of distgen, which I have, has the setter commented out as a result weak focusing example does not work: image instead of image

Same holds true for edge focusing part of the notebook

ColwynGulliford commented 1 year ago

Yes, that's correct - the new version of distgen doesn't have a setter for Generator.input, in fact that object is now a derived property (the details have to do with Distgen making use of the Pint package to handle physical units internally). I will correct the notebook so that it use the up-to-date Distgen syntax:

gen['x_dist']={'type':'uniform', 'min_x': -0.1unit_registry('m'), 'max_x': +0.1unit_registry('m')}

petr-lanl commented 1 year ago

Thank you, I have now issue with cell 8 as you are using fix=True option. I believe that it calls for sectormagent_fix element that I do not have in my GPT install. What kind of element is that?

Removing fix=True seems to be working as expected.

petr-lanl commented 1 year ago

Finally, class Sectormagnet has method track_ref commented out. This causes cell 21 to fail since the fall back method of super does nothing.

ColwynGulliford commented 1 year ago

sectormagnet_fix is an outdated version of the sectormagnet element in GPT - the original sectormagnet code had a bug in it at the time, so we were supplied with a version called "fixed". However, the fixed version is now the standard, so I removed that argument to Sectormagnet.

ColwynGulliford commented 1 year ago

I also used to have a separate element for Quadrupoles with fringes, however that is also included in GPT (probably for some time), so I'm updated the notebook on quadrupoles.

ColwynGulliford commented 1 year ago

I found a few more instances that needed updating, but think I caught them all (or most). Please reopen this issue if you find any more.

ColwynGulliford commented 1 year ago

Ok, I've updated all the notebooks in examples/elements and checked they all run.