desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
32 stars 13 forks source link

Unsused instances and imports of UniqueNameGenerator #190

Open Hespe opened 3 months ago

Hespe commented 3 months ago

In many element classes, there are unused instances and imports of UniqueNameGenerator, e.g. in https://github.com/desy-ml/cheetah/blob/a35fc03f6b15571232e934f9b21aca2c0b2ea4ae/cheetah/accelerator/dipole.py#L14 since the names are generated in the superclass Element.

The unused instances could either be removed or changed to a more specific prefix and employed for overwriting the generic unique name from Element.

jank324 commented 3 months ago

Good point. I thought about class-specific prefixes at some point in the past, but then didn't do it for some reason. I don't remember why. I tried to find an issue where I may have written this down, but didn't find one.

Right now I'm inclined to vote for removing the unsung instances. It's the simpler solution, but I don't know if it's the better one.

@cr-xu, do you have thoughts on this?