xtrack 0.32.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 (106) hide show
  1. {xtrack-0.32.0/xtrack.egg-info → xtrack-0.32.1}/PKG-INFO +1 -1
  2. xtrack-0.32.1/xtrack/_version.py +1 -0
  3. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures.py +104 -51
  4. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements.py +182 -61
  5. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/loss_location_refinement/loss_location_refinement.py +44 -0
  6. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/match.py +1 -1
  7. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/monitors/particles_monitor.py +23 -0
  8. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/multiline/multiline.py +12 -0
  9. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/multisetter/multisetter.py +32 -0
  10. {xtrack-0.32.0 → xtrack-0.32.1/xtrack.egg-info}/PKG-INFO +1 -1
  11. xtrack-0.32.0/xtrack/_version.py +0 -1
  12. {xtrack-0.32.0 → xtrack-0.32.1}/LICENSE +0 -0
  13. {xtrack-0.32.0 → xtrack-0.32.1}/MANIFEST.in +0 -0
  14. {xtrack-0.32.0 → xtrack-0.32.1}/README.md +0 -0
  15. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/__init__.py +0 -0
  16. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/base_classes.py +0 -0
  17. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/BB6D.py +0 -0
  18. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  19. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/__init__.py +0 -0
  20. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/beambeam.py +0 -0
  21. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/boost.py +0 -0
  22. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  23. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  24. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/qgauss.py +0 -0
  25. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/slicing.py +0 -0
  26. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/be_beamfields/spacecharge.py +0 -0
  27. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/elements.py +0 -0
  28. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/line.py +0 -0
  29. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/mathlibs.py +0 -0
  30. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/particles.py +0 -0
  31. {xtrack-0.32.0 → xtrack-0.32.1}/ducktrack/temp_pyparticles.py +0 -0
  32. {xtrack-0.32.0 → xtrack-0.32.1}/pyproject.toml +0 -0
  33. {xtrack-0.32.0 → xtrack-0.32.1}/setup.cfg +0 -0
  34. {xtrack-0.32.0 → xtrack-0.32.1}/setup.py +0 -0
  35. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/__init__.py +0 -0
  36. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/base_element.py +0 -0
  37. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/__init__.py +0 -0
  38. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  39. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  40. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  41. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  42. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  43. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  44. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/beam_interaction.py +0 -0
  45. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  46. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  47. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/drift.h +0 -0
  48. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/elens.h +0 -0
  49. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  50. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  51. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/lineartransfermatrix.h +0 -0
  52. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  53. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  54. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  55. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  56. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  57. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  58. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/wire.h +0 -0
  59. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  60. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  61. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  62. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  63. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/beam_elements/exciter.py +0 -0
  64. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/footprint.py +0 -0
  65. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/general.py +0 -0
  66. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/headers/checks.h +0 -0
  67. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/headers/constants.h +0 -0
  68. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/headers/particle_states.h +0 -0
  69. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/headers/synrad_spectrum.h +0 -0
  70. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/internal_record.py +0 -0
  71. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/jacobian.py +0 -0
  72. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/line.py +0 -0
  73. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/linear_normal_form.py +0 -0
  74. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/loss_location_refinement/__init__.py +0 -0
  75. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/mad_loader.py +0 -0
  76. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/monitors/__init__.py +0 -0
  77. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/monitors/last_turns_monitor.h +0 -0
  78. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/monitors/last_turns_monitor.py +0 -0
  79. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/monitors/particles_monitor.h +0 -0
  80. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/multiline/__init__.py +0 -0
  81. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/multiline/shared_knobs.py +0 -0
  82. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/multisetter/__init__.py +0 -0
  83. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/pipeline/__init__.py +0 -0
  84. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/pipeline/core.py +0 -0
  85. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/pipeline/manager.py +0 -0
  86. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/pipeline/multitracker.py +0 -0
  87. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/prebuild_kernels.py +0 -0
  88. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/prebuilt_kernels/_kernel_definitions.json +0 -0
  89. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/__init__.py +0 -0
  90. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/random_generators.py +0 -0
  91. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/random_src/exponential.h +0 -0
  92. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  93. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/random_src/normal.h +0 -0
  94. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/random_src/rutherford.h +0 -0
  95. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/random/random_src/uniform.h +0 -0
  96. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/survey.py +0 -0
  97. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/table.py +0 -0
  98. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/tapering.py +0 -0
  99. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/tracker.py +0 -0
  100. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/tracker_data.py +0 -0
  101. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/tracker_src/tracker.h +0 -0
  102. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack/twiss.py +0 -0
  103. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack.egg-info/SOURCES.txt +0 -0
  104. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack.egg-info/dependency_links.txt +0 -0
  105. {xtrack-0.32.0 → xtrack-0.32.1}/xtrack.egg-info/requires.txt +0 -0
  106. {xtrack-0.32.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.32.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
@@ -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={
@@ -24,6 +24,35 @@ def _skip_in_loss_location_refinement(element):
24
24
 
25
25
  class LossLocationRefinement:
26
26
 
27
+ '''
28
+ Class to refine the location of the lost particles within a line.
29
+
30
+ Parameters
31
+ ----------
32
+ line : xtrack.Line
33
+ Line for which the loss location refinement is performed.
34
+ backtrack_line : xtrack.Line (optional)
35
+ Line used to backtrack the lost particles. If None, the backtracking
36
+ line is automatically generated from the line.
37
+ n_theta : int
38
+ Number of angles used to generate the interpolating aperture model.
39
+ If None, the number of angles is automatically determined.
40
+ r_max : float
41
+ Radius larger than the largest aperture radius.
42
+ dr : float
43
+ Radius step used to generate the interpolating aperture model.
44
+ ds : float
45
+ Step in the `s` direction used to generate the interpolating aperture
46
+ model.
47
+ save_refine_lines : bool
48
+ If True, the lines used to refine the loss location are saved.
49
+ allowed_backtrack_types : list
50
+ List of element types through which the backtracking is allowed.
51
+ Elements exposing the attribute `allow_backtrack` are automatically
52
+ added to the list.
53
+
54
+ '''
55
+
27
56
  def __init__(self, line, backtrack_line=None,
28
57
  n_theta=None, r_max=None, dr=None, ds=None,
29
58
  save_refine_lines=False,
@@ -74,6 +103,20 @@ class LossLocationRefinement:
74
103
 
75
104
  def refine_loss_location(self, particles, i_apertures=None):
76
105
 
106
+ '''
107
+ Refine the location of the lost particles within the line.
108
+
109
+ Parameters
110
+ ----------
111
+ particles : xpart.Particles
112
+ Particles for which the loss location is refined.
113
+ i_apertures : list (optional)
114
+ List of indices of the apertures for which the loss location
115
+ is refined. If None, the loss location is refined for all
116
+ apertures.
117
+
118
+ '''
119
+
77
120
  if i_apertures is None:
78
121
  i_apertures = self.i_apertures
79
122
 
@@ -474,3 +517,4 @@ def characterize_aperture(line, i_aperture, n_theta, r_max, dr,
474
517
  _buffer=buffer_for_poly)
475
518
 
476
519
  return polygon, i_start
520
+
@@ -221,7 +221,7 @@ def match_line(line, vary, targets, restore_if_fail=True, solver=None,
221
221
  except Exception as err:
222
222
  if restore_if_fail:
223
223
  for ii, rr in enumerate(vary):
224
- line.vars[rr] = x0[ii]
224
+ line.vars[rr.name] = x0[ii]
225
225
  _print('\n')
226
226
  raise err
227
227
  _print('\n')
@@ -25,6 +25,29 @@ def _monitor_init(
25
25
  auto_to_numpy=True,
26
26
  ):
27
27
 
28
+ '''
29
+ Beam element logging the coordinates of the particles passing through it.
30
+
31
+ Parameters
32
+ ----------
33
+ start_at_turn: int
34
+ Turn at which the monitor starts logging the particles coordinates.
35
+ stop_at_turn: int
36
+ Turn at which the monitor stops logging the particles coordinates.
37
+ n_repetitions: int
38
+ Number of times the monitor repeats the logging of the particles.
39
+ repetition_period: int
40
+ Period in number of turns for the repetition of the logging of the particles.
41
+ num_particles: int
42
+ Number of particles to be logged.
43
+ particle_id_range: tuple of int
44
+ Range of particle ids to be logged.
45
+ auto_to_numpy: bool
46
+ If True, the data is automatically converted to numpy arrays when
47
+ accessed.
48
+
49
+ '''
50
+
28
51
  if _xobject is not None:
29
52
  self.xoinitialize(_xobject=_xobject)
30
53
  else:
@@ -10,6 +10,18 @@ import xfields as xf
10
10
 
11
11
  class Multiline:
12
12
 
13
+ '''
14
+ Class to manage multiple beam lines (they can optionally share the xdeps vars).
15
+
16
+ Parameters
17
+ ----------
18
+ lines: dict
19
+ Dictionary with the lines objects
20
+ link_vars: bool
21
+ If True, the variables are linked between the lines.
22
+
23
+ '''
24
+
13
25
  def __init__(self, lines: dict, link_vars=True):
14
26
  self.lines = {}
15
27
  self.lines.update(lines)
@@ -67,6 +67,23 @@ class MultiSetter(xo.HybridClass):
67
67
 
68
68
  def __init__(self, line, elements, field, index=None):
69
69
 
70
+ '''
71
+ Create object to efficiently set and get values of a specific field of
72
+ several elements of a line.
73
+
74
+ Parameters
75
+ ----------
76
+ line: xtrack.Line
77
+ Line in which the elements are mutated
78
+ elements: list of int or strings
79
+ List of indeces or names of the elements to be mutated.
80
+ field: str
81
+ Name of the field to be mutated.
82
+ index: int or None
83
+ If the field is an array, the index of the array to be mutated.
84
+
85
+ '''
86
+
70
87
  if isinstance(line, xt.Tracker):
71
88
  tracker = line
72
89
  else:
@@ -87,6 +104,11 @@ class MultiSetter(xo.HybridClass):
87
104
  self._tracker_buffer = tracker_buffer
88
105
 
89
106
  def get_values(self):
107
+
108
+ '''
109
+ Get the values of the multisetter fields.
110
+ '''
111
+
90
112
  out = self._context.zeros(len(self.offsets), dtype=np.float64)
91
113
  kernel = self._context.kernels.get_values_at_offsets
92
114
  kernel.set_n_threads(len(self.offsets))
@@ -94,6 +116,16 @@ class MultiSetter(xo.HybridClass):
94
116
  return out
95
117
 
96
118
  def set_values(self, values):
119
+
120
+ '''
121
+ Set the values of the multisetter fields.
122
+
123
+ Parameters
124
+ ----------
125
+ values: np.ndarray
126
+ Array of values to be set.
127
+ '''
128
+
97
129
  kernel = self._context.kernels.set_values_at_offsets
98
130
  kernel.set_n_threads(len(self.offsets))
99
131
  kernel(data=self, buffer=self._tracker_buffer.buffer,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtrack
3
- Version: 0.32.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
@@ -1 +0,0 @@
1
- __version__ = '0.32.0'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes