11from __future__ import annotations
22
33__all__ = [
4- "lattice_track " ,
4+ "MPMode " ,
55 "element_track" ,
6- "internal_lpass" ,
6+ "gpu_core_count" ,
7+ "gpu_info" ,
78 "internal_epass" ,
9+ "internal_lpass" ,
810 "internal_plpass" ,
9- "gpu_info" ,
10- "gpu_core_count" ,
11- "MPMode" ,
11+ "lattice_track" ,
1212]
1313
1414import multiprocessing
3131
3232class MPMode (Enum ):
3333 """
34- Multi Processing mode
34+ Multi Processing mode.
3535 """
3636
3737 CPU = 1 #: CPU multiprocessing
@@ -55,14 +55,14 @@ class MPMode(Enum):
5555
5656
5757def _atpass_fork (seed , rank , rin , ** kwargs ):
58- """Single forked job"""
58+ """Single forked job. """
5959 reset_rng (rank = rank , seed = seed )
6060 result = _atpass (_globring , rin , ** kwargs )
6161 return rin , result
6262
6363
6464def _atpass_spawn (ring , seed , rank , rin , ** kwargs ):
65- """Single spawned job"""
65+ """Single spawned job. """
6666 reset_rng (rank = rank , seed = seed )
6767 result = _atpass (ring , rin , ** kwargs )
6868 return rin , result
@@ -99,23 +99,23 @@ def _lattice_pass(
9999 r_in ,
100100 nturns : int = 1 ,
101101 refpts : Refpts = End ,
102- no_varelem = True ,
102+ no_varelem : bool = True ,
103103 seed : int | None = None ,
104104 use_gpu : bool = False ,
105105 ** kwargs ,
106106):
107107 kwargs ["reuse" ] = kwargs .pop ("keep_lattice" , False )
108108 if no_varelem :
109109 lattice = disable_varelem (lattice )
110- else :
111- if sum (variable_refs (lattice )) > 0 :
112- kwargs ["reuse" ] = False
110+ elif sum (variable_refs (lattice )) > 0 :
111+ kwargs ["reuse" ] = False
113112 refs = get_uint32_index (lattice , refpts )
114113 if seed is not None :
115114 reset_rng (seed = seed )
116115 if use_gpu :
117116 if not (iscuda () or isopencl ()):
118- raise AtError ("No GPU support enabled" )
117+ msg = "No GPU support enabled"
118+ raise AtError (msg )
119119 else :
120120 return _gpupass (lattice , r_in , nturns , refpts = refs , ** kwargs )
121121 else :
@@ -129,11 +129,10 @@ def _plattice_pass(
129129 nturns : int = 1 ,
130130 refpts : Refpts = End ,
131131 seed : int | None = None ,
132- pool_size : int = None ,
133- start_method : str = None ,
132+ pool_size : int | None = None ,
133+ start_method : str | None = None ,
134134 ** kwargs ,
135135):
136- verbose = kwargs .pop ("verbose" , False )
137136 refpts = get_uint32_index (lattice , refpts )
138137 any_collective = has_collective (lattice )
139138 kwargs ["reuse" ] = kwargs .pop ("keep_lattice" , False )
@@ -208,7 +207,8 @@ def lattice_track(
208207 continue the sequence
209208 keep_lattice (bool): Use elements persisted from a previous
210209 call. If :py:obj:`True`, assume that the lattice has not changed
211- since the previous call.
210+ since the previous call. Ignored if *lattice* differs from the cached one.
211+ Default: :py:obj:`False`
212212 keep_counter (bool): Keep the turn number from the previous
213213 call.
214214 turn (int): Starting turn number. Ignored if
@@ -379,7 +379,7 @@ def element_track(element: Element, r_in, in_place: bool = False, **kwargs):
379379 """
380380 :py:func:`element_track` tracks particles through one element of a
381381 calling the element-specific tracking function specified in the
382- Element's *PassMethod* field
382+ Element's *PassMethod* field.
383383
384384 Usage:
385385 >>> element_track(element, r_in)
0 commit comments