Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lfarv committed Jan 7, 2024
1 parent 444a6a4 commit 91e1187
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions pyat/at/lattice/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ def __init__(
ring: provided to an attempt to get the initial value of the
variable
"""
self.name = self._setname(name) #: Variable name
self.bounds = bounds #: Variable bounds
self.delta = delta #: Increment step
self.name: str = self._setname(name) #: Variable name
self.bounds: tuple[Number, Number] = bounds #: Variable bounds
self.delta: Number = delta #: Increment step
#: Maximum length of the history buffer. :py:obj:`None` means infinite
self.history_length = history_length
self._initial = np.nan
Expand Down
24 changes: 13 additions & 11 deletions pyat/at/latticetools/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ def __init__(
Defines an Observable for the momentum compaction factor.
"""
name = fun.__name__ if name is None else name
self.fun = fun
self.needs = needs or set()
self.name = name
self.target = target
self.fun: Callable = fun #: Evaluation function
self.needs: set[Need] = needs or set() #: Set of requirements
self.name: str = name #: Observable name
self.target = target #: Target value
self.w = weight
self.lbound, self.ubound = bounds
self.initial = None
Expand Down Expand Up @@ -1072,13 +1072,15 @@ def ringeval(
r_out = ring.lattice_pass(r_in.copy(), 1, refpts=self.passrefs)
trajs = r_out[:, 0, :, 0].T

if not needs.isdisjoint({
Need.ORBIT,
Need.MATRIX,
Need.LOCALOPTICS,
Need.GLOBALOPTICS,
Need.EMITTANCE,
}):
if not needs.isdisjoint(
{
Need.ORBIT,
Need.MATRIX,
Need.LOCALOPTICS,
Need.GLOBALOPTICS,
Need.EMITTANCE,
}
):
orbit0 = self.kwargs.get("orbit", None)
o0, orbits = ring.find_orbit(
refpts=self.orbitrefs, dp=dp, dct=dct, df=df, orbit=orbit0
Expand Down

0 comments on commit 91e1187

Please sign in to comment.