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

Ensure dipoles get a unique name #186

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Now all `Element` have a default length of `torch.zeros((1))`, fixing occasional issues with using elements without length, such as `Marker`, `BPM`, `Screen`, and `Aperture`. (see #143) (@cr-xu)
- Fix bug in `Cavity` `_track_beam` (see [#150](https://github.com/desy-ml/cheetah/issues/150)) (@jp-ga)
- Remove unnecessary overwrite in dipole naming (see #186) (@hespe)

### 🐆 Other

Expand Down
1 change: 0 additions & 1 deletion cheetah/accelerator/dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def __init__(
if tilt is not None
else torch.zeros_like(self.length)
)
self.name = name
self.fringe_integral = (
torch.as_tensor(fringe_integral, **factory_kwargs)
if fringe_integral is not None
Expand Down
1 change: 1 addition & 0 deletions tests/test_dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_dipole_off():
dipole.angle = torch.tensor([1.0], device=dipole.angle.device)
outbeam_dipole_on = dipole(incoming_beam)

assert dipole.name is not None
assert torch.allclose(outbeam_dipole_off.sigma_x, outbeam_drift.sigma_x)
assert not torch.allclose(outbeam_dipole_on.sigma_x, outbeam_drift.sigma_x)

Expand Down