xtrack 0.72.0__tar.gz → 0.72.2__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 (263) hide show
  1. {xtrack-0.72.0/xtrack.egg-info → xtrack-0.72.2}/PKG-INFO +1 -1
  2. xtrack-0.72.2/tests/test_acceleration.py +366 -0
  3. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_line.py +16 -2
  4. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_madnginterface.py +0 -2
  5. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_radiation_equilibrium_emittances.py +1 -1
  6. xtrack-0.72.2/xtrack/_version.py +1 -0
  7. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements.py +10 -0
  8. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/exciter.py +10 -1
  9. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/line.py +7 -4
  10. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/particles/particles.py +16 -1
  11. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/tracker.py +1 -1
  12. {xtrack-0.72.0 → xtrack-0.72.2/xtrack.egg-info}/PKG-INFO +1 -1
  13. xtrack-0.72.0/tests/test_acceleration.py +0 -174
  14. xtrack-0.72.0/xtrack/_version.py +0 -1
  15. {xtrack-0.72.0 → xtrack-0.72.2}/LICENSE +0 -0
  16. {xtrack-0.72.0 → xtrack-0.72.2}/MANIFEST.in +0 -0
  17. {xtrack-0.72.0 → xtrack-0.72.2}/README.md +0 -0
  18. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/__init__.py +0 -0
  19. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/base_classes.py +0 -0
  20. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/BB6D.py +0 -0
  21. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  22. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/__init__.py +0 -0
  23. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/beambeam.py +0 -0
  24. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/boost.py +0 -0
  25. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  26. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  27. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/qgauss.py +0 -0
  28. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/slicing.py +0 -0
  29. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/be_beamfields/spacecharge.py +0 -0
  30. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/elements.py +0 -0
  31. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/line.py +0 -0
  32. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/mathlibs.py +0 -0
  33. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/particles.py +0 -0
  34. {xtrack-0.72.0 → xtrack-0.72.2}/ducktrack/temp_pyparticles.py +0 -0
  35. {xtrack-0.72.0 → xtrack-0.72.2}/pyproject.toml +0 -0
  36. {xtrack-0.72.0 → xtrack-0.72.2}/setup.cfg +0 -0
  37. {xtrack-0.72.0 → xtrack-0.72.2}/setup.py +0 -0
  38. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_amplitude_detuning.py +0 -0
  39. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  40. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_apertures.py +0 -0
  41. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_attr_replicas_and_slices.py +0 -0
  42. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_cavity_absolute_time.py +0 -0
  43. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_chromatic_functions_vs_madx.py +0 -0
  44. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_coasting.py +0 -0
  45. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_collective_tracker.py +0 -0
  46. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_collimation.py +0 -0
  47. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_element_characterization_functions.py +0 -0
  48. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_element_internal_record.py +0 -0
  49. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_elements.py +0 -0
  50. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_elements_classflags.py +0 -0
  51. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_elements_thick.py +0 -0
  52. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_environment.py +0 -0
  53. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  54. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  55. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_footprint.py +0 -0
  56. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_freeze_longitudinal.py +0 -0
  57. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_full_rings.py +0 -0
  58. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_h6_sps_beamline.py +0 -0
  59. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_hvkick.py +0 -0
  60. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_ions.py +0 -0
  61. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_lhc_match_phase_15.py +0 -0
  62. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_lumi.py +0 -0
  63. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_mad_writer.py +0 -0
  64. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_madloader.py +0 -0
  65. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_and_track_from_element.py +0 -0
  66. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_coupling_knob.py +0 -0
  67. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_nested.py +0 -0
  68. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_optics_and_ip_knob.py +0 -0
  69. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  70. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_orbit_bump.py +0 -0
  71. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_match_tune_chroma_cminus.py +0 -0
  72. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_monitor.py +0 -0
  73. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_multiline.py +0 -0
  74. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_multisetter.py +0 -0
  75. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_multispecies.py +0 -0
  76. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_new_madloader.py +0 -0
  77. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_particles_api.py +0 -0
  78. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_periodic_symmetric_twiss_and_match.py +0 -0
  79. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_pipeline.py +0 -0
  80. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_prebuild_kernels.py +0 -0
  81. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_ps_against_ptc.py +0 -0
  82. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_ps_multiturn_twiss.py +0 -0
  83. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_psb_chicane.py +0 -0
  84. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_pyht_interface.py +0 -0
  85. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_radial_steering.py +0 -0
  86. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_radiation.py +0 -0
  87. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_random_gen.py +0 -0
  88. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_random_gen_exp.py +0 -0
  89. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_random_gen_gauss.py +0 -0
  90. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_random_gen_ruth.py +0 -0
  91. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_rbend_rbarc.py +0 -0
  92. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_rf_track.py +0 -0
  93. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_rotation_signs.py +0 -0
  94. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_second_order_taylor_map.py +0 -0
  95. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_seeds.py +0 -0
  96. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_slice_and_insert_with_replicas.py +0 -0
  97. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_slice_elements.py +0 -0
  98. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_slicing.py +0 -0
  99. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  100. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_spacecharge_in_ring.py +0 -0
  101. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_sps_thick.py +0 -0
  102. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_survey.py +0 -0
  103. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_tapering.py +0 -0
  104. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_thick_lhc.py +0 -0
  105. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_tilt_shifts.py +0 -0
  106. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_tracker.py +0 -0
  107. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_trajectory_correcton.py +0 -0
  108. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_twiss.py +0 -0
  109. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_twiss_vs_madx_psb.py +0 -0
  110. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_vs_madx.py +0 -0
  111. {xtrack-0.72.0 → xtrack-0.72.2}/tests/test_xmask_orbit_correction.py +0 -0
  112. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/__init__.py +0 -0
  113. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/__init__.py +0 -0
  114. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  115. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  116. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  117. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/lhc_match/__init__.py +0 -0
  118. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  119. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  120. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  121. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/base_element.py +0 -0
  122. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/__init__.py +0 -0
  123. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures.py +0 -0
  124. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  125. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  126. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  127. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  128. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  129. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  130. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/beam_interaction.py +0 -0
  131. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/bend.h +0 -0
  132. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  133. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
  134. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  135. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift.h +0 -0
  136. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
  137. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  138. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  139. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  140. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  141. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  142. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/elens.h +0 -0
  143. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  144. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  145. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
  146. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  147. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  148. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  149. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  150. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  151. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  152. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  153. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  154. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  155. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  156. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
  157. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  158. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  159. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  160. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  161. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  162. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  163. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  164. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  165. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  166. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  167. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  168. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  169. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  170. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  171. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  172. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  173. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
  174. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
  175. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  176. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  177. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  178. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  179. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  180. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  181. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  182. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
  183. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  184. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  185. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  186. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/wire.h +0 -0
  187. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  188. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  189. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  190. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  191. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/rft_element.py +0 -0
  192. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/slice_elements.py +0 -0
  193. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  194. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/environment.py +0 -0
  195. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/footprint.py +0 -0
  196. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/general.py +0 -0
  197. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/headers/atomicadd.h +0 -0
  198. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/headers/checks.h +0 -0
  199. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/headers/constants.h +0 -0
  200. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/headers/particle_states.h +0 -0
  201. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/headers/synrad_spectrum.h +0 -0
  202. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/internal_record.py +0 -0
  203. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/json.py +0 -0
  204. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/linear_normal_form.py +0 -0
  205. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/loss_location_refinement/__init__.py +0 -0
  206. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  207. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/lumi.py +0 -0
  208. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_loader.py +0 -0
  209. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_parser/__init__.py +0 -0
  210. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_parser/env_writer.py +0 -0
  211. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_parser/loader.py +0 -0
  212. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_parser/madx.lark +0 -0
  213. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_parser/parse.py +0 -0
  214. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/mad_writer.py +0 -0
  215. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/madng_interface.py +0 -0
  216. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/match.py +0 -0
  217. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/__init__.py +0 -0
  218. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/beam_position_monitor.h +0 -0
  219. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/beam_position_monitor.py +0 -0
  220. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/beam_profile_monitor.h +0 -0
  221. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/beam_profile_monitor.py +0 -0
  222. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/beam_size_monitor.h +0 -0
  223. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/beam_size_monitor.py +0 -0
  224. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/last_turns_monitor.h +0 -0
  225. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/last_turns_monitor.py +0 -0
  226. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/particles_monitor.h +0 -0
  227. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/monitors/particles_monitor.py +0 -0
  228. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/multiline/__init__.py +0 -0
  229. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/multiline/multiline.py +0 -0
  230. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/multiline/shared_knobs.py +0 -0
  231. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/multisetter/__init__.py +0 -0
  232. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/multisetter/multisetter.py +0 -0
  233. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/particles/__init__.py +0 -0
  234. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/particles/constants.py +0 -0
  235. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/particles/rng_src/base_rng.h +0 -0
  236. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/particles/rng_src/particles_rng.h +0 -0
  237. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/pipeline/__init__.py +0 -0
  238. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/pipeline/core.py +0 -0
  239. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/pipeline/manager.py +0 -0
  240. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/pipeline/multitracker.py +0 -0
  241. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/progress_indicator.py +0 -0
  242. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/__init__.py +0 -0
  243. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_generators.py +0 -0
  244. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_src/exponential.h +0 -0
  245. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  246. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_src/normal.h +0 -0
  247. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_src/rutherford.h +0 -0
  248. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_src/uniform.h +0 -0
  249. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/random/random_src/uniform_accurate.h +0 -0
  250. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/slicing.py +0 -0
  251. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/survey.py +0 -0
  252. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/synctime.py +0 -0
  253. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/tapering.py +0 -0
  254. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/targets.py +0 -0
  255. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/tracker_data.py +0 -0
  256. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/tracker_src/tracker.h +0 -0
  257. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/trajectory_correction.py +0 -0
  258. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/twiss.py +0 -0
  259. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack/twissplot.py +0 -0
  260. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack.egg-info/SOURCES.txt +0 -0
  261. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack.egg-info/dependency_links.txt +0 -0
  262. {xtrack-0.72.0 → xtrack-0.72.2}/xtrack.egg-info/requires.txt +0 -0
  263. {xtrack-0.72.0 → xtrack-0.72.2}/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.72.0
3
+ Version: 0.72.2
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,366 @@
1
+ # copyright ############################### #
2
+ # This file is part of the Xtrack Package. #
3
+ # Copyright (c) CERN, 2021. #
4
+ # ######################################### #
5
+
6
+ import json
7
+ import pathlib
8
+
9
+ import numpy as np
10
+ import pandas as pd
11
+ from cpymad.madx import Madx
12
+ from scipy.constants import c as clight
13
+
14
+ import xobjects as xo
15
+ import xpart as xp
16
+ import xtrack as xt
17
+ from xobjects.test_helpers import for_all_test_contexts
18
+
19
+ test_data_folder = pathlib.Path(
20
+ __file__).parent.joinpath('../test_data').absolute()
21
+
22
+
23
+ @for_all_test_contexts
24
+ def test_acceleration(test_context):
25
+ Delta_p0c = 450e9/10*23e-6 # ramp rate 450GeV/10s
26
+
27
+ fname_line = test_data_folder.joinpath(
28
+ 'sps_w_spacecharge/line_no_spacecharge_and_particle.json')
29
+
30
+ with open(fname_line, 'r') as fid:
31
+ input_data = json.load(fid)
32
+ line = xt.Line.from_dict(input_data['line'])
33
+
34
+ energy_increase = xt.ReferenceEnergyIncrease(Delta_p0c=Delta_p0c)
35
+ line.append_element(energy_increase, 'energy_increase')
36
+
37
+ line.build_tracker(_context=test_context)
38
+
39
+ # Assume only first cavity is active
40
+ frequency = line.get_elements_of_type(xt.Cavity)[0][0].frequency
41
+ voltage = line.get_elements_of_type(xt.Cavity)[0][0].voltage
42
+ # Assuming proton and beta=1
43
+ stable_z = np.arcsin(Delta_p0c/voltage)/frequency/2/np.pi*clight
44
+
45
+ p_co = line.find_closed_orbit(particle_ref=xp.Particles.from_dict(
46
+ input_data['particle']))
47
+
48
+ xo.assert_allclose(p_co._xobject.zeta[0], stable_z, atol=0, rtol=1e-2)
49
+
50
+
51
+ @for_all_test_contexts(excluding=('ContextPyopencl',))
52
+ def test_energy_program(test_context):
53
+
54
+ df = pd.read_csv(test_data_folder / 'psb_chicane/Ramp_and_RF_functions.dat',
55
+ sep='\t', skiprows=2,
56
+ names=['t_s', 'E_kin_GeV', 'V1_MV', 'phi1_rad', 'V2_MV', 'phi2_rad'])
57
+ E_kin_GeV = df.E_kin_GeV.values
58
+ t_s = df.t_s.values
59
+
60
+ # Shift to enhance change in revolution frequency
61
+ E_min = np.min(E_kin_GeV)
62
+ E_max = np.max(E_kin_GeV)
63
+ E_kin_GeV = E_min/100 + (E_kin_GeV - E_min)
64
+ # Shift the time scale for testing purposes
65
+ t_s = t_s
66
+
67
+ # Load mad model and apply element shifts
68
+ mad = Madx(stdout=False)
69
+ mad.call(str(test_data_folder / 'psb_chicane/psb.seq'))
70
+ mad.call(str(test_data_folder / 'psb_chicane/psb_fb_lhc.str'))
71
+ mad.input('''
72
+ beam, particle=PROTON, pc=0.5708301551893517;
73
+ use, sequence=psb1;
74
+ twiss;
75
+ ''')
76
+
77
+ line = xt.Line.from_madx_sequence(mad.sequence.psb1, allow_thick=True,
78
+ deferred_expressions=True)
79
+ line.particle_ref = xt.Particles(mass0=xt.PROTON_MASS_EV,
80
+ gamma0=mad.sequence.psb1.beam.gamma)
81
+
82
+ line.build_tracker(_context=test_context)
83
+
84
+ # Attach energy program
85
+ ep = xt.EnergyProgram(t_s=t_s, kinetic_energy0=E_kin_GeV*1e9)
86
+ line.energy_program = ep
87
+
88
+ line['br1.acwf7l1.1'].voltage = 2e6
89
+ line['br1.acwf7l1.1'].frequency = 1e3
90
+
91
+ # test to_dict and from_dict
92
+ lbefore = line
93
+ line_dict = line.to_dict()
94
+ line = xt.Line.from_dict(line_dict)
95
+ assert np.all(line.vars.get_table().name == lbefore.vars.get_table().name)
96
+
97
+ line = line.copy()
98
+ assert np.all(line.vars.get_table().name == lbefore.vars.get_table().name)
99
+
100
+ line.build_tracker(_context=test_context)
101
+
102
+ p_test = line.build_particles()
103
+ line.enable_time_dependent_vars = True
104
+ n_turn_test = 5000
105
+ monitor = xt.ParticlesMonitor(num_particles=len(p_test.zeta), start_at_turn=0,
106
+ stop_at_turn=n_turn_test,
107
+ _context=test_context)
108
+ for ii in range(n_turn_test):
109
+ line.track(p_test, turn_by_turn_monitor=monitor)
110
+
111
+ beta_at_turn = monitor.beta0[0, :]
112
+ gamma_at_turn = 1 / np.sqrt(1 - beta_at_turn**2)
113
+
114
+ t_turn_ref = np.cumsum(line.get_length()/clight/beta_at_turn)
115
+ t_turn_ref = t_turn_ref - t_turn_ref[0]
116
+ E_kin_turn = line.particle_ref.mass0 * (monitor.gamma0[0, :] - 1)
117
+
118
+ t_check = np.linspace(0, 20e-3, 1000)
119
+ E_check = np.interp(t_check, t_turn_ref, E_kin_turn)
120
+ E_check_ref = np.interp(t_check, t_s, E_kin_GeV*1e9)
121
+ xo.assert_allclose(E_check, E_check_ref, atol=0, rtol=2e-3)
122
+
123
+ t_turn_check = line.energy_program.get_t_s_at_turn(np.arange(n_turn_test))
124
+ xo.assert_allclose(t_turn_check, t_turn_ref, atol=0, rtol=6e-4)
125
+
126
+ p0c_check = line.energy_program.get_p0c_at_t_s(t_check)
127
+ p0c_ref = np.interp(t_check,
128
+ t_turn_check,
129
+ line.particle_ref.mass0 * gamma_at_turn * beta_at_turn)
130
+ xo.assert_allclose(p0c_check, p0c_ref, atol=0, rtol=1e-3)
131
+
132
+ kinetic_energy0_check = line.energy_program.get_kinetic_energy0_at_t_s(t_check)
133
+ kinetic_energy0_ref = np.interp(t_check,
134
+ t_turn_check,
135
+ line.particle_ref.mass0 * (gamma_at_turn - 1))
136
+ xo.assert_allclose(kinetic_energy0_check, kinetic_energy0_ref, atol=0, rtol=2e-3)
137
+
138
+ beta0_check = line.energy_program.get_beta0_at_t_s(t_check)
139
+ beta0_ref = np.interp(t_check, t_turn_check, beta_at_turn)
140
+ xo.assert_allclose(beta0_check, beta0_ref, atol=0, rtol=1e-3)
141
+
142
+ frev_check = line.energy_program.get_frev_at_t_s(t_check)
143
+ frev_ref = np.interp(t_check, t_turn_check[:-1], 1/np.diff(t_turn_ref))
144
+ xo.assert_allclose(frev_check, frev_ref, atol=0, rtol=4e-5)
145
+
146
+ p0c_increse_per_turn_check = line.energy_program.get_p0c_increse_per_turn_at_t_s(
147
+ t_check)
148
+ p0c_increse_per_turn_ref = np.interp(
149
+ t_check, t_turn_check[:-1], np.diff(monitor.p0c[0, :]))
150
+ xo.assert_allclose(p0c_increse_per_turn_check - p0c_increse_per_turn_ref, 0,
151
+ atol=5e-5 * p0c_ref[0], rtol=0)
152
+
153
+ line.enable_time_dependent_vars = False
154
+ line.vars['t_turn_s'] = 20e-3
155
+
156
+ E_kin_expected = np.interp(line.vv['t_turn_s'], t_s, E_kin_GeV*1e9)
157
+ E_tot_expected = E_kin_expected + line.particle_ref.mass0
158
+ xo.assert_allclose(
159
+ E_tot_expected, line.particle_ref.energy0[0], rtol=1e-4, atol=0)
160
+ xo.assert_allclose(
161
+ E_kin_expected, line.particle_ref.kinetic_energy0[0], rtol=1e-4, atol=0)
162
+
163
+ tw = line.twiss(method='6d')
164
+ # To check that it does not change
165
+ xo.assert_allclose(tw.zeta[0], -13.48, rtol=0, atol=1e-4)
166
+ xo.assert_allclose(line.particle_ref.mass0 * tw.gamma0, E_tot_expected,
167
+ atol=0, rtol=1e-12)
168
+
169
+ line.vars['t_turn_s'] = 0
170
+ line.vars['on_chicane_k0'] = 0
171
+ tw = line.twiss(method='6d')
172
+ xo.assert_allclose(tw.zeta[0], 0, rtol=0, atol=1e-12)
173
+ xo.assert_allclose(line.particle_ref.mass0 * tw.gamma0, line.particle_ref.mass0 + E_kin_turn[0],
174
+ rtol=1e-10, atol=0)
175
+
176
+ @for_all_test_contexts(excluding=('ContextPyopencl',))
177
+ def test_acceleration_transverse_shrink(test_context):
178
+
179
+ mad = Madx(stdout=False)
180
+
181
+ # Load mad model and apply element shifts
182
+ mad.input(f'''
183
+ call, file = '{str(test_data_folder)}/psb_chicane/psb.seq';
184
+ call, file = '{str(test_data_folder)}/psb_chicane/psb_fb_lhc.str';
185
+ beam;
186
+ use, sequence=psb1;
187
+ ''')
188
+
189
+ line = xt.Line.from_madx_sequence(mad.sequence.psb1,
190
+ deferred_expressions=True)
191
+ e_kin_start_eV = 160e6
192
+ line.particle_ref = xt.Particles(mass0=xt.PROTON_MASS_EV, q0=1.,
193
+ energy0=xt.PROTON_MASS_EV + e_kin_start_eV)
194
+
195
+ # Slice to gain some tracking speed
196
+ line.slice_thick_elements(
197
+ slicing_strategies=[
198
+ xt.Strategy(slicing=xt.Teapot(1)),
199
+ ])
200
+ line.build_tracker(_context=test_context)
201
+
202
+ # User-defined energy ramp
203
+ t_s = np.array([0., 0.0006, 0.0008, 0.001 , 0.0012, 0.0014, 0.0016, 0.0018,
204
+ 0.002 , 0.0022, 0.0024, 0.0026, 0.0028, 0.003, 0.01, 0.1])
205
+ E_kin_GeV = np.array([0.16000000,0.16000000,
206
+ 0.16000437, 0.16001673, 0.16003748, 0.16006596, 0.16010243, 0.16014637,
207
+ 0.16019791, 0.16025666, 0.16032262, 0.16039552, 0.16047524, 0.16056165,
208
+ 0.163586, 0.20247050000000014])
209
+
210
+ # Enhance energy swing to better see the effect of energy on beam size
211
+ E_kin_GeV -= 0.140
212
+
213
+ # Go away from half integer
214
+ opt = line.match(
215
+ #verbose=True,
216
+ method='4d',
217
+ solve=False,
218
+ vary=[
219
+ xt.Vary('kbrqfcorr', step=1e-4),
220
+ xt.Vary('kbrqdcorr', step=1e-4),
221
+ ],
222
+ targets = [
223
+ xt.Target('qx', value=4.15, tol=1e-5, scale=1),
224
+ xt.Target('qy', value=4.18, tol=1e-5, scale=1),
225
+ ]
226
+ )
227
+ opt.solve()
228
+
229
+
230
+ # Attach energy program to the line
231
+ line.energy_program = xt.EnergyProgram(t_s=t_s, kinetic_energy0=E_kin_GeV*1e9)
232
+
233
+ # Plot energy and revolution frequency vs time
234
+ t_plot = np.linspace(0, 10e-3, 20)
235
+ E_kin_plot = line.energy_program.get_kinetic_energy0_at_t_s(t_plot)
236
+ f_rev_plot = line.energy_program.get_frev_at_t_s(t_plot)
237
+
238
+ # import matplotlib.pyplot as plt
239
+ # plt.close('all')
240
+ # plt.figure(1, figsize=(6.4 * 1.5, 4.8))
241
+ # ax1 = plt.subplot(2,2,1)
242
+ # plt.plot(t_plot * 1e3, E_kin_plot * 1e-6)
243
+ # plt.ylabel(r'$E_{kin}$ [MeV]')
244
+ # ax2 = plt.subplot(2,2,3, sharex=ax1)
245
+ # plt.plot(t_plot * 1e3, f_rev_plot * 1e-3)
246
+ # plt.ylabel(r'$f_{rev}$ [kHz]')
247
+ # plt.xlabel('t [ms]')
248
+
249
+ # Setup frequency of the RF cavity to stay on the second harmonic of the
250
+ # revolution frequency during the acceleration
251
+
252
+ t_rf = np.linspace(0, 3e-3, 100) # time samples for the frequency program
253
+ f_rev = line.energy_program.get_frev_at_t_s(t_rf)
254
+ h_rf = 2 # harmonic number
255
+ f_rf = h_rf * f_rev # frequency program
256
+
257
+ # Build a function with these samples and link it to the cavity
258
+ line.functions['fun_f_rf'] = xt.FunctionPieceWiseLinear(x=t_rf, y=f_rf)
259
+ line.element_refs['br1.acwf5l1.1'].frequency = line.functions['fun_f_rf'](
260
+ line.vars['t_turn_s'])
261
+
262
+ # Setup voltage and lag
263
+ line.element_refs['br1.acwf5l1.1'].voltage = 3000 # V
264
+ line.element_refs['br1.acwf5l1.1'].lag = 0 # degrees (below transition energy)
265
+
266
+ # When setting line.vars['t_turn_s'] the reference energy and the rf frequency
267
+ # are updated automatically
268
+ line.vars['t_turn_s'] = 0
269
+ line.particle_ref.kinetic_energy0 # is 160.00000 MeV
270
+ line['br1.acwf5l1.1'].frequency # is 1983931.935 Hz
271
+
272
+ line.vars['t_turn_s'] = 3e-3
273
+ line.particle_ref.kinetic_energy0 # is 160.56165 MeV
274
+ line['br1.acwf5l1.1'].frequency # is 1986669.0559674294
275
+
276
+ # Back to zero for tracking!
277
+ line.vars['t_turn_s'] = 0
278
+
279
+ # Track a few particles to visualize the longitudinal phase space
280
+ p_test = line.build_particles(x_norm=0, zeta=np.linspace(0, line.get_length(), 101))
281
+
282
+ # Enable time-dependent variables (t_turn_s and all the variables that depend on
283
+ # it are automatically updated at each turn)
284
+ line.enable_time_dependent_vars = True
285
+
286
+ # Track
287
+ line.track(p_test, num_turns=9000, turn_by_turn_monitor=True, with_progress=True)
288
+ mon = line.record_last_track
289
+
290
+ # Plot
291
+ # plt.subplot2grid((2,2), (0,1), rowspan=2)
292
+ # plt.plot(mon.zeta[:, -2000:].T, mon.delta[:, -2000:].T, color='C0')
293
+ # plt.xlabel(r'$\zeta$ [m]')
294
+ # plt.ylabel('$\delta$')
295
+ # plt.xlim(-40, 30)
296
+ # plt.ylim(-0.0025, 0.0025)
297
+ # plt.title('Last 2000 turns')
298
+ # plt.subplots_adjust(left=0.08, right=0.95, wspace=0.26)
299
+
300
+
301
+ # Check transverse beam size reduction
302
+ line['t_turn_s'] = 0
303
+ line.enable_time_dependent_vars = False
304
+
305
+ n_part_test = 500
306
+ # Generate Gaussian distribution with fixed rng seed
307
+ rng = np.random.default_rng(seed=123)
308
+ x_norm = rng.normal(loc=0, scale=1, size=n_part_test)
309
+ px_norm = rng.normal(loc=0, scale=1, size=n_part_test)
310
+ y_norm = rng.normal(loc=0, scale=1, size=n_part_test)
311
+ py_norm = rng.normal(loc=0, scale=1, size=n_part_test)
312
+
313
+ # rescale to have exact std dev.
314
+ x_norm = x_norm / np.std(x_norm)
315
+ px_norm = px_norm / np.std(px_norm)
316
+ y_norm = y_norm / np.std(y_norm)
317
+ py_norm = py_norm / np.std(py_norm)
318
+
319
+ p_test2 = line.build_particles(x_norm=x_norm, px_norm=px_norm,
320
+ y_norm=x_norm, py_norm=px_norm,
321
+ nemitt_x=1e-6, nemitt_y=1e-6,
322
+ delta=0)
323
+
324
+ line.enable_time_dependent_vars = True
325
+ line.track(p_test2, num_turns=10_000, turn_by_turn_monitor=True, with_progress=True)
326
+ mon2 = line.record_last_track
327
+
328
+ std_y = np.std(mon2.y, axis=0)
329
+ std_x = np.std(mon2.x, axis=0)
330
+
331
+ # Apply moving average filter
332
+ from scipy.signal import savgol_filter
333
+ std_y_smooth = savgol_filter(std_y, 10000, 2)
334
+ std_x_smooth = savgol_filter(std_x, 10000, 2)
335
+
336
+ i_turn_match = 1000
337
+ std_y_expected = std_y_smooth[i_turn_match] * np.sqrt(
338
+ mon2.gamma0[0, i_turn_match]* mon2.beta0[0, i_turn_match]
339
+ / mon2.gamma0[0, :] / mon2.beta0[0, :])
340
+ std_x_expected = std_x_smooth[i_turn_match] * np.sqrt(
341
+ mon2.gamma0[0, i_turn_match]* mon2.beta0[0, i_turn_match]
342
+ / mon2.gamma0[0, :] / mon2.beta0[0, :])
343
+
344
+ d_sigma_x = std_x_expected[0] - std_x_expected[-1]
345
+ d_sigma_y = std_y_expected[0] - std_y_expected[-1]
346
+
347
+ import xobjects as xo
348
+ xo.assert_allclose(std_y_expected[8000:9000].mean(),
349
+ std_y_smooth[8000:9000].mean(),
350
+ rtol=0, atol=0.03 * d_sigma_y)
351
+ xo.assert_allclose(std_x_expected[8000:9000].mean(),
352
+ std_x_smooth[8000:9000].mean(),
353
+ rtol=0, atol=0.03 * d_sigma_x)
354
+
355
+ # plt.figure(2)
356
+ # ax1 = plt.subplot(2,1,1)
357
+ # plt.plot(std_x, label='raw')
358
+ # plt.plot(std_x_smooth, label='smooth')
359
+ # plt.plot(std_x_expected, label='expected')
360
+ # plt.legend()
361
+
362
+ # ax2 = plt.subplot(2,1,2, sharex=ax1)
363
+ # plt.plot(std_y, label='raw')
364
+ # plt.plot(std_y_smooth, label='smooth')
365
+ # plt.plot(std_y_expected, label='expected')
366
+ # plt.show()
@@ -357,7 +357,6 @@ def test_to_pandas():
357
357
  def test_check_aperture():
358
358
 
359
359
  class ThickElement:
360
-
361
360
  length = 2.
362
361
  isthick = True
363
362
 
@@ -380,11 +379,16 @@ def test_check_aperture():
380
379
  'th3_ap_front': xt.LimitEllipse(a=1e-2, b=1e-2),
381
380
  'th3': ThickElement(),
382
381
  'dr6': xt.Drift(length=1),
382
+ 'th4_ap_entry': xt.LimitEllipse(a=1e-2, b=1e-2),
383
+ 'th4': ThickElement(),
384
+ 'th4_ap_exit': xt.LimitEllipse(a=1e-2, b=1e-2),
383
385
  },
384
386
  element_names=['dr1', 'm1_ap', 'dum', 'm1', 'dr2', 'm2', 'dr3',
385
387
  'th1_ap_front', 'dum', 'th1', 'dum', 'th1_ap_back',
386
388
  'dr4', 'th2', 'th2_ap_back',
387
- 'dr5', 'th3_ap_front', 'th3'])
389
+ 'dr5', 'th3_ap_front', 'th3', 'dr6',
390
+ 'th4_ap_entry', 'th4', 'th4_ap_exit'])
391
+
388
392
  df = line.check_aperture()
389
393
 
390
394
  expected_miss_upstream = [nn in ('m2', 'th2') for nn in df['name'].values]
@@ -1092,4 +1096,14 @@ def test_insert_repeated_names():
1092
1096
  line.insert_element("m2",xt.Marker(),at="d")
1093
1097
  assert line.element_names[0]=="m2"
1094
1098
 
1099
+ def test_line_table_unique_names():
1100
+ line = xt.Line(
1101
+ elements = {"obm": xt.Bend(length=0.5)},
1102
+ element_names= ["obm","obm"]
1103
+ )
1104
+ table = line.get_table()
1105
+ assert np.all(np.unique_counts(table.name).counts == 1), "Not all elements are unique"
1106
+ for name, env_name in zip(table.name, table.env_name):
1107
+ if name == '_end_point': continue
1108
+ assert line[name] == line[env_name]
1095
1109
 
@@ -7,7 +7,6 @@ import numpy as np
7
7
  test_data_folder = pathlib.Path(
8
8
  __file__).parent.joinpath('../test_data').absolute()
9
9
 
10
- # @pytest.mark.xfail(strict=False) # sometimes madng fails to start the process (to be investigated)
11
10
  def test_madng_twiss():
12
11
  rdts = ["f4000", "f3100", "f2020", "f1120"]
13
12
 
@@ -46,7 +45,6 @@ def test_madng_twiss():
46
45
  assert np.abs(tw_rdt.f2020).max() > 0
47
46
  assert np.abs(tw_rdt.f1120).max() > 0
48
47
 
49
- # @pytest.mark.xfail(strict=False) # sometimes madng fails to start the process (to be investigated)
50
48
  def test_madng_interface_with_multipole_errors_and_misalignments():
51
49
  line = xt.Line.from_json(test_data_folder /
52
50
  'hllhc15_thick/lhc_thick_with_knobs.json')
@@ -145,7 +145,7 @@ def test_eq_emitt(conf):
145
145
  xo.assert_allclose(ez, 3.5766e-6, atol=0, rtol=1e-4)
146
146
  checked = True
147
147
  elif tilt_machine_by_90_degrees and vertical_orbit_distortion and not wiggler_on:
148
- xo.assert_allclose(ex, 2.5039e-12, atol=0, rtol=4e-3)
148
+ xo.assert_allclose(ex, 2.5039e-12, atol=0, rtol=5e-3)
149
149
  xo.assert_allclose(ey, 7.0576e-10, atol=0, rtol=1e-4)
150
150
  xo.assert_allclose(ez, 3.5763e-6, atol=0, rtol=1e-4)
151
151
  checked = True
@@ -0,0 +1 @@
1
+ __version__ = '0.72.2'
@@ -51,6 +51,7 @@ class Marker(BeamElement):
51
51
  allow_loss_refinement = True
52
52
  has_backtrack = True
53
53
  allow_rot_and_shift = False
54
+ _skip_in_repr = ['_dummy']
54
55
 
55
56
  _extra_c_sources = [
56
57
  "/*gpufun*/\n"
@@ -83,6 +84,11 @@ class Drift(BeamElement):
83
84
  _pkg_root.joinpath('beam_elements/elements_src/drift_elem.h'),
84
85
  ]
85
86
 
87
+ def __init__(self, length=None, **kwargs):
88
+ if length: # otherwise length cannot be set as a positional argument
89
+ kwargs['length'] = length
90
+ super().__init__(**kwargs)
91
+
86
92
  @property
87
93
  def _thin_slice_class(self):
88
94
  return None
@@ -2441,6 +2447,10 @@ class SecondOrderTaylorMap(BeamElement):
2441
2447
  A `SecondOrderTaylorMap` object.
2442
2448
 
2443
2449
  '''
2450
+ if start == end:
2451
+ # start == end will lead to compute_one_turn_matrix_finite_differences() computing a
2452
+ # full one-turn response matrix (but here we would rather expect identity)
2453
+ raise NotImplementedError('end element must be after start element')
2444
2454
 
2445
2455
  if twiss_table is None:
2446
2456
  tw = line.twiss(reverse=False)
@@ -99,12 +99,21 @@ class Exciter(BeamElement):
99
99
  _extra_c_sources = [_pkg_root.joinpath('beam_elements/elements_src/exciter.h')]
100
100
 
101
101
 
102
- def __init__(self, *, samples=None, nsamples=None, sampling_frequency=0, frev=0, knl=[1], ksl=[], start_turn=0, duration=None, _xobject=None, **kwargs):
102
+ def __init__(self, *, samples=None, nsamples=None, sampling_frequency=0, frev=0, knl=None, ksl=None, start_turn=0, duration=None, _xobject=None, **kwargs):
103
103
 
104
104
  if _xobject is not None:
105
105
  super().__init__(_xobject=_xobject)
106
106
 
107
107
  else:
108
+ # The default is needed, as we wish to be able to instantiate
109
+ # elements without properties (empty elements can be templates).
110
+ if knl is None and ksl is None:
111
+ knl = [0]
112
+ ksl = []
113
+ elif knl is None:
114
+ knl = []
115
+ elif ksl is None:
116
+ ksl = []
108
117
 
109
118
  # sanitize knl and ksl array length
110
119
  n = max(len(knl), len(ksl))
@@ -3213,13 +3213,13 @@ class Line:
3213
3213
  i_next_aperture = 0
3214
3214
 
3215
3215
  for iee in progress(range(i_prev_aperture, num_elements), desc='Checking aperture'):
3216
- if dont_need_aperture[elements_df.loc[iee, 'name']]:
3217
- continue
3218
-
3219
3216
  if elements_df.loc[iee, 'is_aperture']:
3220
3217
  i_prev_aperture = iee
3221
3218
  continue
3222
3219
 
3220
+ if dont_need_aperture[elements_df.loc[iee, 'name']]:
3221
+ continue
3222
+
3223
3223
  if i_next_aperture < iee:
3224
3224
  for ii in range(iee, num_elements):
3225
3225
  if elements_df.loc[ii, 'is_aperture']:
@@ -4060,6 +4060,8 @@ class Line:
4060
4060
  return self.vv[key]
4061
4061
  elif hasattr(self, 'lines') and key in self.lines: # Want to reuse the method for the env
4062
4062
  return self.lines[key]
4063
+ elif "::" in key and (env_name := key.split("::")[0]) in self.element_dict:
4064
+ return self[env_name]
4063
4065
  else:
4064
4066
  raise KeyError(f'Name {key} not found')
4065
4067
 
@@ -5332,7 +5334,8 @@ class EnergyProgram:
5332
5334
  @t_turn_s_line.setter
5333
5335
  def t_turn_s_line(self, value):
5334
5336
  p0c = self.get_p0c_at_t_s(value)
5335
- self.line.particle_ref.update_p0c_and_energy_deviations(p0c=p0c)
5337
+ self.line.particle_ref.update_p0c_and_energy_deviations(
5338
+ p0c=p0c, update_pxpy=True)
5336
5339
 
5337
5340
  def to_dict(self):
5338
5341
  assert not self.needs_complete, 'EnergyProgram not completed'
@@ -212,6 +212,14 @@ class Particles(xo.HybridClass):
212
212
  raise NameError('`psigma` is not supported anymore.'
213
213
  'Please use `pzeta` instead.')
214
214
 
215
+ accepted_args = set(self._xofields.keys()) | {
216
+ 'energy0', 'tau', 'pzeta', 'mass_ratio', 'mass', 'kinetic_energy0',
217
+ '_context', '_buffer', '_offset', 'p0',
218
+ }
219
+ if set(kwargs.keys()) - accepted_args:
220
+ raise NameError(f'Invalid argument(s) provided: '
221
+ f'{set(kwargs.keys()) - accepted_args}')
222
+
215
223
  per_part_input_vars = (
216
224
  self.per_particle_vars +
217
225
  ((xo.Float64, 'energy0'),
@@ -2175,7 +2183,7 @@ class Particles(xo.HybridClass):
2175
2183
  computed_value=_charge_ratio,
2176
2184
  mask=mask)
2177
2185
 
2178
- def update_p0c_and_energy_deviations(self, p0c):
2186
+ def update_p0c_and_energy_deviations(self, p0c, update_pxpy=False):
2179
2187
 
2180
2188
  assert np.isscalar(p0c), 'p0c must be a scalar'
2181
2189
 
@@ -2195,6 +2203,13 @@ class Particles(xo.HybridClass):
2195
2203
  self._update_energy_deviations(mask=mask, delta=new_delta)
2196
2204
  self._update_zeta(mask=mask, zeta=self.zeta * self.beta0 / old_beta0)
2197
2205
 
2206
+ if update_pxpy:
2207
+ if isinstance(self._context, xo.ContextPyopencl):
2208
+ raise NotImplementedError # Issue wiht masking
2209
+ scale_pxpy = old_p0c[mask] / new_p0c[mask]
2210
+ self.px[mask] *= scale_pxpy
2211
+ self.py[mask] *= scale_pxpy
2212
+
2198
2213
 
2199
2214
  def _mask_to_where(mask, ctx):
2200
2215
  if hasattr(mask, 'get'):
@@ -1470,7 +1470,7 @@ class Tracker:
1470
1470
 
1471
1471
  if self.line.energy_program is not None:
1472
1472
  p0c = self.line.particle_ref._xobject.p0c[0]
1473
- particles.update_p0c_and_energy_deviations(p0c)
1473
+ particles.update_p0c_and_energy_deviations(p0c, update_pxpy=True)
1474
1474
 
1475
1475
  def _handle_log(self, _session_to_resume, particles, log):
1476
1476
  if _session_to_resume is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtrack
3
- Version: 0.72.0
3
+ Version: 0.72.2
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