Skip to content

Commit

Permalink
Use time directly if available
Browse files Browse the repository at this point in the history
  • Loading branch information
eltos committed Jan 2, 2024
1 parent 0147cf3 commit 8f63723
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions xplt/particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ def frev(self, particles=None):

def _particle_time(self, turn, zeta, particles=None):
"""Particle arrival time (t = at_turn / frev - zeta / beta / c0)"""

# use time directly (if available)
if particles is not None:
try:
return get(particles, "t")
except AttributeError:
pass

# determine time from longitudinal coordinates
beta = self.beta(particles)
if beta is None:
raise ValueError(
Expand Down

0 comments on commit 8f63723

Please sign in to comment.