Skip to content

Commit

Permalink
Merge pull request #40 from ChristopherMayes/fix_drift_to_zero
Browse files Browse the repository at this point in the history
Fix drift to zero
  • Loading branch information
ChristopherMayes authored Jun 28, 2023
2 parents a1d6c9e + 2b48827 commit 7d3a7a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
33 changes: 14 additions & 19 deletions docs/examples/particle_examples.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pmd_beamphysics/particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ def drift(self, delta_t):

def drift_to_z(self, z=None):

if not z:
if z is None:
z = self.avg('z')
dt = (z - self.z) / (self.beta_z * c_light)
self.drift(dt)
Expand All @@ -752,7 +752,7 @@ def drift_to_t(self, t=None):
If no z is given, particles will be drifted to the average t
"""
if not t:
if t is None:
t = self.avg('t')
dt = t - self.t
self.drift(dt)
Expand Down

0 comments on commit 7d3a7a6

Please sign in to comment.