Skip to content

Commit

Permalink
Fix mistakenly removed cos
Browse files Browse the repository at this point in the history
  • Loading branch information
jank324 committed Sep 11, 2023
1 parent 249aa21 commit 940dbcc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
2 changes: 1 addition & 1 deletion cheetah/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def _track_beam(self, incoming: ParticleBeam) -> ParticleBeam:
def _cavity_rmatrix(self, energy: float) -> torch.Tensor:
"""Produces an R-matrix for a cavity when it is on, i.e. voltage > 0.0."""
phi = torch.deg2rad(torch.tensor(self.phase))
delta_energy = torch.tensor(self.voltage) * phi
delta_energy = torch.tensor(self.voltage) * torch.cos(phi)
# Comment from Ocelot: Pure pi-standing-wave case
eta = torch.tensor(1)
Ei = energy / electron_mass_eV
Expand Down
76 changes: 41 additions & 35 deletions test_bmad.ipynb

Large diffs are not rendered by default.

0 comments on commit 940dbcc

Please sign in to comment.