xtrack 0.60.0__tar.gz → 0.61.0__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 (246) hide show
  1. {xtrack-0.60.0/xtrack.egg-info → xtrack-0.61.0}/PKG-INFO +1 -1
  2. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/elements.py +49 -32
  3. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_elements.py +160 -22
  4. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_tracker.py +90 -0
  5. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_twiss.py +61 -1
  6. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/__init__.py +3 -3
  7. xtrack-0.61.0/xtrack/_version.py +1 -0
  8. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements.py +81 -75
  9. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +92 -35
  10. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/general.py +14 -1
  11. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/line.py +53 -0
  12. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/linear_normal_form.py +2 -0
  13. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/match.py +1 -10
  14. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/tracker.py +2 -1
  15. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/twiss.py +19 -3
  16. {xtrack-0.60.0 → xtrack-0.61.0/xtrack.egg-info}/PKG-INFO +1 -1
  17. xtrack-0.60.0/xtrack/_version.py +0 -1
  18. {xtrack-0.60.0 → xtrack-0.61.0}/LICENSE +0 -0
  19. {xtrack-0.60.0 → xtrack-0.61.0}/MANIFEST.in +0 -0
  20. {xtrack-0.60.0 → xtrack-0.61.0}/README.md +0 -0
  21. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/__init__.py +0 -0
  22. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/base_classes.py +0 -0
  23. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/BB6D.py +0 -0
  24. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  25. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/__init__.py +0 -0
  26. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/beambeam.py +0 -0
  27. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/boost.py +0 -0
  28. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  29. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  30. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/qgauss.py +0 -0
  31. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/slicing.py +0 -0
  32. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
  33. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/line.py +0 -0
  34. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/mathlibs.py +0 -0
  35. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/particles.py +0 -0
  36. {xtrack-0.60.0 → xtrack-0.61.0}/ducktrack/temp_pyparticles.py +0 -0
  37. {xtrack-0.60.0 → xtrack-0.61.0}/pyproject.toml +0 -0
  38. {xtrack-0.60.0 → xtrack-0.61.0}/setup.cfg +0 -0
  39. {xtrack-0.60.0 → xtrack-0.61.0}/setup.py +0 -0
  40. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_acceleration.py +0 -0
  41. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_amplitude_detuning.py +0 -0
  42. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  43. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_apertures.py +0 -0
  44. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_attr_replicas_and_slices.py +0 -0
  45. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_cavity_absolute_time.py +0 -0
  46. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
  47. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_coasting.py +0 -0
  48. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_collective_tracker.py +0 -0
  49. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_collimation.py +0 -0
  50. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_element_characterization_functions.py +0 -0
  51. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_element_internal_record.py +0 -0
  52. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_elements_classflags.py +0 -0
  53. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_elements_thick.py +0 -0
  54. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  55. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  56. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_footprint.py +0 -0
  57. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_freeze_longitudinal.py +0 -0
  58. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_full_rings.py +0 -0
  59. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_hvkick.py +0 -0
  60. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_ions.py +0 -0
  61. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_lhc_match_phase_15.py +0 -0
  62. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_line.py +0 -0
  63. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_lumi.py +0 -0
  64. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_mad_writer.py +0 -0
  65. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_madloader.py +0 -0
  66. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_and_track_from_element.py +0 -0
  67. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_coupling_knob.py +0 -0
  68. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_nested.py +0 -0
  69. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_optics_and_ip_knob.py +0 -0
  70. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  71. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_orbit_bump.py +0 -0
  72. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_match_tune_chroma_cminus.py +0 -0
  73. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_monitor.py +0 -0
  74. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_multiline.py +0 -0
  75. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_multisetter.py +0 -0
  76. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_multispecies.py +0 -0
  77. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_particles_api.py +0 -0
  78. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_pipeline.py +0 -0
  79. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_prebuild_kernels.py +0 -0
  80. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_ps_against_ptc.py +0 -0
  81. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_ps_multiturn_twiss.py +0 -0
  82. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_psb_chicane.py +0 -0
  83. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_pyht_interface.py +0 -0
  84. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_radial_steering.py +0 -0
  85. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_radiation.py +0 -0
  86. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
  87. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_random_gen.py +0 -0
  88. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_random_gen_exp.py +0 -0
  89. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_random_gen_gauss.py +0 -0
  90. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_random_gen_ruth.py +0 -0
  91. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_rf_track.py +0 -0
  92. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_rotation_signs.py +0 -0
  93. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_second_order_taylor_map.py +0 -0
  94. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_slice_and_insert_with_replicas.py +0 -0
  95. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_slice_elements.py +0 -0
  96. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_slicing.py +0 -0
  97. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  98. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_spacecharge_in_ring.py +0 -0
  99. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_sps_thick.py +0 -0
  100. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_survey.py +0 -0
  101. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_tapering.py +0 -0
  102. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_thick_lhc.py +0 -0
  103. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_tilt_shifts.py +0 -0
  104. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_trajectory_correcton.py +0 -0
  105. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_twiss_vs_madx_psb.py +0 -0
  106. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_var_cache.py +0 -0
  107. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_vs_madx.py +0 -0
  108. {xtrack-0.60.0 → xtrack-0.61.0}/tests/test_xmask_orbit_correction.py +0 -0
  109. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/__init__.py +0 -0
  110. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  111. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  112. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  113. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
  114. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  115. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  116. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  117. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/base_element.py +0 -0
  118. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/__init__.py +0 -0
  119. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures.py +0 -0
  120. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  121. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  122. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  123. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  124. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  125. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  126. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/beam_interaction.py +0 -0
  127. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
  128. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  129. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  130. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
  131. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
  132. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  133. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  134. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  135. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  136. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  137. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
  138. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  139. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  140. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/fringe.h +0 -0
  141. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/fringe_track.h +0 -0
  142. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  143. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  144. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  145. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  146. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  147. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  148. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  149. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  150. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  151. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  152. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
  153. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  154. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  155. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  156. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  157. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  158. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  159. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  160. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  161. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  162. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  163. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  164. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  165. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  166. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  167. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  168. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  169. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  170. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  171. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  172. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  173. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  174. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  175. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  176. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  177. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  178. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  179. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/wedge_track.h +0 -0
  180. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
  181. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  182. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  183. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  184. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  185. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/exciter.py +0 -0
  186. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/rft_element.py +0 -0
  187. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/slice_elements.py +0 -0
  188. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  189. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/footprint.py +0 -0
  190. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/headers/atomicadd.h +0 -0
  191. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/headers/checks.h +0 -0
  192. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/headers/constants.h +0 -0
  193. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/headers/particle_states.h +0 -0
  194. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/headers/synrad_spectrum.h +0 -0
  195. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/internal_record.py +0 -0
  196. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/loss_location_refinement/__init__.py +0 -0
  197. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  198. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/lumi.py +0 -0
  199. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/mad_loader.py +0 -0
  200. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/mad_writer.py +0 -0
  201. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/__init__.py +0 -0
  202. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/beam_position_monitor.h +0 -0
  203. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/beam_position_monitor.py +0 -0
  204. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
  205. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
  206. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/beam_size_monitor.h +0 -0
  207. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/beam_size_monitor.py +0 -0
  208. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/last_turns_monitor.h +0 -0
  209. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/last_turns_monitor.py +0 -0
  210. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/particles_monitor.h +0 -0
  211. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/monitors/particles_monitor.py +0 -0
  212. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/multiline/__init__.py +0 -0
  213. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/multiline/multiline.py +0 -0
  214. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/multiline/shared_knobs.py +0 -0
  215. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/multisetter/__init__.py +0 -0
  216. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/multisetter/multisetter.py +0 -0
  217. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/particles/__init__.py +0 -0
  218. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/particles/constants.py +0 -0
  219. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/particles/particles.py +0 -0
  220. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/particles/rng_src/base_rng.h +0 -0
  221. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
  222. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/pipeline/__init__.py +0 -0
  223. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/pipeline/core.py +0 -0
  224. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/pipeline/manager.py +0 -0
  225. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/pipeline/multitracker.py +0 -0
  226. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/progress_indicator.py +0 -0
  227. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/__init__.py +0 -0
  228. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/random_generators.py +0 -0
  229. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/random_src/exponential.h +0 -0
  230. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  231. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/random_src/normal.h +0 -0
  232. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/random_src/rutherford.h +0 -0
  233. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/random/random_src/uniform.h +0 -0
  234. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/slicing.py +0 -0
  235. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/survey.py +0 -0
  236. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/synctime.py +0 -0
  237. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/tapering.py +0 -0
  238. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/targets.py +0 -0
  239. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/tracker_data.py +0 -0
  240. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/tracker_src/tracker.h +0 -0
  241. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/trajectory_correction.py +0 -0
  242. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack/twissplot.py +0 -0
  243. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack.egg-info/SOURCES.txt +0 -0
  244. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack.egg-info/dependency_links.txt +0 -0
  245. {xtrack-0.60.0 → xtrack-0.61.0}/xtrack.egg-info/requires.txt +0 -0
  246. {xtrack-0.60.0 → xtrack-0.61.0}/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.60.0
3
+ Version: 0.61.0
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
@@ -651,14 +651,18 @@ class LinearTransferMatrix(Element):
651
651
  ("y_ref_1","","",0.0),
652
652
  ("py_ref_1","","",0.0),
653
653
  ("damping_rate_x","","",0.0),
654
+ ("damping_rate_px","","",0.0),
654
655
  ("damping_rate_y","","",0.0),
655
- ("damping_rate_s","","",0.0),
656
- ("equ_emit_x","","",0.0),
657
- ("equ_emit_y","","",0.0),
658
- ("equ_emit_s","","",0.0),
656
+ ("damping_rate_py","","",0.0),
657
+ ("damping_rate_zeta","","",0.0),
658
+ ("damping_rate_pzeta","","",0.0),
659
659
  ("gauss_noise_ampl_x","","",0.0),
660
+ ("gauss_noise_ampl_px","","",0.0),
660
661
  ("gauss_noise_ampl_y","","",0.0),
661
- ("gauss_noise_ampl_s","","",0.0)]
662
+ ("gauss_noise_ampl_py","","",0.0),
663
+ ("gauss_noise_ampl_zeta","","",0.0),
664
+ ("gauss_noise_ampl_pzeta","","",0.0),
665
+ ("damping_matrix","","",0.0),]
662
666
 
663
667
  def track(self,p):
664
668
  sin = p._m.sin
@@ -746,37 +750,50 @@ class LinearTransferMatrix(Element):
746
750
  p.y *= geo_emit_factor
747
751
  p.py = old_py * geo_emit_factor
748
752
 
749
- if self.damping_rate_x < 0.0 or self.damping_rate_y < 0.0 or self.damping_rate_s < 0.0:
750
- raise ValueError("Damping rates cannot be negative")
751
- if self.equ_emit_x < 0.0 or self.equ_emit_y < 0.0 or self.equ_emit_s < 0.0:
752
- raise ValueError("Equilibrium emittance cannot be negative")
753
- if self.damping_rate_x > 0.0:
754
- factor = 1.0-self.damping_rate_x/2
755
- p.x *= factor
756
- p.px *= factor
757
- if self.equ_emit_x > 0.0:
758
- p.px += np.sqrt(2.0*self.equ_emit_x*self.damping_rate_x/self.beta_x_1)*np.random.randn(len(p.px))
759
- if self.damping_rate_y > 0.0:
760
- factor = 1.0-self.damping_rate_y/2
761
- p.y *= factor
762
- p.py *= factor
763
- if self.equ_emit_y > 0.0:
764
- p.py += np.sqrt(2.0*self.equ_emit_y*self.damping_rate_y/self.beta_y_1)*np.random.randn(len(p.py))
765
- if self.damping_rate_s > 0.0:
766
- factor = 1.0-self.damping_rate_s/2
767
- p.zeta *= factor
768
- p.delta *= factor
769
- if self.equ_emit_s > 0.0:
770
- p.delta += np.sqrt(2.0*self.equ_emit_s*self.damping_rate_s/self.beta_s)*np.random.randn(len(p.delta))
771
-
772
- if self.gauss_noise_ampl_x < 0.0 or self.gauss_noise_ampl_y < 0.0 or self.gauss_noise_ampl_s < 0.0:
753
+ if not hasattr(self.damping_matrix,'__iter__'):
754
+ if (self.damping_rate_x < 0.0 or self.damping_rate_px < 0.0
755
+ or self.damping_rate_y < 0.0 or self.damping_rate_py < 0.0
756
+ or self.damping_rate_zeta < 0.0 or self.damping_rate_pzeta < 0.0):
757
+ raise ValueError("Damping rates cannot be negative")
758
+ if self.damping_rate_x > 0.0:
759
+ p.x *= 1.0-self.damping_rate_x
760
+ if self.damping_rate_px > 0.0:
761
+ p.px *= 1.0-self.damping_rate_px
762
+ if self.damping_rate_y > 0.0:
763
+ p.y *= 1.0-self.damping_rate_y
764
+ if self.damping_rate_py > 0.0:
765
+ p.py *= 1.0-self.damping_rate_py
766
+ if self.damping_rate_zeta > 0.0:
767
+ p.zeta *= 1.0-self.damping_rate_zeta
768
+ if self.damping_rate_pzeta > 0.0:
769
+ p.pzeta *= 1.0-self.damping_rate_pzeta
770
+ else:
771
+ assert np.shape(self.damping_matrix) == (6,6)
772
+ transformation = self.damping_matrix + np.identity(6)
773
+ p.x,p.px,p.y,p.py,p.zeta,p.pzeta = transformation[0,0]*p.x+transformation[0,1]*p.px+transformation[0,2]*p.y+transformation[0,3]*p.py+transformation[0,4]*p.zeta+transformation[0,5]*p.pzeta,\
774
+ transformation[1,0]*p.x+transformation[1,1]*p.px+transformation[1,2]*p.y+transformation[1,3]*p.py+transformation[1,4]*p.zeta+transformation[1,5]*p.pzeta,\
775
+ transformation[2,0]*p.x+transformation[2,1]*p.px+transformation[2,2]*p.y+transformation[2,3]*p.py+transformation[2,4]*p.zeta+transformation[2,5]*p.pzeta,\
776
+ transformation[3,0]*p.x+transformation[3,1]*p.px+transformation[3,2]*p.y+transformation[3,3]*p.py+transformation[3,4]*p.zeta+transformation[3,5]*p.pzeta,\
777
+ transformation[4,0]*p.x+transformation[4,1]*p.px+transformation[4,2]*p.y+transformation[4,3]*p.py+transformation[4,4]*p.zeta+transformation[4,5]*p.pzeta,\
778
+ transformation[5,0]*p.x+transformation[5,1]*p.px+transformation[5,2]*p.y+transformation[5,3]*p.py+transformation[5,4]*p.zeta+transformation[5,5]*p.pzeta
779
+
780
+
781
+ if (self.gauss_noise_ampl_x < 0.0 or self.gauss_noise_ampl_px < 0.0
782
+ or self.gauss_noise_ampl_y < 0.0 or self.gauss_noise_ampl_py < 0.0
783
+ or self.gauss_noise_ampl_zeta < 0.0 or self.gauss_noise_ampl_pzeta < 0.0):
773
784
  raise ValueError("Noise amplitude cannot be negative")
785
+ if self.gauss_noise_ampl_x > 0.0:
786
+ p.x += self.gauss_noise_ampl_x*np.random.randn(len(p.x))
774
787
  if self.gauss_noise_ampl_x > 0.0:
775
788
  p.px += self.gauss_noise_ampl_x*np.random.randn(len(p.px))
776
789
  if self.gauss_noise_ampl_y > 0.0:
777
- p.py += self.gauss_noise_ampl_y*np.random.randn(len(p.py))
778
- if self.gauss_noise_ampl_s > 0.0:
779
- p.delta += self.gauss_noise_ampl_s*np.random.randn(len(p.delta))
790
+ p.y += self.gauss_noise_ampl_y*np.random.randn(len(p.y))
791
+ if self.gauss_noise_ampl_py > 0.0:
792
+ p.py += self.gauss_noise_ampl_py*np.random.randn(len(p.py))
793
+ if self.gauss_noise_ampl_zeta > 0.0:
794
+ p.zeta += self.gauss_noise_ampl_zeta*np.random.randn(len(p.zeta))
795
+ if self.gauss_noise_ampl_pzeta > 0.0:
796
+ p.pzeta += self.gauss_noise_ampl_pzeta*np.random.randn(len(p.pzeta))
780
797
 
781
798
  # re-adding dispersion and closed orbit
782
799
  old_x=p.x
@@ -771,8 +771,11 @@ def test_simplified_accelerator_segment_uncorrelated_damping(test_context):
771
771
  y_ref_1 = 4E-2
772
772
  py_ref_1 = 5E-4
773
773
  damping_rate_x = 5E-4
774
+ damping_rate_px = 2E-4
774
775
  damping_rate_y = 1E-3
775
- damping_rate_s = 2E-3
776
+ damping_rate_py = 7E-3
777
+ damping_rate_zeta = 2E-3
778
+ damping_rate_pzeta = 1E-2
776
779
 
777
780
  dtk_particle = dtk.TestParticles(
778
781
  p0c=25.92e9,
@@ -798,26 +801,113 @@ def test_simplified_accelerator_segment_uncorrelated_damping(test_context):
798
801
  energy_increment=energy_increment,
799
802
  x_ref=(x_ref_0, x_ref_1), px_ref=(px_ref_0, px_ref_1),
800
803
  y_ref=(y_ref_0, y_ref_1), py_ref=(py_ref_0, py_ref_1),
801
- damping_rate_x = damping_rate_x,
802
- damping_rate_y = damping_rate_y,
803
- damping_rate_s = damping_rate_s)
804
+ damping_rate_x = damping_rate_x,damping_rate_px = damping_rate_px,
805
+ damping_rate_y = damping_rate_y,damping_rate_py = damping_rate_py,
806
+ damping_rate_zeta = damping_rate_zeta,damping_rate_pzeta = damping_rate_pzeta)
804
807
 
805
808
  arc.track(particles)
806
809
 
807
810
  dtk_arc = dtk.elements.LinearTransferMatrix(alpha_x_0=alpha_x_0, beta_x_0=beta_x_0, disp_x_0=disp_x_0,
808
- alpha_x_1=alpha_x_1, beta_x_1=beta_x_1, disp_x_1=disp_x_1,
809
- alpha_y_0=alpha_y_0, beta_y_0=beta_y_0, disp_y_0=disp_y_0,
810
- alpha_y_1=alpha_y_1, beta_y_1=beta_y_1, disp_y_1=disp_y_1,
811
- Q_x=Q_x, Q_y=Q_y,
812
- beta_s=beta_s, Q_s=Q_s,
813
- chroma_x=0.0, chroma_y=0.0,
814
- det_xx=0.0, det_xy=0.0, det_yy=0.0, det_yx=0.0,
815
- energy_ref_increment=energy_ref_increment,energy_increment=energy_increment,
816
- x_ref_0 = x_ref_0, px_ref_0 = px_ref_0, x_ref_1 = x_ref_1, px_ref_1 = px_ref_1,
817
- y_ref_0 = y_ref_0, py_ref_0 = py_ref_0, y_ref_1 = y_ref_1, py_ref_1 = py_ref_1,
818
- damping_rate_x = damping_rate_x,damping_rate_y = damping_rate_y,damping_rate_s = damping_rate_s)
811
+ alpha_x_1=alpha_x_1, beta_x_1=beta_x_1, disp_x_1=disp_x_1,
812
+ alpha_y_0=alpha_y_0, beta_y_0=beta_y_0, disp_y_0=disp_y_0,
813
+ alpha_y_1=alpha_y_1, beta_y_1=beta_y_1, disp_y_1=disp_y_1,
814
+ Q_x=Q_x, Q_y=Q_y,
815
+ beta_s=beta_s, Q_s=Q_s,
816
+ chroma_x=0.0, chroma_y=0.0,
817
+ det_xx=0.0, det_xy=0.0, det_yy=0.0, det_yx=0.0,
818
+ energy_ref_increment=energy_ref_increment,energy_increment=energy_increment,
819
+ x_ref_0 = x_ref_0, px_ref_0 = px_ref_0, x_ref_1 = x_ref_1, px_ref_1 = px_ref_1,
820
+ y_ref_0 = y_ref_0, py_ref_0 = py_ref_0, y_ref_1 = y_ref_1, py_ref_1 = py_ref_1,
821
+ damping_rate_x = damping_rate_x,damping_rate_px = damping_rate_px,
822
+ damping_rate_y = damping_rate_y,damping_rate_py = damping_rate_py,
823
+ damping_rate_zeta = damping_rate_zeta,damping_rate_pzeta = damping_rate_pzeta)
819
824
  dtk_arc.track(dtk_particle)
825
+
826
+ assert np.isclose(test_context.nparray_from_context_array(particles.x)[0],
827
+ dtk_particle.x, rtol=1e-14, atol=1e-14)
828
+ assert np.isclose(test_context.nparray_from_context_array(particles.px)[0],
829
+ dtk_particle.px, rtol=1e-14, atol=1e-14)
830
+ assert np.isclose(test_context.nparray_from_context_array(particles.y)[0],
831
+ dtk_particle.y, rtol=1e-14, atol=1e-14)
832
+ assert np.isclose(test_context.nparray_from_context_array(particles.py)[0],
833
+ dtk_particle.py, rtol=1e-14, atol=1e-14)
834
+ assert np.isclose(test_context.nparray_from_context_array(particles.zeta)[0],
835
+ dtk_particle.zeta, rtol=1e-14, atol=1e-14)
836
+ assert np.isclose(test_context.nparray_from_context_array(particles.delta)[0],
837
+ dtk_particle.delta, rtol=1e-14, atol=1e-14)
838
+
839
+ @for_all_test_contexts
840
+ def test_simplified_accelerator_segment_correlated_damping(test_context):
841
+ alpha_x_0 = -0.5
842
+ beta_x_0 = 100.0
843
+ disp_x_0 = 1.8
844
+ alpha_x_1 = 2.1
845
+ beta_x_1 = 2.0
846
+ disp_x_1 = 3.3
847
+ alpha_y_0 = -0.4
848
+ beta_y_0 = 8.0
849
+ disp_y_0 = -0.2
850
+ alpha_y_1 = 0.7
851
+ beta_y_1 = 0.3
852
+ disp_y_1 = -1.9
853
+ Q_x = 0.27
854
+ Q_y = 0.34
855
+ beta_s = 856.9
856
+ Q_s = 0.001
857
+ energy_ref_increment = 1.2E9
858
+ energy_increment = 4.8E8
859
+ x_ref_0 = -5E-3
860
+ px_ref_0 = 6E-4
861
+ x_ref_1 = 2E-2
862
+ px_ref_1 = -5E-5
863
+ y_ref_0 = -9E-2
864
+ py_ref_0 = 1E-4
865
+ y_ref_1 = 4E-2
866
+ py_ref_1 = 5E-4
867
+ damping_matrix = np.reshape(np.random.randn(36),(6,6))
868
+
869
+ dtk_particle = dtk.TestParticles(
870
+ p0c=25.92e9,
871
+ x=1e-3,
872
+ px=1e-5,
873
+ y=-2e-3,
874
+ py=-1.5e-5,
875
+ zeta=2.,
876
+ delta=2E-4)
877
+
878
+ particles = xp.Particles.from_dict(dtk_particle.to_dict(),
879
+ _context=test_context)
880
+
881
+
882
+ arc = xt.LineSegmentMap(_context=test_context,
883
+ alfx=(alpha_x_0, alpha_x_1), betx=(beta_x_0, beta_x_1),
884
+ dx=(disp_x_0, disp_x_1), dpx=(0.0, 0.0),
885
+ alfy=(alpha_y_0, alpha_y_1), bety=(beta_y_0, beta_y_1),
886
+ dy=(disp_y_0, disp_y_1), dpy=(0.0, 0.0),
887
+ qx=Q_x, qy=Q_y,
888
+ bets=beta_s, qs=Q_s,
889
+ energy_ref_increment=energy_ref_increment,
890
+ energy_increment=energy_increment,
891
+ x_ref=(x_ref_0, x_ref_1), px_ref=(px_ref_0, px_ref_1),
892
+ y_ref=(y_ref_0, y_ref_1), py_ref=(py_ref_0, py_ref_1),
893
+ damping_matrix = damping_matrix)
894
+
895
+ arc.track(particles)
820
896
 
897
+ dtk_arc = dtk.elements.LinearTransferMatrix(alpha_x_0=alpha_x_0, beta_x_0=beta_x_0, disp_x_0=disp_x_0,
898
+ alpha_x_1=alpha_x_1, beta_x_1=beta_x_1, disp_x_1=disp_x_1,
899
+ alpha_y_0=alpha_y_0, beta_y_0=beta_y_0, disp_y_0=disp_y_0,
900
+ alpha_y_1=alpha_y_1, beta_y_1=beta_y_1, disp_y_1=disp_y_1,
901
+ Q_x=Q_x, Q_y=Q_y,
902
+ beta_s=beta_s, Q_s=Q_s,
903
+ chroma_x=0.0, chroma_y=0.0,
904
+ det_xx=0.0, det_xy=0.0, det_yy=0.0, det_yx=0.0,
905
+ energy_ref_increment=energy_ref_increment,energy_increment=energy_increment,
906
+ x_ref_0 = x_ref_0, px_ref_0 = px_ref_0, x_ref_1 = x_ref_1, px_ref_1 = px_ref_1,
907
+ y_ref_0 = y_ref_0, py_ref_0 = py_ref_0, y_ref_1 = y_ref_1, py_ref_1 = py_ref_1,
908
+ damping_matrix = damping_matrix)
909
+ dtk_arc.track(dtk_particle)
910
+
821
911
  assert np.isclose(test_context.nparray_from_context_array(particles.x)[0],
822
912
  dtk_particle.x, rtol=1e-14, atol=1e-14)
823
913
  assert np.isclose(test_context.nparray_from_context_array(particles.px)[0],
@@ -841,9 +931,17 @@ def test_simplified_accelerator_segment_uncorrelated_damping_equilibrium(test_co
841
931
  Q_y = 0.22
842
932
  beta_s = 856.9
843
933
  Q_s = 0.015
844
- damping_rate_x = 5E-4
845
- damping_rate_y = 1E-3
934
+ damping_rate_h = 5E-4
935
+ damping_rate_v = 1E-3
846
936
  damping_rate_s = 2E-3
937
+
938
+ damping_rate_x = damping_rate_h/2
939
+ damping_rate_px = damping_rate_h/2
940
+ damping_rate_y = damping_rate_v/2
941
+ damping_rate_py = damping_rate_v/2
942
+ damping_rate_zeta = 0.0
943
+ damping_rate_pzeta = damping_rate_s
944
+
847
945
  energy = 45.6
848
946
  equ_emit_x = 0.3E-9
849
947
  equ_emit_y = 1E-12
@@ -852,6 +950,13 @@ def test_simplified_accelerator_segment_uncorrelated_damping_equilibrium(test_co
852
950
  beta_s = equ_length/equ_delta
853
951
  equ_emit_s = equ_length*equ_delta
854
952
 
953
+
954
+ gauss_noise_ampl_px = np.sqrt(equ_emit_x*damping_rate_h/beta_x_0)
955
+ gauss_noise_ampl_x = beta_x_0*gauss_noise_ampl_px
956
+ gauss_noise_ampl_py = np.sqrt(equ_emit_y*damping_rate_v/beta_y_0)
957
+ gauss_noise_ampl_y = beta_y_0*gauss_noise_ampl_py
958
+ gauss_noise_ampl_delta = np.sqrt(2*equ_emit_s*damping_rate_s/beta_s)
959
+
855
960
  npart = int(1E3)
856
961
  particles = xp.Particles(_context=test_context,
857
962
  x=np.random.randn(npart)*np.sqrt(equ_emit_x*beta_x_0),
@@ -863,7 +968,6 @@ def test_simplified_accelerator_segment_uncorrelated_damping_equilibrium(test_co
863
968
  p0c=energy*1E9)
864
969
  particles._init_random_number_generator()
865
970
 
866
-
867
971
  arc = xt.LineSegmentMap(_context=test_context,
868
972
  alfx=(alpha_x_0, alpha_x_0), betx=(beta_x_0, beta_x_0),
869
973
  dx=(0.0, 0.0), dpx=(0.0, 0.0),
@@ -871,10 +975,12 @@ def test_simplified_accelerator_segment_uncorrelated_damping_equilibrium(test_co
871
975
  dy=(0.0, 0.0), dpy=(0.0, 0.0),
872
976
  qx=Q_x, qy=Q_y,
873
977
  bets=beta_s, qs=Q_s,
874
- damping_rate_x = damping_rate_x,
875
- damping_rate_y = damping_rate_y,
876
- damping_rate_s = damping_rate_s,
877
- equ_emit_x=equ_emit_x, equ_emit_y=equ_emit_y, equ_emit_s=equ_emit_s)
978
+ damping_rate_x=damping_rate_x,damping_rate_px=damping_rate_px,
979
+ damping_rate_y=damping_rate_y,damping_rate_py=damping_rate_py,
980
+ damping_rate_zeta=0.0,damping_rate_pzeta=damping_rate_pzeta,
981
+ gauss_noise_ampl_x = gauss_noise_ampl_x, gauss_noise_ampl_px = gauss_noise_ampl_px,
982
+ gauss_noise_ampl_y = gauss_noise_ampl_y, gauss_noise_ampl_py = gauss_noise_ampl_py,
983
+ gauss_noise_ampl_zeta = 0.0, gauss_noise_ampl_pzeta = gauss_noise_ampl_delta)
878
984
 
879
985
  gamma_x = (1.0+alpha_x_0**2)/beta_x_0
880
986
  gamma_y = (1.0+alpha_y_0**2)/beta_y_0
@@ -903,6 +1009,38 @@ def test_simplified_accelerator_segment_uncorrelated_damping_equilibrium(test_co
903
1009
  assert np.isclose(equ_emit_s,equ_emit_s_0, rtol=1e-1, atol=1e-10)
904
1010
 
905
1011
 
1012
+ @for_all_test_contexts
1013
+ def test_simplified_accelerator_segment_correlated_noise(test_context):
1014
+ npart = int(1E6)
1015
+ scale = 1E-6
1016
+ random_matrix = np.reshape(np.random.rand(36),(6,6))
1017
+ data = np.transpose(np.random.multivariate_normal(np.zeros(6),random_matrix,npart))
1018
+ covariance_matrix = np.cov(data)
1019
+
1020
+ particles = xp.Particles(_context=test_context,
1021
+ x=np.zeros(npart),
1022
+ p0c=45E9)
1023
+ particles._init_random_number_generator()
1024
+
1025
+ arc = xt.LineSegmentMap(_context=test_context,
1026
+ betx=1.0, bety=1.0,bets=1.0,
1027
+ qx=0.0, qy=0.0, qs=0.0,
1028
+ gauss_noise_matrix=covariance_matrix*scale
1029
+ )
1030
+
1031
+ arc.track(particles)
1032
+ data = np.zeros((6,npart))
1033
+ particles.move(_context=xo.context_default)
1034
+ data[0,:] = particles.x
1035
+ data[1,:] = particles.px
1036
+ data[2,:] = particles.y
1037
+ data[3,:] = particles.py
1038
+ data[4,:] = particles.zeta
1039
+ data[5,:] = particles.pzeta
1040
+ cov = np.cov(data)/scale
1041
+ xo.assert_allclose(cov,covariance_matrix,atol=1E-4,rtol=0.1)
1042
+
1043
+
906
1044
  @for_all_test_contexts
907
1045
  def test_nonlinearlens(test_context):
908
1046
  mad = Madx(stdout=False)
@@ -719,3 +719,93 @@ def test_track_log_and_merit_function(pimms_mad, test_context):
719
719
  assert np.isclose(intensity[0], intensity_before, atol=1e-14, rtol=0)
720
720
  # The last log point is from the beginning of the last turn:
721
721
  assert np.isclose(intensity[-1], intensity_after, atol=0, rtol=1e-2)
722
+
723
+
724
+ @for_all_test_contexts
725
+ def test_init_io_buffer(test_context):
726
+ class TestElementRecord(xo.HybridClass):
727
+ _xofields = {
728
+ '_index': xt.RecordIndex,
729
+ 'record_field': xo.Int64[:],
730
+ 'record_at_element': xo.Int64[:],
731
+ }
732
+
733
+ class TestElement(xt.BeamElement):
734
+ _xofields={
735
+ 'element_field': xo.Int64,
736
+ }
737
+
738
+ _internal_record_class = TestElementRecord
739
+
740
+ _extra_c_sources = [
741
+ r'''
742
+ /*gpufun*/
743
+ void TestElement_track_local_particle(TestElementData el, LocalParticle* part0){
744
+ // Extract the record and record_index
745
+ TestElementRecordData record = TestElementData_getp_internal_record(el, part0);
746
+ RecordIndex record_index = NULL;
747
+ if (record){
748
+ record_index = TestElementRecordData_getp__index(record);
749
+ }
750
+
751
+ int64_t elem_field = TestElementData_get_element_field(el);
752
+
753
+ //start_per_particle_block (part0->part)
754
+ if (record) { // Record exists
755
+ // Get a slot in the record (this is thread safe)
756
+ int64_t i_slot = RecordIndex_get_slot(record_index);
757
+
758
+ if (i_slot>=0) { // Slot available
759
+ TestElementRecordData_set_record_field(
760
+ record,
761
+ i_slot,
762
+ elem_field
763
+ );
764
+ TestElementRecordData_set_record_at_element(
765
+ record,
766
+ i_slot,
767
+ LocalParticle_get_at_element(part)
768
+ );
769
+ }
770
+ }
771
+ //end_per_particle_block
772
+ }
773
+ '''
774
+ ]
775
+
776
+ line = xt.Line(elements=[
777
+ TestElement(element_field=3),
778
+ TestElement(element_field=4),
779
+ ])
780
+ line.build_tracker(_context=test_context)
781
+
782
+ record = line.start_internal_logging_for_elements_of_type(
783
+ TestElement,
784
+ capacity=1000,
785
+ )
786
+
787
+ num_turns = 100
788
+
789
+ part = xp.Particles(_context=test_context, x=[1e-3, 2e-3, 3e-3])
790
+ line.track(part, num_turns=num_turns)
791
+
792
+ num_recorded = record._index.num_recorded
793
+ num_particles = len(part.x)
794
+
795
+ record.move(_context=xo.ContextCpu())
796
+
797
+ assert num_recorded == (2 * num_particles * num_turns)
798
+ assert np.sum(record.record_field == 3) == num_particles * num_turns
799
+ assert np.sum(record.record_field == 4) == num_particles * num_turns
800
+ assert np.all(record.record_field[:num_recorded][
801
+ record.record_at_element[:num_recorded] == 0] == 3)
802
+ assert np.all(record.record_field[:num_recorded][
803
+ record.record_at_element[:num_recorded] == 1] == 4)
804
+ assert np.all(record.record_field[num_recorded:] == 0)
805
+
806
+ # Now we stop logging and manually reset to mimic the situation where the
807
+ # record is manually flushed.
808
+ line.stop_internal_logging_for_elements_of_type(TestElement)
809
+ line.tracker._init_io_buffer()
810
+
811
+ assert line.tracker.io_buffer is not None
@@ -538,6 +538,7 @@ def test_twiss_range(test_context, cycle_to, line_name, check, init_at_edge, col
538
538
  if collider_for_test_twiss_range is not None:
539
539
  collider = collider_for_test_twiss_range
540
540
  else:
541
+ raise ValueError('This should not happen')
541
542
  collider = xt.Multiline.from_json(test_data_folder /
542
543
  'hllhc15_thick/hllhc15_collider_thick.json')
543
544
  collider.lhcb1.twiss_default['method'] = '4d'
@@ -1670,4 +1671,63 @@ def test_twiss_strength_reverse_vs_madx(test_context):
1670
1671
  assert_allclose(twm2['k4sl', 'mcdsxf.3r1:1'], tw.lhcb2['k4sl', 'mcdsxf.3r1'], rtol=0, atol=1e-14)
1671
1672
 
1672
1673
  assert_allclose(twm1['k5sl', 'mctsxf.3r1:1'], tw.lhcb1['k5sl', 'mctsxf.3r1'], rtol=0, atol=1e-14)
1673
- assert_allclose(twm2['k5sl', 'mctsxf.3r1:1'], tw.lhcb2['k5sl', 'mctsxf.3r1'], rtol=0, atol=1e-14)
1674
+ assert_allclose(twm2['k5sl', 'mctsxf.3r1:1'], tw.lhcb2['k5sl', 'mctsxf.3r1'], rtol=0, atol=1e-14)
1675
+
1676
+
1677
+ @for_all_test_contexts
1678
+ @pytest.mark.parametrize('line_name', ['lhcb1'])
1679
+ @pytest.mark.parametrize('reverse', [False, True])
1680
+ @pytest.mark.parametrize('section', [
1681
+ (xt.START, xt.END),
1682
+ (xt.START, '_end_point'),
1683
+ (xt.START, 'ip6'),
1684
+ ('ip4', xt.END),
1685
+ ])
1686
+ def test_twiss_range_start_end(test_context, line_name, reverse, section, collider_for_test_twiss_range):
1687
+ collider = collider_for_test_twiss_range
1688
+ init_at = 'ip5'
1689
+
1690
+ collider.vars['on_x5hs'] = 200
1691
+ collider.vars['on_x5vs'] = 123
1692
+ collider.vars['on_sep5h'] = 1
1693
+ collider.vars['on_sep5v'] = 2
1694
+
1695
+ line = collider[line_name]
1696
+
1697
+ if collider.lhcb1.element_names[0] != 'ip3':
1698
+ collider.lhcb1.cycle('ip3', inplace=True)
1699
+ if collider.lhcb2.element_names[0] != 'ip3':
1700
+ collider.lhcb2.cycle('ip3', inplace=True)
1701
+
1702
+ if isinstance(test_context, xo.ContextCpu) and (
1703
+ test_context.omp_num_threads != line._context.omp_num_threads):
1704
+ buffer = test_context.new_buffer()
1705
+ elif isinstance(test_context, line._context.__class__):
1706
+ buffer = line._buffer
1707
+ else:
1708
+ buffer = test_context.new_buffer()
1709
+
1710
+ line.build_tracker(_buffer=buffer)
1711
+
1712
+ tw = line.twiss()
1713
+ tw_init = tw.get_twiss_init(init_at)
1714
+
1715
+ start = section[0]
1716
+ end = section[1]
1717
+ if not reverse:
1718
+ tw_test = line.twiss(start=start, end=end, init=tw_init, reverse=reverse)
1719
+ else:
1720
+ with pytest.raises(ValueError) as excinfo:
1721
+ line.twiss(start=start, end=end, init=tw_init, reverse=reverse)
1722
+ assert 'reverse' in str(excinfo.value)
1723
+ return
1724
+
1725
+ start_el = (line.element_names[0] if start == xt.START else start)
1726
+ end_el = (line.element_names[-1] if (end == xt.END or end == '_end_point') else end)
1727
+ tw_ref = line.twiss(start=start_el, end=end_el, init=tw_init, reverse=reverse)
1728
+
1729
+ for kk in tw_test._data.keys():
1730
+ if kk in ('particle_on_co', '_action'):
1731
+ continue
1732
+ assert np.all(tw_test._data[kk] == tw_ref._data[kk]), (
1733
+ 'Issues with variable: ' + kk)
@@ -3,7 +3,7 @@
3
3
  # Copyright (c) CERN, 2021. #
4
4
  # ######################################### #
5
5
 
6
- from .general import _pkg_root, _print
6
+ from .general import _pkg_root, _print, START, END
7
7
 
8
8
  from .particles import (Particles, PROTON_MASS_EV, ELECTRON_MASS_EV,
9
9
  enable_pyheadtail_interface, disable_pyheadtail_interface)
@@ -15,8 +15,8 @@ from .tracker_data import TrackerData
15
15
  from .line import Line, Node, freeze_longitudinal, _temp_knobs, EnergyProgram
16
16
  from .tracker import Tracker, Log
17
17
  from .match import (Vary, Target, TargetList, VaryList, TargetInequality, Action,
18
- TargetRelPhaseAdvance, TargetSet, START, END,
19
- GreaterThan, LessThan, TargetRmatrixTerm, TargetRmatrix)
18
+ TargetRelPhaseAdvance, TargetSet, GreaterThan, LessThan,
19
+ TargetRmatrixTerm, TargetRmatrix)
20
20
  from .targets import (TargetLuminosity, TargetSeparationOrthogonalToCrossing,
21
21
  TargetSeparation)
22
22
  from .twiss import TwissInit, TwissTable
@@ -0,0 +1 @@
1
+ __version__ = '0.61.0'