xtrack 0.31.0__tar.gz → 0.32.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. {xtrack-0.31.0/xtrack.egg-info → xtrack-0.32.1}/PKG-INFO +1 -1
  2. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/__init__.py +2 -2
  3. xtrack-0.32.1/xtrack/_version.py +1 -0
  4. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures.py +104 -51
  5. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements.py +182 -61
  6. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/footprint.py +4 -4
  7. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/line.py +2111 -788
  8. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/loss_location_refinement/loss_location_refinement.py +137 -95
  9. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/mad_loader.py +1 -7
  10. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/match.py +15 -15
  11. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/monitors/particles_monitor.py +23 -0
  12. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/multiline/multiline.py +14 -1
  13. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/multisetter/multisetter.py +32 -0
  14. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/pipeline/multitracker.py +22 -10
  15. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/prebuild_kernels.py +1 -1
  16. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/table.py +38 -19
  17. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/tapering.py +15 -16
  18. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/tracker.py +245 -684
  19. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/tracker_data.py +42 -25
  20. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/twiss.py +99 -106
  21. {xtrack-0.31.0 → xtrack-0.32.1/xtrack.egg-info}/PKG-INFO +1 -1
  22. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack.egg-info/SOURCES.txt +0 -34
  23. xtrack-0.31.0/tests/test_acceleration.py +0 -44
  24. xtrack-0.31.0/tests/test_aperture_turn_ele_and_monitor.py +0 -251
  25. xtrack-0.31.0/tests/test_apertures.py +0 -251
  26. xtrack-0.31.0/tests/test_collective_tracker.py +0 -93
  27. xtrack-0.31.0/tests/test_collimation.py +0 -426
  28. xtrack-0.31.0/tests/test_element_internal_record.py +0 -737
  29. xtrack-0.31.0/tests/test_elements.py +0 -962
  30. xtrack-0.31.0/tests/test_freeze_longitudinal.py +0 -134
  31. xtrack-0.31.0/tests/test_full_rings.py +0 -218
  32. xtrack-0.31.0/tests/test_ions.py +0 -57
  33. xtrack-0.31.0/tests/test_line.py +0 -687
  34. xtrack-0.31.0/tests/test_madloader.py +0 -546
  35. xtrack-0.31.0/tests/test_match_and_track_from_element.py +0 -160
  36. xtrack-0.31.0/tests/test_match_orbit_bump.py +0 -113
  37. xtrack-0.31.0/tests/test_match_tune_chroma_cminus.py +0 -163
  38. xtrack-0.31.0/tests/test_monitor.py +0 -169
  39. xtrack-0.31.0/tests/test_multiline_and_orbit_correction.py +0 -274
  40. xtrack-0.31.0/tests/test_multisetter.py +0 -118
  41. xtrack-0.31.0/tests/test_overriden_particle.py +0 -111
  42. xtrack-0.31.0/tests/test_pipeline.py +0 -133
  43. xtrack-0.31.0/tests/test_prebuild_kernels.py +0 -68
  44. xtrack-0.31.0/tests/test_pyht_interface.py +0 -261
  45. xtrack-0.31.0/tests/test_radiation.py +0 -218
  46. xtrack-0.31.0/tests/test_random_gen.py +0 -72
  47. xtrack-0.31.0/tests/test_random_gen_exp.py +0 -74
  48. xtrack-0.31.0/tests/test_random_gen_gauss.py +0 -72
  49. xtrack-0.31.0/tests/test_random_gen_ruth.py +0 -100
  50. xtrack-0.31.0/tests/test_spacecharge_in_ring.py +0 -190
  51. xtrack-0.31.0/tests/test_survey.py +0 -63
  52. xtrack-0.31.0/tests/test_tapering.py +0 -87
  53. xtrack-0.31.0/tests/test_tracker.py +0 -537
  54. xtrack-0.31.0/tests/test_tracker_data.py +0 -143
  55. xtrack-0.31.0/tests/test_twiss.py +0 -382
  56. xtrack-0.31.0/tests/test_vs_madx.py +0 -594
  57. xtrack-0.31.0/xtrack/_version.py +0 -1
  58. {xtrack-0.31.0 → xtrack-0.32.1}/LICENSE +0 -0
  59. {xtrack-0.31.0 → xtrack-0.32.1}/MANIFEST.in +0 -0
  60. {xtrack-0.31.0 → xtrack-0.32.1}/README.md +0 -0
  61. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/__init__.py +0 -0
  62. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/base_classes.py +0 -0
  63. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/BB6D.py +0 -0
  64. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  65. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/__init__.py +0 -0
  66. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/beambeam.py +0 -0
  67. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/boost.py +0 -0
  68. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  69. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  70. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/qgauss.py +0 -0
  71. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/slicing.py +0 -0
  72. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/be_beamfields/spacecharge.py +0 -0
  73. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/elements.py +0 -0
  74. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/line.py +0 -0
  75. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/mathlibs.py +0 -0
  76. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/particles.py +0 -0
  77. {xtrack-0.31.0 → xtrack-0.32.1}/ducktrack/temp_pyparticles.py +0 -0
  78. {xtrack-0.31.0 → xtrack-0.32.1}/pyproject.toml +0 -0
  79. {xtrack-0.31.0 → xtrack-0.32.1}/setup.cfg +0 -0
  80. {xtrack-0.31.0 → xtrack-0.32.1}/setup.py +0 -0
  81. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/base_element.py +0 -0
  82. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/__init__.py +0 -0
  83. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  84. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  85. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  86. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  87. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  88. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  89. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/beam_interaction.py +0 -0
  90. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  91. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  92. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/drift.h +0 -0
  93. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/elens.h +0 -0
  94. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  95. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  96. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/lineartransfermatrix.h +0 -0
  97. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  98. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  99. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  100. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  101. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  102. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  103. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/wire.h +0 -0
  104. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  105. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  106. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  107. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  108. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/beam_elements/exciter.py +0 -0
  109. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/general.py +0 -0
  110. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/headers/checks.h +0 -0
  111. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/headers/constants.h +0 -0
  112. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/headers/particle_states.h +0 -0
  113. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/headers/synrad_spectrum.h +0 -0
  114. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/internal_record.py +0 -0
  115. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/jacobian.py +0 -0
  116. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/linear_normal_form.py +0 -0
  117. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/loss_location_refinement/__init__.py +0 -0
  118. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/monitors/__init__.py +0 -0
  119. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/monitors/last_turns_monitor.h +0 -0
  120. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/monitors/last_turns_monitor.py +0 -0
  121. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/monitors/particles_monitor.h +0 -0
  122. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/multiline/__init__.py +0 -0
  123. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/multiline/shared_knobs.py +0 -0
  124. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/multisetter/__init__.py +0 -0
  125. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/pipeline/__init__.py +0 -0
  126. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/pipeline/core.py +0 -0
  127. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/pipeline/manager.py +0 -0
  128. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/prebuilt_kernels/_kernel_definitions.json +0 -0
  129. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/__init__.py +0 -0
  130. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/random_generators.py +0 -0
  131. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/random_src/exponential.h +0 -0
  132. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  133. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/random_src/normal.h +0 -0
  134. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/random_src/rutherford.h +0 -0
  135. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/random/random_src/uniform.h +0 -0
  136. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/survey.py +0 -0
  137. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack/tracker_src/tracker.h +0 -0
  138. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack.egg-info/dependency_links.txt +0 -0
  139. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack.egg-info/requires.txt +0 -0
  140. {xtrack-0.31.0 → xtrack-0.32.1}/xtrack.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtrack
3
- Version: 0.31.0
3
+ Version: 0.32.1
4
4
  Summary: Tracking library for particle accelerators
5
5
  Home-page: https://xsuite.readthedocs.io/
6
6
  Download-URL: https://pypi.python.org/pypi/xtrack
@@ -9,8 +9,8 @@ from .base_element import BeamElement
9
9
  from .beam_elements import *
10
10
  from .random import *
11
11
  from .tracker_data import TrackerData
12
- from .line import Line, Node
13
- from .tracker import Tracker, freeze_longitudinal
12
+ from .line import Line, Node, freeze_longitudinal, _temp_knobs
13
+ from .tracker import Tracker
14
14
  from .match import Vary, Target, OrbitOnly
15
15
  from .loss_location_refinement import LossLocationRefinement
16
16
  from .internal_record import (RecordIdentifier, RecordIndex, new_io_buffer,
@@ -0,0 +1 @@
1
+ __version__ = '0.32.1'
@@ -16,6 +16,24 @@ UNLIMITED = 1e10 # could use np.inf but better safe than sorry
16
16
 
17
17
 
18
18
  class LimitRect(BeamElement):
19
+
20
+ '''
21
+ Beam element modeling a rectangular aperture limit.
22
+
23
+ Parameters
24
+ ----------
25
+ min_x : float
26
+ Lower x limit in meters.
27
+ max_x : float
28
+ Upper x limit in meters.
29
+ min_y : float
30
+ Lower y limit in meters.
31
+ max_y : float
32
+ Upper y limit in meters.
33
+
34
+ '''
35
+
36
+
19
37
  _xofields = {
20
38
  'min_x': xo.Float64,
21
39
  'max_x': xo.Float64,
@@ -24,14 +42,7 @@ class LimitRect(BeamElement):
24
42
  }
25
43
 
26
44
  def __init__(self, min_x=-UNLIMITED, max_x=UNLIMITED, min_y=-UNLIMITED, max_y=UNLIMITED, **kwargs):
27
- """A rectangular aperture
28
-
29
- Args:
30
- min_x (float): Lower x limit in m
31
- max_x (float): Upper x limit in m
32
- min_y (float): Lower y limit in m
33
- max_y (float): Upper y limit in m
34
- """
45
+
35
46
  super().__init__(min_x=min_x, max_x=max_x, min_y=min_y, max_y=max_y, **kwargs)
36
47
 
37
48
  def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
@@ -42,6 +53,27 @@ class LimitRect(BeamElement):
42
53
 
43
54
 
44
55
  class LimitRacetrack(BeamElement):
56
+
57
+ '''
58
+ Beam element modeling a racetrack aperture limit.
59
+
60
+ Parameters
61
+ ----------
62
+ min_x : float
63
+ Lower x limit in meters.
64
+ max_x : float
65
+ Upper x limit in meters.
66
+ min_y : float
67
+ Lower y limit in meters.
68
+ max_y : float
69
+ Upper y limit in meters.
70
+ a : float
71
+ Horizontal semi-axis in meters of ellipse used for the rounding of the corners.
72
+ b : float
73
+ Vertical semi-axis in meters of ellipse used for the rounding of the corners.
74
+
75
+ '''
76
+
45
77
  _xofields = {
46
78
  'min_x': xo.Float64,
47
79
  'max_x': xo.Float64,
@@ -56,18 +88,6 @@ class LimitRacetrack(BeamElement):
56
88
 
57
89
  def __init__(self, min_x=-UNLIMITED, max_x=UNLIMITED, min_y=-UNLIMITED,
58
90
  max_y=UNLIMITED, a=0, b=0, **kwargs):
59
- """A racetrack shaped aperture
60
-
61
- This is a rectangular aperture with rounded corners
62
-
63
- Args:
64
- min_x (float): Lower x limit in m
65
- max_x (float): Upper x limit in m
66
- min_y (float): Lower y limit in m
67
- max_y (float): Upper y limit in m
68
- a (float): Horizontal semi-axis of ellipse in m for the rounding of the corners
69
- b (float): Vertical semi-axis of ellipse in m for the rounding of the corners
70
- """
71
91
 
72
92
  if "_xobject" in kwargs:
73
93
  self.xoinitialize(_xobject=kwargs['_xobject'])
@@ -90,6 +110,19 @@ class LimitRacetrack(BeamElement):
90
110
 
91
111
 
92
112
  class LimitEllipse(BeamElement):
113
+
114
+ '''
115
+ Beam element modeling an elliptical aperture limit.
116
+
117
+ Parameters
118
+ ----------
119
+ a : float
120
+ Horizontal semi-axis in meters.
121
+ b : float
122
+ Vertical semi-axis in meters.
123
+
124
+ '''
125
+
93
126
  _xofields = {
94
127
  'a_squ': xo.Float64,
95
128
  'b_squ': xo.Float64,
@@ -103,12 +136,7 @@ class LimitEllipse(BeamElement):
103
136
  return dct
104
137
 
105
138
  def __init__(self, a=None, b=None, a_squ=None, b_squ=None, **kwargs):
106
- """An elliptical aperture
107
139
 
108
- Args:
109
- a (float): Horizontal semi-axis of ellipse in m
110
- b (float): Vertical semi-axis of ellipse in m
111
- """
112
140
 
113
141
  if a is None and a_squ is None:
114
142
  a = UNLIMITED
@@ -151,6 +179,23 @@ class LimitEllipse(BeamElement):
151
179
 
152
180
 
153
181
  class LimitPolygon(BeamElement):
182
+
183
+ '''
184
+ Beam element modeling a polygonal aperture limit.
185
+
186
+ Parameters
187
+ ----------
188
+ x_vertices : array_like
189
+ x coordinates of the vertices of the polygon in meters.
190
+ y_vertices : array_like
191
+ y coordinates of the vertices of the polygon in meters.
192
+
193
+ Notes
194
+ -----
195
+ The polygon is closed automatically by connecting the last and first vertex.
196
+
197
+ '''
198
+
154
199
  _xofields = {
155
200
  'x_vertices': xo.Float64[:],
156
201
  'y_vertices': xo.Float64[:],
@@ -181,14 +226,7 @@ class LimitPolygon(BeamElement):
181
226
  n_threads='n_impacts')}
182
227
 
183
228
  def __init__(self, x_vertices=None, y_vertices=None, **kwargs):
184
- """An aperture of arbitrary shape described by a polygon
185
229
 
186
- Note: The polygon is closed automatically by connecting the last and first vertices.
187
-
188
- Args:
189
- x_vertices (list of float): Horizontal coordinates of the vertices in m
190
- y_vertices (list of float): Vertical coordinates of the vertices in m
191
- """
192
230
 
193
231
  if '_xobject' in kwargs.keys():
194
232
  super().__init__(**kwargs)
@@ -290,6 +328,25 @@ class LimitPolygon(BeamElement):
290
328
  return (cx,cy)
291
329
 
292
330
  class LimitRectEllipse(BeamElement):
331
+
332
+ '''
333
+ Element modeling an aperture limit given by the intersection of
334
+ a symmetric LimitRect and a LimitEllipse.
335
+
336
+ The particles are lost if they exceed either the rect or ellipse aperture.
337
+
338
+ Parameters
339
+ ----------
340
+ max_x : float
341
+ Horizontal semi-axis of rect in meters.
342
+ max_y : float
343
+ Vertical semi-axis of rect in meters.
344
+ a : float
345
+ Horizontal semi-axis of ellipse in meters.
346
+ b : float
347
+ Vertical semi-axis of ellipse in meters.
348
+ '''
349
+
293
350
  _xofields = {
294
351
  'max_x': xo.Float64,
295
352
  'max_y': xo.Float64,
@@ -302,16 +359,6 @@ class LimitRectEllipse(BeamElement):
302
359
  self, max_x=UNLIMITED, max_y=UNLIMITED, a_squ=None, b_squ=None,
303
360
  a=None, b=None, **kwargs
304
361
  ):
305
- """An intersection of a symmetric LimitRect and a LimitEllipse
306
-
307
- The particles are lost if they exceed either the rect or ellipse aperture
308
-
309
- Args:
310
- max_x (float): Horizontal semi-axis of rect in m
311
- max_y (float): Vertical semi-axis of rect in m
312
- a (float): Horizontal semi-axis of ellipse in m
313
- b (float): Vertical semi-axis of ellipse in m
314
- """
315
362
 
316
363
  if a is None and a_squ is None:
317
364
  a = UNLIMITED
@@ -362,6 +409,21 @@ class LimitRectEllipse(BeamElement):
362
409
 
363
410
 
364
411
  class LongitudinalLimitRect(BeamElement):
412
+
413
+ '''Beam element introducing a limit on the longitudinal coordinates.
414
+
415
+ Parameters
416
+ ----------
417
+ min_zeta : float
418
+ Lower limit on zeta coordinate in meters.
419
+ max_zeta : float
420
+ Upper limit on zeta coordinate in meters.
421
+ min_pzeta : float
422
+ Lower limit on pzeta coordinate.
423
+ max_pzeta : float
424
+ Upper limit on pzeta coordinate.
425
+ '''
426
+
365
427
  _xofields = {
366
428
  'min_zeta': xo.Float64,
367
429
  'max_zeta': xo.Float64,
@@ -370,16 +432,7 @@ class LongitudinalLimitRect(BeamElement):
370
432
  }
371
433
 
372
434
  def __init__(self, min_zeta=-UNLIMITED, max_zeta=UNLIMITED, min_pzeta=-UNLIMITED, max_pzeta=UNLIMITED, **kwargs):
373
- """A limit on longitudinal coordinates
374
-
375
- Particles are lost if they exceed either of the limits placed on the longitudinal coordinates
376
435
 
377
- Args:
378
- min_zeta (float): lower limit on zeta coordinate in m
379
- max_zeta (float): upper limit on zeta coordinate in m
380
- min_pzeta (float): lower limit on pzeta coordinate
381
- max_pzeta (float): upper limit on pzeta coordinate
382
- """
383
436
  super().__init__(min_zeta=min_zeta, max_zeta=max_zeta, min_pzeta=min_pzeta, max_pzeta=max_pzeta, **kwargs)
384
437
 
385
438
  def get_backtrack_element(self, _context=None, _buffer=None, _offset=None):
@@ -17,9 +17,14 @@ from ..internal_record import RecordIndex, RecordIdentifier
17
17
 
18
18
  class ReferenceEnergyIncrease(BeamElement):
19
19
 
20
- '''Beam element modeling a change of reference energy (acceleration, deceleration). Parameters:
20
+ '''Beam element modeling a change of reference energy (acceleration,
21
+ deceleration).
22
+
23
+ Parameters
24
+ ----------
25
+ Delta_p0c : float
26
+ Change in reference energy in eV. Default is ``0``.
21
27
 
22
- - Delta_p0c [eV]: Change in reference energy. Default is ``0``.
23
28
  '''
24
29
 
25
30
  _xofields = {
@@ -35,9 +40,6 @@ class ReferenceEnergyIncrease(BeamElement):
35
40
 
36
41
  class Marker(BeamElement):
37
42
  """A marker beam element with no effect on the particles.
38
-
39
- Parameters:
40
- - name (str): Name of the element
41
43
  """
42
44
 
43
45
  _xofields = {
@@ -56,9 +58,14 @@ class Marker(BeamElement):
56
58
 
57
59
 
58
60
  class Drift(BeamElement):
59
- '''Beam element modeling a drift section. Parameters:
61
+ '''Beam element modeling a drift section.
62
+
63
+ Parameters
64
+ ----------
65
+
66
+ length : float
67
+ Length of the drift section in meters. Default is ``0``.
60
68
 
61
- - length [m]: Length of the drift section. Default is ``0``.
62
69
  '''
63
70
 
64
71
  _xofields = {
@@ -76,11 +83,17 @@ class Drift(BeamElement):
76
83
 
77
84
 
78
85
  class Cavity(BeamElement):
79
- '''Beam element modeling an RF cavity. Parameters:
86
+ '''Beam element modeling an RF cavity.
87
+
88
+ Parameters
89
+ ----------
90
+ voltage : float
91
+ Voltage of the RF cavity in Volts. Default is ``0``.
92
+ frequency : float
93
+ Frequency of the RF cavity in Hertz. Default is ``0``.
94
+ lag : float
95
+ Phase seen by the reference particle in degrees. Default is ``0``.
80
96
 
81
- - voltage [V]: Voltage of the RF cavity. Default is ``0``.
82
- - frequency [Hz]: Frequency of the RF cavity. Default is ``0``.
83
- - lag [deg]: Phase seen by the reference particle. Default is ``0``.
84
97
  '''
85
98
 
86
99
  _xofields = {
@@ -102,10 +115,14 @@ class Cavity(BeamElement):
102
115
 
103
116
 
104
117
  class XYShift(BeamElement):
105
- '''Beam element modeling an transverse shift of the reference system. Parameters:
118
+ '''Beam element modeling an transverse shift of the reference system.
106
119
 
107
- - dx [m]: Horizontal shift. Default is ``0``.
108
- - dy [m]: Vertical shift. Default is ``0``.
120
+ Parameters
121
+ ----------
122
+ dx : float
123
+ Horizontal shift in meters. Default is ``0``.
124
+ dy : float
125
+ Vertical shift in meters. Default is ``0``.
109
126
 
110
127
  '''
111
128
  _xofields = {
@@ -125,6 +142,31 @@ class XYShift(BeamElement):
125
142
 
126
143
 
127
144
  class Elens(BeamElement):
145
+ '''Beam element modeling a hollow electron lens.
146
+
147
+ Parameters
148
+ ----------
149
+ inner_radius : float
150
+ Inner radius of the electron lens in meters. Default is ``0``.
151
+ outer_radius : float
152
+ Outer radius of the electron lens in meters. Default is ``0``.
153
+ current : float
154
+ Current of the electron lens in Ampere. Default is ``0``.
155
+ elens_length : float
156
+ Length of the electron lens in meters. Default is ``0``.
157
+ voltage : float
158
+ Voltage of the electron lens in Volts. Default is ``0``.
159
+ residual_kick_x : float
160
+ Residual kick in the horizontal plane in radians. Default is ``0``.
161
+ residual_kick_y : float
162
+ Residual kick in the vertical plane in radians. Default is ``0``.
163
+ coefficients_polynomial : array
164
+ Array of coefficients of the polynomial. Default is ``[0]``.
165
+ polynomial_order : int
166
+ Order of the polynomial. Default is ``0``.
167
+
168
+ '''
169
+
128
170
  # if array is needed we do it like this
129
171
  # _xofields={'inner_radius': xo.Float64[:]}
130
172
  _xofields={
@@ -186,6 +228,27 @@ class Elens(BeamElement):
186
228
 
187
229
  class Wire(BeamElement):
188
230
 
231
+ '''Beam element modeling a wire (used for long range beam-beam compensation).
232
+
233
+ Parameters
234
+ ----------
235
+
236
+ L_phy : float
237
+ Physical length of the wire in meters. Default is ``0``.
238
+ L_int : float
239
+ Interaction length of the wire in meters. Default is ``0``.
240
+ current : float
241
+ Current of the wire in Ampere. Default is ``0``.
242
+ xma : float
243
+ Horizontal position of the wire in meters. Default is ``0``.
244
+ yma : float
245
+ Vertical position of the wire in meters. Default is ``0``.
246
+ post_subtract_px : float
247
+ Horizontal post-subtraction kick in radians. Default is ``0``.
248
+ post_subtract_py : float
249
+ Vertical post-subtraction kick in radians. Default is ``0``.
250
+ '''
251
+
189
252
  _xofields={
190
253
  'L_phy' : xo.Float64,
191
254
  'L_int' : xo.Float64,
@@ -230,9 +293,13 @@ class Wire(BeamElement):
230
293
 
231
294
 
232
295
  class SRotation(BeamElement):
233
- '''Beam element modeling an rotation of the reference system around the s axis. Parameters:
296
+ '''Beam element modeling an rotation of the reference system around the s axis.
297
+
298
+ Parameters
299
+ ----------
234
300
 
235
- - angle [deg]: Rotation angle. Default is ``0``.
301
+ angle : float
302
+ Rotation angle in degrees. Default is ``0``.
236
303
 
237
304
  '''
238
305
 
@@ -289,9 +356,13 @@ class SRotation(BeamElement):
289
356
 
290
357
 
291
358
  class XRotation(BeamElement):
292
- '''Beam element modeling an rotation of the reference system around the x axis. Parameters:
359
+ '''Beam element modeling an rotation of the reference system around the x axis.
293
360
 
294
- - angle [deg]: Rotation angle. Default is ``0``.
361
+ Parameters
362
+ ----------
363
+
364
+ angle : float
365
+ Rotation angle in degrees. Default is ``0``.
295
366
 
296
367
  '''
297
368
 
@@ -368,9 +439,13 @@ class XRotation(BeamElement):
368
439
  _context=_context, _buffer=_buffer, _offset=_offset)
369
440
 
370
441
  class YRotation(BeamElement):
371
- '''Beam element modeling an rotation of the reference system around the y axis. Parameters:
442
+ '''Beam element modeling an rotation of the reference system around the y axis.
443
+
444
+ Parameters
445
+ ----------
372
446
 
373
- - angle [deg]: Rotation angle. Default is ``0``.
447
+ angle : float
448
+ Rotation angle in degrees. Default is ``0``.
374
449
 
375
450
  '''
376
451
 
@@ -451,9 +526,13 @@ class YRotation(BeamElement):
451
526
  _context=_context, _buffer=_buffer, _offset=_offset)
452
527
 
453
528
  class ZetaShift(BeamElement):
454
- '''Beam element modeling a longitudinal translation of the reference system. Parameters:
529
+ '''Beam element modeling a time delat.
530
+
531
+ Parameters
532
+ ----------
455
533
 
456
- - dzeta [m]: Translation in the longitudinal plane. Default is ``0``.
534
+ dzeta : float
535
+ Time shift dzeta in meters. Default is ``0``.
457
536
 
458
537
  '''
459
538
 
@@ -488,14 +567,23 @@ class SynchrotronRadiationRecord(xo.HybridClass):
488
567
 
489
568
 
490
569
  class Multipole(BeamElement):
491
- '''Beam element modeling a thin magnetic multipole. Parameters:
492
-
493
- - order [int]: Horizontal shift. Default is ``0``.
494
- - knl [m^-n, array]: Normalized integrated strength of the normal components.
495
- - ksl [m^-n, array]: Normalized integrated strength of the skew components.
496
- - hxl [rad]: Rotation angle of the reference trajectory in the horizontal plane.
497
- - hyl [rad]: Rotation angle of the reference trajectory in the vertical plane.
498
- - length [m]: Length of the originating thick multipole.
570
+ '''Beam element modeling a thin magnetic multipole.
571
+
572
+ Parameters
573
+ ----------
574
+
575
+ knl : array
576
+ Normalized integrated strength of the normal components in units of m^-n.
577
+ ksl : array
578
+ Normalized integrated strength of the skew components in units of m^-n.
579
+ order : int
580
+ Order of the multipole. Default is ``0``.
581
+ hxl : float
582
+ Rotation angle of the reference trajectory in the horizontal plane in radians. Default is ``0``.
583
+ hyl : float
584
+ Rotation angle of the reference trajectory in the vertical plane in radians. Default is ``0``.
585
+ length : float
586
+ Length of the originating thick multipole. Default is ``0``.
499
587
 
500
588
  '''
501
589
 
@@ -572,10 +660,14 @@ class Multipole(BeamElement):
572
660
 
573
661
 
574
662
  class SimpleThinQuadrupole(BeamElement):
575
- """An optimised version of a quadrupole with zero knl[0], ksl, hxl, hyl, and length.
576
- Parameters:
663
+ """An specialized version of Multipole to model a thin quadrupole
664
+ (knl[0], ksl, hxl, hyl are all zero).
577
665
 
578
- - knl [m^-n, array]: Normalized integrated strength of the normal components.
666
+ Parameters
667
+ ----------
668
+ knl : array
669
+ Normalized integrated strength of the normal components in units of m^-n.
670
+ Must be of length 2.
579
671
 
580
672
  """
581
673
 
@@ -632,13 +724,15 @@ class SimpleThinQuadrupole(BeamElement):
632
724
 
633
725
 
634
726
  class SimpleThinBend(BeamElement):
635
- """An optimised version of a dipole with zero ksl and hyl. Parameters:
636
-
637
- - knl [m^-n, array]: Normalized integrated strength of the normal components.
638
- - hxl [rad]: Rotation angle of the reference trajectory in the horizontal plane.
639
- - length [m]: Length of the originating thick multipole.
640
-
641
- """
727
+ '''A specialized version of Multipole to model a thin bend (ksl, hyl are all zero).
728
+ knl : array
729
+ Normalized integrated strength of the normal components in units of m^-n.
730
+ Must be of length 1.
731
+ hxl : float
732
+ Rotation angle of the reference trajectory in the horizontal plane in radians. Default is ``0``.
733
+ length : float
734
+ Length of the originating thick bend. Default is ``0``.
735
+ '''
642
736
 
643
737
  _xofields={
644
738
  'knl': xo.Float64[1],
@@ -693,20 +787,26 @@ class SimpleThinBend(BeamElement):
693
787
  class RFMultipole(BeamElement):
694
788
  '''Beam element modeling a thin modulated multipole, with strengths dependent on the z coordinate:
695
789
 
696
- kn(z) = k_n cos(2pi w tau + pn/180*pi)
697
-
698
- ks[n](z) = k_n cos(2pi w tau + pn/180*pi)
699
-
700
- Its parameters are:
701
-
702
- - order [int]: Horizontal shift. Default is ``0``.
703
- - frequency [Hz]: Frequency of the RF cavity. Default is ``0``.
704
- - knl [m^-n, array]: Normalized integrated strength of the normal components.
705
- - ksl [m^-n, array]: Normalized integrated strength of the skew components.
706
- - pn [deg, array]: Phase of the normal components.
707
- - ps [deg, array]: Phase of the skew components.
708
- - voltage [V]: Longitudinal voltage. Default is ``0``.
709
- - lag [deg]: Longitudinal phase seen by the reference particle. Default is ``0``.
790
+ Parameters
791
+ ----------
792
+ order : int
793
+ Order of the multipole. Default is ``0``.
794
+ knl : array
795
+ Normalized integrated strength of the normal components in units of m^-n.
796
+ Must be of length ``order+1``.
797
+ ksl : array
798
+ Normalized integrated strength of the skew components in units of m^-n.
799
+ Must be of length ``order+1``.
800
+ pn : array
801
+ Phase of the normal components in degrees. Must be of length ``order+1``.
802
+ ps : array
803
+ Phase of the skew components in degrees. Must be of length ``order+1``.
804
+ voltage : float
805
+ Longitudinal voltage. Default is ``0``.
806
+ lag : float
807
+ Longitudinal phase seen by the reference particle. Default is ``0``.
808
+ frequency : float
809
+ Frequency in Hertz. Default is ``0``.
710
810
 
711
811
  '''
712
812
 
@@ -804,12 +904,18 @@ class RFMultipole(BeamElement):
804
904
 
805
905
 
806
906
  class DipoleEdge(BeamElement):
807
- '''Beam element modeling a dipole edge. Parameters:
808
-
809
- - h [1/m]: Curvature.
810
- - e1 [rad]: Face angle.
811
- - hgap [m]: Equivalent gap.
812
- - fint []: Fringe integral.
907
+ '''Beam element modeling a dipole edge (see MAD-X manual for detaild description).
908
+
909
+ Parameters
910
+ ----------
911
+ h : float
912
+ Curvature in 1/m.
913
+ e1 : float
914
+ Face angle in rad.
915
+ hgap : float
916
+ Equivalent gap in m.
917
+ fint : float
918
+ Fringe integral.
813
919
 
814
920
  '''
815
921
 
@@ -1084,9 +1190,24 @@ class LinearTransferMatrix(BeamElement):
1084
1190
  def beta_y_1(self):
1085
1191
  return self.beta_prod_y*self.beta_ratio_y
1086
1192
 
1193
+ class FirstOrderTaylorMap(BeamElement):
1087
1194
 
1195
+ '''
1196
+ First order Taylor map.
1197
+
1198
+ Parameters
1199
+ ----------
1200
+ length : float
1201
+ length of the element in meters.
1202
+ m0 : array_like
1203
+ 6x1 array of the zero order Taylor map coefficients.
1204
+ m1 : array_like
1205
+ 6x6 array of the first order Taylor map coefficients.
1206
+ radiation_flag : int
1207
+ Flag for synchrotron radiation. 0 - no radiation, 1 - radiation on.
1208
+
1209
+ '''
1088
1210
 
1089
- class FirstOrderTaylorMap(BeamElement):
1090
1211
  isthick = True
1091
1212
 
1092
1213
  _xofields={
@@ -1,5 +1,7 @@
1
1
  import numpy as np
2
2
 
3
+ import xtrack as xt
4
+
3
5
  class LinearRescale():
4
6
 
5
7
  def __init__(self, knob_name, v0, dv):
@@ -14,7 +16,6 @@ def _footprint_with_linear_rescale(linear_rescale_on_knobs, line, kwargs):
14
16
 
15
17
  assert len(linear_rescale_on_knobs) == 1, (
16
18
  'Only one linear rescale is supported for now')
17
- from xtrack.tracker import _temp_knobs
18
19
 
19
20
  knobs_0 = {}
20
21
  for rr in linear_rescale_on_knobs:
@@ -22,7 +23,7 @@ def _footprint_with_linear_rescale(linear_rescale_on_knobs, line, kwargs):
22
23
  v0 = rr.v0
23
24
  knobs_0[nn] = v0
24
25
 
25
- with _temp_knobs(line, knobs_0):
26
+ with xt._temp_knobs(line, knobs_0):
26
27
  fp = line.get_footprint(**kwargs)
27
28
 
28
29
  _fp0_ref = fp.__dict__.copy() # for debugging
@@ -37,7 +38,7 @@ def _footprint_with_linear_rescale(linear_rescale_on_knobs, line, kwargs):
37
38
  knobs_1 = knobs_0.copy()
38
39
  knobs_1[nn] = v0 + dv
39
40
 
40
- with _temp_knobs(line, knobs_1):
41
+ with xt._temp_knobs(line, knobs_1):
41
42
  fp1 = line.get_footprint(**kwargs)
42
43
 
43
44
  delta_qx = (fp1.qx - qx0) / dv * (line.vars[nn]._value - v0)
@@ -136,7 +137,6 @@ class Footprint():
136
137
  line.track(particles, num_turns=self.n_turns, turn_by_turn_monitor=True)
137
138
  print('Done tracking.')
138
139
 
139
-
140
140
  ctx2np = line._context.nparray_from_context_array
141
141
  assert np.all(ctx2np(particles.state == 1)), (
142
142
  'Some particles were lost during tracking')