xtrack 0.70.3__tar.gz → 0.72.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 (262) hide show
  1. {xtrack-0.70.3/xtrack.egg-info → xtrack-0.72.0}/PKG-INFO +1 -1
  2. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_elements_thick.py +231 -0
  3. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_madnginterface.py +4 -4
  4. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_slicing.py +122 -0
  5. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/__init__.py +1 -0
  6. xtrack-0.72.0/xtrack/_version.py +1 -0
  7. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements.py +5 -0
  8. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/solenoid.h +36 -11
  9. xtrack-0.70.3/xtrack/json_utils.py → xtrack-0.72.0/xtrack/json.py +2 -2
  10. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/line.py +11 -8
  11. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/linear_normal_form.py +14 -3
  12. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_parser/loader.py +7 -4
  13. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/match.py +20 -1
  14. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/multiline/multiline.py +52 -5
  15. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/slicing.py +36 -36
  16. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/twissplot.py +25 -18
  17. {xtrack-0.70.3 → xtrack-0.72.0/xtrack.egg-info}/PKG-INFO +1 -1
  18. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack.egg-info/SOURCES.txt +1 -1
  19. xtrack-0.70.3/xtrack/_version.py +0 -1
  20. {xtrack-0.70.3 → xtrack-0.72.0}/LICENSE +0 -0
  21. {xtrack-0.70.3 → xtrack-0.72.0}/MANIFEST.in +0 -0
  22. {xtrack-0.70.3 → xtrack-0.72.0}/README.md +0 -0
  23. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/__init__.py +0 -0
  24. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/base_classes.py +0 -0
  25. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/BB6D.py +0 -0
  26. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  27. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/__init__.py +0 -0
  28. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/beambeam.py +0 -0
  29. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/boost.py +0 -0
  30. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  31. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  32. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/qgauss.py +0 -0
  33. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/slicing.py +0 -0
  34. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
  35. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/elements.py +0 -0
  36. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/line.py +0 -0
  37. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/mathlibs.py +0 -0
  38. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/particles.py +0 -0
  39. {xtrack-0.70.3 → xtrack-0.72.0}/ducktrack/temp_pyparticles.py +0 -0
  40. {xtrack-0.70.3 → xtrack-0.72.0}/pyproject.toml +0 -0
  41. {xtrack-0.70.3 → xtrack-0.72.0}/setup.cfg +0 -0
  42. {xtrack-0.70.3 → xtrack-0.72.0}/setup.py +0 -0
  43. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_acceleration.py +0 -0
  44. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_amplitude_detuning.py +0 -0
  45. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  46. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_apertures.py +0 -0
  47. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_attr_replicas_and_slices.py +0 -0
  48. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_cavity_absolute_time.py +0 -0
  49. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
  50. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_coasting.py +0 -0
  51. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_collective_tracker.py +0 -0
  52. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_collimation.py +0 -0
  53. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_element_characterization_functions.py +0 -0
  54. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_element_internal_record.py +0 -0
  55. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_elements.py +0 -0
  56. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_elements_classflags.py +0 -0
  57. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_environment.py +0 -0
  58. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  59. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  60. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_footprint.py +0 -0
  61. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_freeze_longitudinal.py +0 -0
  62. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_full_rings.py +0 -0
  63. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_h6_sps_beamline.py +0 -0
  64. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_hvkick.py +0 -0
  65. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_ions.py +0 -0
  66. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_lhc_match_phase_15.py +0 -0
  67. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_line.py +0 -0
  68. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_lumi.py +0 -0
  69. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_mad_writer.py +0 -0
  70. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_madloader.py +0 -0
  71. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_and_track_from_element.py +0 -0
  72. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_coupling_knob.py +0 -0
  73. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_nested.py +0 -0
  74. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_optics_and_ip_knob.py +0 -0
  75. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  76. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_orbit_bump.py +0 -0
  77. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_match_tune_chroma_cminus.py +0 -0
  78. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_monitor.py +0 -0
  79. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_multiline.py +0 -0
  80. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_multisetter.py +0 -0
  81. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_multispecies.py +0 -0
  82. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_new_madloader.py +0 -0
  83. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_particles_api.py +0 -0
  84. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_periodic_symmetric_twiss_and_match.py +0 -0
  85. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_pipeline.py +0 -0
  86. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_prebuild_kernels.py +0 -0
  87. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_ps_against_ptc.py +0 -0
  88. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_ps_multiturn_twiss.py +0 -0
  89. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_psb_chicane.py +0 -0
  90. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_pyht_interface.py +0 -0
  91. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_radial_steering.py +0 -0
  92. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_radiation.py +0 -0
  93. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
  94. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_random_gen.py +0 -0
  95. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_random_gen_exp.py +0 -0
  96. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_random_gen_gauss.py +0 -0
  97. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_random_gen_ruth.py +0 -0
  98. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_rbend_rbarc.py +0 -0
  99. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_rf_track.py +0 -0
  100. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_rotation_signs.py +0 -0
  101. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_second_order_taylor_map.py +0 -0
  102. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_seeds.py +0 -0
  103. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_slice_and_insert_with_replicas.py +0 -0
  104. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_slice_elements.py +0 -0
  105. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  106. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_spacecharge_in_ring.py +0 -0
  107. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_sps_thick.py +0 -0
  108. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_survey.py +0 -0
  109. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_tapering.py +0 -0
  110. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_thick_lhc.py +0 -0
  111. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_tilt_shifts.py +0 -0
  112. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_tracker.py +0 -0
  113. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_trajectory_correcton.py +0 -0
  114. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_twiss.py +0 -0
  115. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_twiss_vs_madx_psb.py +0 -0
  116. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_vs_madx.py +0 -0
  117. {xtrack-0.70.3 → xtrack-0.72.0}/tests/test_xmask_orbit_correction.py +0 -0
  118. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/__init__.py +0 -0
  119. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  120. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  121. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  122. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
  123. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  124. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  125. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  126. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/base_element.py +0 -0
  127. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/__init__.py +0 -0
  128. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures.py +0 -0
  129. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  130. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  131. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  132. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  133. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  134. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  135. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/beam_interaction.py +0 -0
  136. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
  137. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  138. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
  139. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  140. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
  141. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
  142. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  143. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  144. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  145. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  146. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  147. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
  148. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  149. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  150. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
  151. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  152. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  153. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  154. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  155. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  156. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  157. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  158. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  159. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  160. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  161. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  162. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  163. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  164. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  165. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  166. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  167. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  168. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  169. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  170. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  171. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  172. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  173. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  174. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  175. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  176. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  177. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
  178. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
  179. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  180. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  181. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  182. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  183. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  184. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  185. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  186. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
  187. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  188. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  189. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  190. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
  191. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  192. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  193. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  194. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  195. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/exciter.py +0 -0
  196. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/rft_element.py +0 -0
  197. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/slice_elements.py +0 -0
  198. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  199. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/environment.py +0 -0
  200. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/footprint.py +0 -0
  201. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/general.py +0 -0
  202. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/headers/atomicadd.h +0 -0
  203. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/headers/checks.h +0 -0
  204. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/headers/constants.h +0 -0
  205. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/headers/particle_states.h +0 -0
  206. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/headers/synrad_spectrum.h +0 -0
  207. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/internal_record.py +0 -0
  208. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/loss_location_refinement/__init__.py +0 -0
  209. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  210. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/lumi.py +0 -0
  211. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_loader.py +0 -0
  212. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_parser/__init__.py +0 -0
  213. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_parser/env_writer.py +0 -0
  214. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_parser/madx.lark +0 -0
  215. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_parser/parse.py +0 -0
  216. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/mad_writer.py +0 -0
  217. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/madng_interface.py +0 -0
  218. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/__init__.py +0 -0
  219. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/beam_position_monitor.h +0 -0
  220. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/beam_position_monitor.py +0 -0
  221. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
  222. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
  223. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/beam_size_monitor.h +0 -0
  224. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/beam_size_monitor.py +0 -0
  225. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/last_turns_monitor.h +0 -0
  226. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/last_turns_monitor.py +0 -0
  227. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/particles_monitor.h +0 -0
  228. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/monitors/particles_monitor.py +0 -0
  229. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/multiline/__init__.py +0 -0
  230. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/multiline/shared_knobs.py +0 -0
  231. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/multisetter/__init__.py +0 -0
  232. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/multisetter/multisetter.py +0 -0
  233. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/particles/__init__.py +0 -0
  234. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/particles/constants.py +0 -0
  235. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/particles/particles.py +0 -0
  236. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/particles/rng_src/base_rng.h +0 -0
  237. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
  238. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/pipeline/__init__.py +0 -0
  239. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/pipeline/core.py +0 -0
  240. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/pipeline/manager.py +0 -0
  241. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/pipeline/multitracker.py +0 -0
  242. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/progress_indicator.py +0 -0
  243. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/__init__.py +0 -0
  244. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_generators.py +0 -0
  245. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_src/exponential.h +0 -0
  246. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  247. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_src/normal.h +0 -0
  248. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_src/rutherford.h +0 -0
  249. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_src/uniform.h +0 -0
  250. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/random/random_src/uniform_accurate.h +0 -0
  251. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/survey.py +0 -0
  252. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/synctime.py +0 -0
  253. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/tapering.py +0 -0
  254. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/targets.py +0 -0
  255. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/tracker.py +0 -0
  256. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/tracker_data.py +0 -0
  257. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/tracker_src/tracker.h +0 -0
  258. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/trajectory_correction.py +0 -0
  259. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack/twiss.py +0 -0
  260. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack.egg-info/dependency_links.txt +0 -0
  261. {xtrack-0.70.3 → xtrack-0.72.0}/xtrack.egg-info/requires.txt +0 -0
  262. {xtrack-0.70.3 → xtrack-0.72.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.70.3
3
+ Version: 0.72.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
@@ -1209,6 +1209,237 @@ def test_solenoid_shifted_and_rotated_multipolar_kick(test_context):
1209
1209
  xo.assert_allclose(p_test.delta, p_ref.delta, rtol=0, atol=1e-16)
1210
1210
 
1211
1211
 
1212
+ @pytest.mark.parametrize('shift_x', (0, 1e-3))
1213
+ @pytest.mark.parametrize('shift_y', (0, 1e-3))
1214
+ @pytest.mark.parametrize('test_element_name', ('Bend', 'Quadrupole', 'Sextupole'))
1215
+ def test_solenoid_multipole_shifts(shift_x, shift_y, test_element_name):
1216
+ ################################################################################
1217
+ # User Parameters
1218
+ ################################################################################
1219
+ N_SLICES = int(1E3)
1220
+
1221
+ BETX = 100E-3
1222
+ BETY = 1E-3
1223
+ PX0 = 0
1224
+
1225
+ KS = 0.00
1226
+ K0 = 1E-3
1227
+ K1 = 1E-3
1228
+ K2 = 1E-3
1229
+
1230
+ ################################################################################
1231
+ # Build Test Elements
1232
+ ################################################################################
1233
+ drift0 = xt.Drift(length=1)
1234
+ drift1 = xt.Drift(length=1)
1235
+
1236
+ bend = xt.Bend(length=1, k0=K0)
1237
+ quad = xt.Quadrupole(length=1, k1=K1)
1238
+ sext = xt.Sextupole(length=1, k2=K2)
1239
+
1240
+ bend_sol = xt.Solenoid(length=1 / N_SLICES, ks=KS,
1241
+ knl=[K0 * (1 / N_SLICES), 0, 0], num_multipole_kicks=1)
1242
+ quad_sol = xt.Solenoid(length=1 / N_SLICES, ks=KS,
1243
+ knl=[0, K1 * (1 / N_SLICES), 0], num_multipole_kicks=1)
1244
+ sext_sol = xt.Solenoid(length=1 / N_SLICES, ks=KS,
1245
+ knl=[0, 0, K2 * (1 / N_SLICES)], num_multipole_kicks=1)
1246
+
1247
+ ################################################################################
1248
+ # Comparisons
1249
+ ################################################################################
1250
+ test_element, test_sol = {
1251
+ 'Bend': (bend, bend_sol),
1252
+ 'Quadrupole': (quad, quad_sol),
1253
+ 'Sextupole': (sext, sext_sol),
1254
+ }[test_element_name]
1255
+
1256
+ ########################################
1257
+ # Build Lines
1258
+ ########################################
1259
+ line = xt.Line(
1260
+ elements=[drift0] + [test_element] + [drift0],
1261
+ particle_ref=xt.Particles(p0c=1E9, mass0=xt.ELECTRON_MASS_EV))
1262
+ line.configure_bend_model(edge='suppressed')
1263
+
1264
+ sol_line = xt.Line(
1265
+ elements=[drift1] + [test_sol] * N_SLICES + [drift1],
1266
+ particle_ref=xt.Particles(p0c=1E9, mass0=xt.ELECTRON_MASS_EV))
1267
+
1268
+ # Slice test line
1269
+ line.slice_thick_elements(
1270
+ slicing_strategies=[
1271
+ xt.Strategy(slicing=xt.Uniform(N_SLICES, mode='thin'), element_type=xt.Bend),
1272
+ xt.Strategy(slicing=xt.Uniform(N_SLICES, mode='thin'), element_type=xt.Quadrupole),
1273
+ xt.Strategy(slicing=xt.Uniform(N_SLICES, mode='thin'), element_type=xt.Sextupole)])
1274
+
1275
+ ########################################
1276
+ # Test and plot with shifts
1277
+ ########################################
1278
+ test_element.shift_x = shift_x
1279
+ test_element.shift_y = shift_y
1280
+ test_sol.mult_shift_x = shift_x
1281
+ test_sol.mult_shift_y = shift_y
1282
+
1283
+ tw = line.twiss(
1284
+ _continue_if_lost=True,
1285
+ start=xt.START,
1286
+ end=xt.END,
1287
+ betx=BETX,
1288
+ bety=BETY,
1289
+ px=PX0)
1290
+ tw_sol = sol_line.twiss(
1291
+ _continue_if_lost=True,
1292
+ start=xt.START,
1293
+ end=xt.END,
1294
+ betx=BETX,
1295
+ bety=BETY,
1296
+ px=PX0)
1297
+
1298
+ ########################################
1299
+ # Assertions
1300
+ ########################################
1301
+ assert np.isclose(tw.x[-1], tw_sol.x[-1], rtol=1E-6)
1302
+ assert np.isclose(tw.y[-1], tw_sol.y[-1], rtol=1E-6)
1303
+
1304
+
1305
+ def test_solenoid_multipole_rotations():
1306
+ N_SLICES = int(1E2)
1307
+ K0 = 1E-3
1308
+ L_SOL = 1
1309
+ XING_RAD = 1E-3
1310
+
1311
+ BETX = 100E-3
1312
+ BETY = 1E-3
1313
+
1314
+ ########################################
1315
+ # Build Environment
1316
+ ########################################
1317
+ env = xt.Environment(particle_ref=xt.Particles(p0c=1E9))
1318
+
1319
+ ########################################
1320
+ # Line (beamline frame)
1321
+ ########################################
1322
+ bl_components_in = [env.new('bl_drift0', xt.Drift, length=1)]
1323
+ bl_components_out = [env.new('bl_drift1', xt.Drift, length=1)]
1324
+
1325
+ bl_components_sol = [
1326
+ env.new(f'bl_sol.{i}', xt.Solenoid,
1327
+ length=(L_SOL / N_SLICES),
1328
+ ks=0,
1329
+ knl=[K0 * (L_SOL / N_SLICES), 0, 0],
1330
+ num_multipole_kicks=1)
1331
+ for i in range(N_SLICES)]
1332
+
1333
+ bl_line = env.new_line(
1334
+ components=bl_components_in + bl_components_sol + bl_components_out)
1335
+
1336
+ ########################################
1337
+ # Line (horizontal rotated frame)
1338
+ ########################################
1339
+ hrot_components_in = [
1340
+ env.new('hrot_drift0', xt.Drift, length=1),
1341
+ env.new('hshift_in', xt.XYShift, dx=np.sin(XING_RAD) * L_SOL / 2),
1342
+ env.new('hrot_in', xt.YRotation, angle=-np.rad2deg(XING_RAD))]
1343
+
1344
+ hrot_components_out = [
1345
+ env.new('hrot_out', xt.YRotation, angle=np.rad2deg(XING_RAD)),
1346
+ env.new('hshift_out', xt.XYShift, dx=np.sin(XING_RAD) * L_SOL / 2),
1347
+ env.new('hrot_drift1', xt.Drift, length=1)]
1348
+
1349
+ hrot_components_sol = [
1350
+ env.new(f'hrot_sol.{i}', xt.Solenoid,
1351
+ length=(L_SOL / N_SLICES) * np.cos(XING_RAD),
1352
+ ks=0,
1353
+ knl=[K0 * (L_SOL / N_SLICES), 0, 0],
1354
+ num_multipole_kicks=1,
1355
+ mult_rot_y_rad=XING_RAD,
1356
+ mult_shift_x=np.sin(XING_RAD) * L_SOL * (i / N_SLICES - 1 / 2))
1357
+ for i in range(N_SLICES)]
1358
+
1359
+ hrot_line = env.new_line(
1360
+ components=hrot_components_in + hrot_components_sol + hrot_components_out)
1361
+
1362
+ ########################################
1363
+ # Line (vertical rotated frame)
1364
+ ########################################
1365
+ vrot_components_in = [
1366
+ env.new('vrot_drift0', xt.Drift, length=1),
1367
+ env.new('vshift_in', xt.XYShift, dy=np.sin(XING_RAD) * L_SOL / 2),
1368
+ env.new('vrot_in', xt.XRotation, angle=np.rad2deg(XING_RAD))]
1369
+ # TODO: Minus sign difference here as still inconsistent definition with XRotation and YRotation
1370
+ vrot_components_out = [
1371
+ env.new('vrot_out', xt.XRotation, angle=-np.rad2deg(XING_RAD)),
1372
+ env.new('vshift_out', xt.XYShift, dy=np.sin(XING_RAD) * L_SOL / 2),
1373
+ env.new('vrot_drift1', xt.Drift, length=1)]
1374
+
1375
+ vrot_components_sol = [
1376
+ env.new(f'vrot_sol.{i}', xt.Solenoid,
1377
+ length=(L_SOL / N_SLICES) * np.cos(XING_RAD),
1378
+ ks=0,
1379
+ knl=[K0 * (L_SOL / N_SLICES), 0, 0],
1380
+ num_multipole_kicks=1,
1381
+ mult_rot_x_rad=XING_RAD,
1382
+ mult_shift_y=np.sin(XING_RAD) * L_SOL * (i / N_SLICES - 1 / 2))
1383
+ for i in range(N_SLICES)]
1384
+
1385
+ vrot_line = env.new_line(
1386
+ components=vrot_components_in + vrot_components_sol + vrot_components_out)
1387
+
1388
+ ################################################################################
1389
+ # Comparisons
1390
+ ################################################################################
1391
+ bl_twiss = bl_line.twiss(
1392
+ method='4d',
1393
+ start=xt.START,
1394
+ end=xt.END,
1395
+ betx=BETX,
1396
+ bety=BETY)
1397
+
1398
+ hrot_twiss = hrot_line.twiss(
1399
+ method='4d',
1400
+ start=xt.START,
1401
+ end=xt.END,
1402
+ betx=BETX,
1403
+ bety=BETY)
1404
+
1405
+ vrot_twiss = vrot_line.twiss(
1406
+ method='4d',
1407
+ start=xt.START,
1408
+ end=xt.END,
1409
+ betx=BETX,
1410
+ bety=BETY)
1411
+
1412
+ ################################################################################
1413
+ # Test Assertions
1414
+ ################################################################################
1415
+ # Tolerances lower for derivative quantities (alfx, alfy, dpx, dpy)
1416
+ assert np.isclose(bl_twiss['x'][-1], hrot_twiss['x'][-1], rtol=1E-6)
1417
+ assert np.isclose(bl_twiss['y'][-1], hrot_twiss['y'][-1], rtol=1E-6)
1418
+ assert np.isclose(bl_twiss['betx'][-1], hrot_twiss['betx'][-1], rtol=1E-6)
1419
+ assert np.isclose(bl_twiss['bety'][-1], hrot_twiss['bety'][-1], rtol=1E-6)
1420
+ assert np.isclose(bl_twiss['alfx'][-1], hrot_twiss['alfx'][-1], rtol=1E-4)
1421
+ assert np.isclose(bl_twiss['alfy'][-1], hrot_twiss['alfy'][-1], rtol=1E-4)
1422
+ assert np.isclose(bl_twiss['dx'][-1], hrot_twiss['dx'][-1], rtol=1E-6)
1423
+ assert np.isclose(bl_twiss['dy'][-1], hrot_twiss['dy'][-1], rtol=1E-6)
1424
+ assert np.isclose(bl_twiss['dpx'][-1], hrot_twiss['dpx'][-1], rtol=1E-4)
1425
+ assert np.isclose(bl_twiss['dpy'][-1], hrot_twiss['dpy'][-1], rtol=1E-4)
1426
+ assert np.isclose(bl_twiss['mux'][-1], hrot_twiss['mux'][-1], rtol=1E-6)
1427
+ assert np.isclose(bl_twiss['muy'][-1], hrot_twiss['muy'][-1], rtol=1E-6)
1428
+
1429
+ assert np.isclose(bl_twiss['x'][-1], vrot_twiss['x'][-1], rtol=1E-6)
1430
+ assert np.isclose(bl_twiss['y'][-1], vrot_twiss['y'][-1], rtol=1E-6)
1431
+ assert np.isclose(bl_twiss['betx'][-1], vrot_twiss['betx'][-1], rtol=1E-6)
1432
+ assert np.isclose(bl_twiss['bety'][-1], vrot_twiss['bety'][-1], rtol=1E-4)
1433
+ assert np.isclose(bl_twiss['alfx'][-1], vrot_twiss['alfx'][-1], rtol=1E-4)
1434
+ assert np.isclose(bl_twiss['alfy'][-1], vrot_twiss['alfy'][-1], rtol=1E-6)
1435
+ assert np.isclose(bl_twiss['dx'][-1], vrot_twiss['dx'][-1], rtol=1E-6)
1436
+ assert np.isclose(bl_twiss['dy'][-1], vrot_twiss['dy'][-1], rtol=1E-6)
1437
+ assert np.isclose(bl_twiss['dpx'][-1], vrot_twiss['dpx'][-1], rtol=1E-4)
1438
+ assert np.isclose(bl_twiss['dpy'][-1], vrot_twiss['dpy'][-1], rtol=1E-4)
1439
+ assert np.isclose(bl_twiss['mux'][-1], vrot_twiss['mux'][-1], rtol=1E-6)
1440
+ assert np.isclose(bl_twiss['muy'][-1], vrot_twiss['muy'][-1], rtol=1E-6)
1441
+
1442
+
1212
1443
  @pytest.mark.parametrize(
1213
1444
  'radiation_mode,config',
1214
1445
  [
@@ -7,9 +7,9 @@ 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)
10
+ # @pytest.mark.xfail(strict=False) # sometimes madng fails to start the process (to be investigated)
11
11
  def test_madng_twiss():
12
- rdts = ["f4000", "f3100", "f2020", "f1120", 'f1001']
12
+ rdts = ["f4000", "f3100", "f2020", "f1120"]
13
13
 
14
14
  line = xt.Line.from_json(test_data_folder /
15
15
  'hllhc15_thick/lhc_thick_with_knobs.json')
@@ -46,7 +46,7 @@ def test_madng_twiss():
46
46
  assert np.abs(tw_rdt.f2020).max() > 0
47
47
  assert np.abs(tw_rdt.f1120).max() > 0
48
48
 
49
- @pytest.mark.xfail(strict=False) # sometimes madng fails to start the process (to be investigated)
49
+ # @pytest.mark.xfail(strict=False) # sometimes madng fails to start the process (to be investigated)
50
50
  def test_madng_interface_with_multipole_errors_and_misalignments():
51
51
  line = xt.Line.from_json(test_data_folder /
52
52
  'hllhc15_thick/lhc_thick_with_knobs.json')
@@ -56,7 +56,7 @@ def test_madng_interface_with_multipole_errors_and_misalignments():
56
56
 
57
57
  # Introduce misalignments on all quadrupoles
58
58
  tt = line.get_table()
59
- tt_quad = tt.rows['mq\..*']
59
+ tt_quad = tt.rows[r'mq\..*']
60
60
  rgen = np.random.RandomState(1) # fix seed for random number generator
61
61
  # (to have reproducible results)
62
62
  shift_x = rgen.randn(len(tt_quad)) * 0.01e-3 # 0.01 mm rms shift on all quads
@@ -459,3 +459,125 @@ def test_slicing_xdeps_consistency():
459
459
  )
460
460
  line.slice_thick_elements([sgy])
461
461
  assert len(line.to_dict()['_var_manager']) == num_elements * num_slices
462
+
463
+ def test_slice_twice():
464
+ env = xt.Environment()
465
+ line = env.new_line(components=[
466
+ env.new('el', xt.Bend, length=4, k1=0.5, h=0.1, k0=0.8, knl=[0, 0, 0.03]),
467
+ ])
468
+
469
+ line.slice_thick_elements(
470
+ slicing_strategies=[
471
+ xt.Strategy(slicing=xt.Teapot(4, mode='thick'), element_type=xt.Bend),
472
+ ])
473
+
474
+ tt_first_slice = line.get_table(attr=True)
475
+
476
+ line.slice_thick_elements(
477
+ slicing_strategies=[
478
+ xt.Strategy(slicing=xt.Teapot(4, mode='thin'), element_type=xt.ThickSliceBend),
479
+ ])
480
+
481
+ tt_second_slice = line.get_table(attr=True)
482
+
483
+ assert np.all(tt_first_slice.name == np.array(
484
+ ['el_entry', 'el..entry_map', 'el..0', 'el..1', 'el..2', 'el..3',
485
+ 'el..exit_map', 'el_exit', '_end_point']))
486
+
487
+ assert np.all(tt_first_slice.element_type == np.array(
488
+ ['Marker', 'ThinSliceBendEntry', 'ThickSliceBend', 'ThickSliceBend',
489
+ 'ThickSliceBend', 'ThickSliceBend', 'ThinSliceBendExit', 'Marker',
490
+ '']))
491
+
492
+ # Check first table
493
+
494
+ xo.assert_allclose(tt_first_slice.angle_rad, np.array(
495
+ [0. , 0. , 0.05, 0.15, 0.15, 0.05, 0. , 0. , 0. ]), rtol=0, atol=1e-12)
496
+ xo.assert_allclose(np.sum(tt_first_slice.angle_rad), 0.4, rtol=0, atol=1e-12)
497
+
498
+ xo.assert_allclose(tt_first_slice.k0l, np.array(
499
+ [0. , 0. , 0.4, 1.2, 1.2, 0.4, 0. , 0. , 0. ]), rtol=0, atol=1e-12)
500
+ xo.assert_allclose(np.sum(tt_first_slice.k0l), 3.2, rtol=0, atol=1e-12)
501
+
502
+ xo.assert_allclose(tt_first_slice.k1l, np.array(
503
+ [0. , 0. , 0.25, 0.75, 0.75, 0.25, 0. , 0. , 0. ]), rtol=0, atol=1e-12)
504
+ xo.assert_allclose(np.sum(tt_first_slice.k1l), 2, rtol=0, atol=1e-12)
505
+
506
+ xo.assert_allclose(tt_first_slice.k2l, np.array(
507
+ [0. , 0. , 0.00375, 0.01125, 0.01125, 0.00375, 0. , 0., 0.]),
508
+ rtol=0, atol=1e-12)
509
+ xo.assert_allclose(np.sum(tt_first_slice.k2l), 0.03, rtol=0, atol=1e-12)
510
+
511
+ # Check second table
512
+
513
+ assert np.all(tt_second_slice.name == np.array(
514
+ ['el_entry', 'el..entry_map', 'el..0_entry', 'drift_el..0..0',
515
+ 'el..0..0', 'drift_el..0..1', 'el..0..1', 'drift_el..0..2',
516
+ 'el..0..2', 'drift_el..0..3', 'el..0..3', 'drift_el..0..4',
517
+ 'el..0_exit', 'el..1_entry', 'drift_el..1..0', 'el..1..0',
518
+ 'drift_el..1..1', 'el..1..1', 'drift_el..1..2', 'el..1..2',
519
+ 'drift_el..1..3', 'el..1..3', 'drift_el..1..4', 'el..1_exit',
520
+ 'el..2_entry', 'drift_el..2..0', 'el..2..0', 'drift_el..2..1',
521
+ 'el..2..1', 'drift_el..2..2', 'el..2..2', 'drift_el..2..3',
522
+ 'el..2..3', 'drift_el..2..4', 'el..2_exit', 'el..3_entry',
523
+ 'drift_el..3..0', 'el..3..0', 'drift_el..3..1', 'el..3..1',
524
+ 'drift_el..3..2', 'el..3..2', 'drift_el..3..3', 'el..3..3',
525
+ 'drift_el..3..4', 'el..3_exit', 'el..exit_map', 'el_exit',
526
+ '_end_point']))
527
+
528
+ assert np.all(tt_second_slice.element_type == np.array(
529
+ ['Marker', 'ThinSliceBendEntry', 'Marker', 'DriftSliceBend',
530
+ 'ThinSliceBend', 'DriftSliceBend', 'ThinSliceBend',
531
+ 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend',
532
+ 'ThinSliceBend', 'DriftSliceBend', 'Marker', 'Marker',
533
+ 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend',
534
+ 'ThinSliceBend', 'DriftSliceBend', 'ThinSliceBend',
535
+ 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend', 'Marker',
536
+ 'Marker', 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend',
537
+ 'ThinSliceBend', 'DriftSliceBend', 'ThinSliceBend',
538
+ 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend', 'Marker',
539
+ 'Marker', 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend',
540
+ 'ThinSliceBend', 'DriftSliceBend', 'ThinSliceBend',
541
+ 'DriftSliceBend', 'ThinSliceBend', 'DriftSliceBend', 'Marker',
542
+ 'ThinSliceBendExit', 'Marker', ''
543
+ ]))
544
+
545
+ xo.assert_allclose(tt_second_slice.angle_rad, np.array(
546
+ [0. , 0. , 0. , 0. , 0.0125, 0. , 0.0125, 0. ,
547
+ 0.0125, 0. , 0.0125, 0. , 0. , 0. , 0. , 0.0375,
548
+ 0. , 0.0375, 0. , 0.0375, 0. , 0.0375, 0. , 0. ,
549
+ 0. , 0. , 0.0375, 0. , 0.0375, 0. , 0.0375, 0. ,
550
+ 0.0375, 0. , 0. , 0. , 0. , 0.0125, 0. , 0.0125,
551
+ 0. , 0.0125, 0. , 0.0125, 0. , 0. , 0. , 0. ,
552
+ 0. ]), rtol=0, atol=1e-12)
553
+ xo.assert_allclose(np.sum(tt_second_slice.angle_rad), 0.4, rtol=0, atol=1e-12)
554
+
555
+ xo.assert_allclose(tt_second_slice.k0l, np.array(
556
+ [0. , 0. , 0. , 0. , 0.1, 0. , 0.1, 0. , 0.1, 0. , 0.1, 0. , 0. ,
557
+ 0. , 0. , 0.3, 0. , 0.3, 0. , 0.3, 0. , 0.3, 0. , 0. , 0. , 0. ,
558
+ 0.3, 0. , 0.3, 0. , 0.3, 0. , 0.3, 0. , 0. , 0. , 0. , 0.1, 0. ,
559
+ 0.1, 0. , 0.1, 0. , 0.1, 0. , 0. , 0. , 0. , 0. ]), rtol=0, atol=1e-12)
560
+ xo.assert_allclose(np.sum(tt_second_slice.k0l), 3.2, rtol=0, atol=1e-12)
561
+
562
+ xo.assert_allclose(tt_second_slice.k1l, np.array(
563
+ [0. , 0. , 0. , 0. , 0.0625, 0. , 0.0625, 0. ,
564
+ 0.0625, 0. , 0.0625, 0. , 0. , 0. , 0. , 0.1875,
565
+ 0. , 0.1875, 0. , 0.1875, 0. , 0.1875, 0. , 0. ,
566
+ 0. , 0. , 0.1875, 0. , 0.1875, 0. , 0.1875, 0. ,
567
+ 0.1875, 0. , 0. , 0. , 0. , 0.0625, 0. , 0.0625,
568
+ 0. , 0.0625, 0. , 0.0625, 0. , 0. , 0. , 0. ,
569
+ 0. ]), rtol=0, atol=1e-12)
570
+ xo.assert_allclose(np.sum(tt_second_slice.k1l), 2, rtol=0, atol=1e-12)
571
+
572
+ xo.assert_allclose(tt_second_slice.k2l, np.array(
573
+ [0. , 0. , 0. , 0. , 0.0009375, 0. ,
574
+ 0.0009375, 0. , 0.0009375, 0. , 0.0009375, 0. ,
575
+ 0. , 0. , 0. , 0.0028125, 0. , 0.0028125,
576
+ 0. , 0.0028125, 0. , 0.0028125, 0. , 0. ,
577
+ 0. , 0. , 0.0028125, 0. , 0.0028125, 0. ,
578
+ 0.0028125, 0. , 0.0028125, 0. , 0. , 0. ,
579
+ 0. , 0.0009375, 0. , 0.0009375, 0. , 0.0009375,
580
+ 0. , 0.0009375, 0. , 0. , 0. , 0. ,
581
+ 0. ]),
582
+ rtol=0, atol=1e-12)
583
+ xo.assert_allclose(np.sum(tt_second_slice.k2l), 0.03, rtol=0, atol=1e-12)
@@ -45,6 +45,7 @@ from .slicing import Strategy, Uniform, Teapot
45
45
  from .loss_location_refinement import _skip_in_loss_location_refinement
46
46
  from .trajectory_correction import TrajectoryCorrection
47
47
  from .mad_parser.loader import load_madx_lattice
48
+ from . import json
48
49
 
49
50
  from xdeps import Table, FunctionPieceWiseLinear
50
51
 
@@ -0,0 +1 @@
1
+ __version__ = '0.72.0'
@@ -1293,8 +1293,11 @@ class Solenoid(BeamElement):
1293
1293
  'inv_factorial_order': xo.Float64,
1294
1294
  'knl': xo.Float64[ALLOCATED_MULTIPOLE_ORDER + 1],
1295
1295
  'ksl': xo.Float64[ALLOCATED_MULTIPOLE_ORDER + 1],
1296
+ 'mult_rot_x_rad': xo.Float64,
1296
1297
  'mult_rot_y_rad': xo.Float64,
1297
1298
  'mult_shift_x': xo.Float64,
1299
+ 'mult_shift_y': xo.Float64,
1300
+ 'mult_shift_s': xo.Float64,
1298
1301
  }
1299
1302
 
1300
1303
  _skip_in_to_dict = ['_order', 'inv_factorial_order'] # defined by knl, etc.
@@ -1307,7 +1310,9 @@ class Solenoid(BeamElement):
1307
1310
  _pkg_root.joinpath('headers/synrad_spectrum.h'),
1308
1311
  _pkg_root.joinpath('beam_elements/elements_src/drift.h'),
1309
1312
  _pkg_root.joinpath('beam_elements/elements_src/track_multipolar_components.h'),
1313
+ _pkg_root.joinpath('beam_elements/elements_src/track_xrotation.h'),
1310
1314
  _pkg_root.joinpath('beam_elements/elements_src/track_yrotation.h'),
1315
+ _pkg_root.joinpath('beam_elements/elements_src/track_srotation.h'),
1311
1316
  _pkg_root.joinpath('beam_elements/elements_src/track_solenoid.h'),
1312
1317
  _pkg_root.joinpath('beam_elements/elements_src/solenoid.h'),
1313
1318
  ]
@@ -37,18 +37,33 @@ void Solenoid_track_local_particle(SolenoidData el, LocalParticle* part0) {
37
37
  const double slice_length = length / (num_multipole_kicks + 1);
38
38
  const double kick_weight = 1. / num_multipole_kicks;
39
39
 
40
+ double mult_rot_x_rad = SolenoidData_get_mult_rot_x_rad(el);
40
41
  double mult_rot_y_rad = SolenoidData_get_mult_rot_y_rad(el);
41
42
  double mult_shift_x = SolenoidData_get_mult_shift_x(el);
42
- double sin_angle, cos_angle, tan_angle;
43
+ double mult_shift_y = SolenoidData_get_mult_shift_y(el);
44
+ double mult_shift_s = SolenoidData_get_mult_shift_s(el);
45
+
46
+ double sin_x_rot, cos_x_rot, tan_x_rot;
47
+ double sin_y_rot, cos_y_rot, tan_y_rot;
48
+ if (mult_rot_x_rad != 0) {
49
+ sin_x_rot = sin(mult_rot_x_rad);
50
+ cos_x_rot = cos(mult_rot_x_rad);
51
+ tan_x_rot = sin_x_rot / cos_x_rot;
52
+ }
53
+ else {
54
+ sin_x_rot = 0;
55
+ cos_x_rot = 1;
56
+ tan_x_rot = 0;
57
+ }
43
58
  if (mult_rot_y_rad != 0) {
44
- sin_angle = sin(mult_rot_y_rad);
45
- cos_angle = cos(mult_rot_y_rad);
46
- tan_angle = sin_angle / cos_angle;
59
+ sin_y_rot = sin(mult_rot_y_rad);
60
+ cos_y_rot = cos(mult_rot_y_rad);
61
+ tan_y_rot = sin_y_rot / cos_y_rot;
47
62
  }
48
63
  else {
49
- sin_angle = 0;
50
- cos_angle = 1;
51
- tan_angle = 0;
64
+ sin_y_rot = 0;
65
+ cos_y_rot = 1;
66
+ tan_y_rot = 0;
52
67
  }
53
68
 
54
69
 
@@ -65,17 +80,27 @@ void Solenoid_track_local_particle(SolenoidData el, LocalParticle* part0) {
65
80
  Solenoid_thick_track_single_particle(part, slice_length, ks, radiation_flag);
66
81
 
67
82
  LocalParticle_add_to_x(part, -mult_shift_x);
68
- if (sin_angle != 0) {
69
- YRotation_single_particle(part, sin_angle, cos_angle, tan_angle);
83
+ LocalParticle_add_to_y(part, -mult_shift_y);
84
+ LocalParticle_add_to_s(part, -mult_shift_s);
85
+ if (sin_x_rot != 0) {
86
+ XRotation_single_particle(part, sin_x_rot, cos_x_rot, tan_x_rot);
87
+ }
88
+ if (sin_y_rot != 0) {
89
+ YRotation_single_particle(part, sin_y_rot, cos_y_rot, tan_y_rot);
70
90
  }
71
91
 
72
92
  track_multipolar_kick_bend(
73
93
  part, order, inv_factorial_order, knl, ksl, factor_knl_ksl,
74
94
  kick_weight, 0, 0, 0, 0);
75
95
 
76
- if (sin_angle != 0) {
77
- YRotation_single_particle(part, -sin_angle, cos_angle, -tan_angle);
96
+ if (sin_y_rot != 0) {
97
+ YRotation_single_particle(part, -sin_y_rot, cos_y_rot, -tan_y_rot);
98
+ }
99
+ if (sin_x_rot != 0) {
100
+ XRotation_single_particle(part, -sin_x_rot, cos_x_rot, -tan_x_rot);
78
101
  }
102
+ LocalParticle_add_to_s(part, mult_shift_s);
103
+ LocalParticle_add_to_y(part, mult_shift_y);
79
104
  LocalParticle_add_to_x(part, mult_shift_x);
80
105
  }
81
106
 
@@ -5,7 +5,7 @@ import gzip
5
5
  from xobjects import JEncoder
6
6
 
7
7
 
8
- def to_json(data, file, indent):
8
+ def dump(data, file, indent=1):
9
9
  if isinstance(file, io.IOBase):
10
10
  fh, close = file, False
11
11
  elif (isinstance(file, str) and file.endswith(".gz")) or (
@@ -21,7 +21,7 @@ def to_json(data, file, indent):
21
21
  fh.close()
22
22
 
23
23
 
24
- def from_json(file):
24
+ def load(file):
25
25
  if isinstance(file, io.IOBase):
26
26
  fh, close = file, False
27
27
  elif (isinstance(file, str) and file.endswith(".gz")) or (
@@ -19,7 +19,7 @@ import numpy as np
19
19
  from scipy.constants import c as clight
20
20
 
21
21
  from . import linear_normal_form as lnf
22
- from . import json_utils
22
+ from . import json as json_utils
23
23
 
24
24
  import xobjects as xo
25
25
  import xtrack as xt
@@ -57,9 +57,10 @@ log = logging.getLogger(__name__)
57
57
 
58
58
 
59
59
  _ALLOWED_ELEMENT_TYPES_IN_NEW = [xt.Drift, xt.Bend, xt.Quadrupole, xt.Sextupole,
60
- xt.Octupole, xt.Cavity, xt.Multipole, xt.Solenoid,
61
- xt.Marker, xt.Replica, xt.LimitRacetrack, xt.LimitRectEllipse,
62
- xt.LimitRect, xt.LimitEllipse]
60
+ xt.Octupole, xt.Cavity, xt.Multipole, xt.Solenoid,
61
+ xt.Marker, xt.Replica, xt.XYShift, xt.XRotation,
62
+ xt.YRotation, xt.SRotation, xt.LimitRacetrack,
63
+ xt.LimitRectEllipse, xt.LimitRect, xt.LimitEllipse]
63
64
 
64
65
  _ALLOWED_ELEMENT_TYPES_DICT = {'Drift': xt.Drift, 'Bend': xt.Bend,
65
66
  'Quadrupole': xt.Quadrupole, 'Sextupole': xt.Sextupole,
@@ -68,7 +69,9 @@ _ALLOWED_ELEMENT_TYPES_DICT = {'Drift': xt.Drift, 'Bend': xt.Bend,
68
69
  'Marker': xt.Marker, 'Replica': xt.Replica,
69
70
  'LimitRacetrack': xt.LimitRacetrack,
70
71
  'LimitRectEllipse': xt.LimitRectEllipse,
71
- 'LimitRect': xt.LimitRect, 'LimitEllipse': xt.LimitEllipse}
72
+ 'LimitRect': xt.LimitRect, 'LimitEllipse': xt.LimitEllipse,
73
+ 'XYShift': xt.XYShift, 'XRotation': xt.XRotation,
74
+ 'YRotation': xt.YRotation, 'SRotation': xt.SRotation}
72
75
 
73
76
  _STR_ALLOWED_ELEMENT_TYPES_IN_NEW = ', '.join([tt.__name__ for tt in _ALLOWED_ELEMENT_TYPES_IN_NEW])
74
77
 
@@ -272,7 +275,7 @@ class Line:
272
275
 
273
276
  """
274
277
 
275
- dct = json_utils.from_json(file)
278
+ dct = json_utils.load(file)
276
279
 
277
280
  if 'line' in dct.keys():
278
281
  dct_line = dct['line']
@@ -649,7 +652,7 @@ class Line:
649
652
 
650
653
  '''
651
654
 
652
- json_utils.to_json(self.to_dict(**kwargs), file, indent=indent)
655
+ json_utils.dump(self.to_dict(**kwargs), file, indent=indent)
653
656
 
654
657
  def _to_table_dict(self):
655
658
 
@@ -3632,7 +3635,7 @@ class Line:
3632
3635
  else:
3633
3636
  raise KeyError(f'Element or variable {key} not found')
3634
3637
 
3635
- def info(self, key, limit=12):
3638
+ def info(self, key, limit=30):
3636
3639
  """
3637
3640
  Get information about an element or a variable.
3638
3641
  """
@@ -182,9 +182,20 @@ def compute_linear_normal_form(M, symplectify=False, only_4d_block=False,
182
182
  b2 = v0[:,modes[1]].imag
183
183
  b3 = v0[:,modes[2]].imag
184
184
 
185
- n1 = 1./np.sqrt(np.matmul(np.matmul(a1, S), b1))
186
- n2 = 1./np.sqrt(np.matmul(np.matmul(a2, S), b2))
187
- n3 = 1./np.sqrt(np.matmul(np.matmul(a3, S), b3))
185
+ n1_inv_sq = np.matmul(np.matmul(a1, S), b1)
186
+ n2_inv_sq = np.matmul(np.matmul(a2, S), b2)
187
+ n3_inv_sq = np.matmul(np.matmul(a3, S), b3)
188
+
189
+ if not n1_inv_sq > 0:
190
+ raise ValueError('Invalid n1')
191
+ if not n2_inv_sq > 0:
192
+ raise ValueError('Invalid n2')
193
+ if not n3_inv_sq > 0:
194
+ raise ValueError('Invalid n3')
195
+
196
+ n1 = 1./np.sqrt(n1_inv_sq)
197
+ n2 = 1./np.sqrt(n2_inv_sq)
198
+ n3 = 1./np.sqrt(n3_inv_sq)
188
199
 
189
200
  a1 *= n1
190
201
  a2 *= n2
@@ -292,13 +292,16 @@ class MadxLoader:
292
292
  if (extras := el_params.pop('extra', None)):
293
293
  _warn(f'Ignoring extra parameters {extras} for element `{name}`!')
294
294
 
295
- if isinstance(self.env[name], BeamElement) and not self.env[name].isthick and length:
295
+
296
+ if (isinstance(self.env[name], BeamElement) and not self.env[name].isthick
297
+ and length and not isinstance(self.env[name], xt.Marker)):
296
298
  drift_name = f'drift_{name}'
297
299
  self.env.new(drift_name, 'Drift', length=f'({length}) / 2')
298
300
  name = builder.new_line([drift_name, name, drift_name])
299
301
  builder.place(name, **el_params)
300
302
  else:
301
- if isinstance(self.env[parent], BeamElement) and not self.env[parent].isthick and length:
303
+ if (isinstance(self.env[parent], BeamElement) and not self.env[parent].isthick
304
+ and length and not isinstance(self.env[parent], xt.Marker)):
302
305
  drift_name = f'{name}_drift'
303
306
  self.env.new(drift_name, 'Drift', length=f'({length}) / 2')
304
307
  at, from_ = el_params.pop('at', None), el_params.pop('from_', None)
@@ -635,8 +638,8 @@ class MadxLoader:
635
638
 
636
639
  return element_name
637
640
 
638
- def load_madx_lattice(file):
639
- loader = MadxLoader()
641
+ def load_madx_lattice(file, reverse_lines=None):
642
+ loader = MadxLoader(reverse_lines=reverse_lines)
640
643
  loader.load_file(file)
641
644
  env = loader.env
642
645
  return env