Skip to content

Commit

Permalink
Fix bug where z=0 or t=0 drift was actually setting to the mean.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherMayes committed Jun 28, 2023
1 parent 20559fd commit 1da6d9a
Showing 1 changed file with 2 additions and 2 deletions.
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 1da6d9a

Please sign in to comment.