xtrack 0.83.1__tar.gz → 0.83.3__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 (308) hide show
  1. {xtrack-0.83.1/xtrack.egg-info → xtrack-0.83.3}/PKG-INFO +1 -1
  2. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_apertures.py +18 -1
  3. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_environment.py +1 -0
  4. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_trajectory_correcton.py +106 -0
  5. xtrack-0.83.3/xtrack/_version.py +1 -0
  6. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures.py +14 -25
  7. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_magnet_radiation.h +92 -88
  8. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/line.py +38 -6
  9. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/particles.py +3 -1
  10. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/tapering.py +4 -2
  11. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/trajectory_correction.py +98 -15
  12. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/twiss.py +15 -0
  13. {xtrack-0.83.1 → xtrack-0.83.3/xtrack.egg-info}/PKG-INFO +1 -1
  14. xtrack-0.83.1/xtrack/_version.py +0 -1
  15. {xtrack-0.83.1 → xtrack-0.83.3}/LICENSE +0 -0
  16. {xtrack-0.83.1 → xtrack-0.83.3}/MANIFEST.in +0 -0
  17. {xtrack-0.83.1 → xtrack-0.83.3}/README.md +0 -0
  18. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/__init__.py +0 -0
  19. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/base_classes.py +0 -0
  20. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/BB6D.py +0 -0
  21. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  22. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/__init__.py +0 -0
  23. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/beambeam.py +0 -0
  24. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/boost.py +0 -0
  25. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  26. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  27. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/qgauss.py +0 -0
  28. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/slicing.py +0 -0
  29. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/be_beamfields/spacecharge.py +0 -0
  30. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/elements.py +0 -0
  31. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/line.py +0 -0
  32. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/mathlibs.py +0 -0
  33. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/particles.py +0 -0
  34. {xtrack-0.83.1 → xtrack-0.83.3}/ducktrack/temp_pyparticles.py +0 -0
  35. {xtrack-0.83.1 → xtrack-0.83.3}/pyproject.toml +0 -0
  36. {xtrack-0.83.1 → xtrack-0.83.3}/setup.cfg +0 -0
  37. {xtrack-0.83.1 → xtrack-0.83.3}/setup.py +0 -0
  38. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_acceleration.py +0 -0
  39. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_amplitude_detuning.py +0 -0
  40. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_aperture_table.py +0 -0
  41. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  42. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_attr_replicas_and_slices.py +0 -0
  43. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_bucket_with_ref_energy_change.py +0 -0
  44. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_cavity_absolute_time.py +0 -0
  45. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_chromatic_functions_vs_madx.py +0 -0
  46. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_coasting.py +0 -0
  47. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_collective_tracker.py +0 -0
  48. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_collimation.py +0 -0
  49. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_electron_cooler.py +0 -0
  50. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_element_characterization_functions.py +0 -0
  51. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_element_internal_record.py +0 -0
  52. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_elements.py +0 -0
  53. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_elements_classflags.py +0 -0
  54. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_elements_thick.py +0 -0
  55. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  56. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  57. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_footprint.py +0 -0
  58. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_freeze_longitudinal.py +0 -0
  59. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_full_rings.py +0 -0
  60. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_h6_sps_beamline.py +0 -0
  61. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_hvkick.py +0 -0
  62. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_ions.py +0 -0
  63. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_legacy_multiline_to_env.py +0 -0
  64. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_lhc_env.py +0 -0
  65. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_lhc_match_phase_15.py +0 -0
  66. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_line.py +0 -0
  67. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_lumi.py +0 -0
  68. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_mad_writer.py +0 -0
  69. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_madloader.py +0 -0
  70. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_madnginterface.py +0 -0
  71. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_magnet.py +0 -0
  72. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_and_track_from_element.py +0 -0
  73. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_coupling_knob.py +0 -0
  74. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_nested.py +0 -0
  75. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_optics_and_ip_knob.py +0 -0
  76. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  77. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_orbit_bump.py +0 -0
  78. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_match_tune_chroma_cminus.py +0 -0
  79. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_monitor.py +0 -0
  80. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_multi_bunch_gauss.py +0 -0
  81. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_multiline.py +0 -0
  82. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_multisetter.py +0 -0
  83. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_multispecies.py +0 -0
  84. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_native_madloader.py +0 -0
  85. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_optimize_for_tracking.py +0 -0
  86. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_particles.py +0 -0
  87. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_particles_basics.py +0 -0
  88. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_particles_pdg.py +0 -0
  89. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_periodic_symmetric_twiss_and_match.py +0 -0
  90. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_pipeline.py +0 -0
  91. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_prebuild_kernels.py +0 -0
  92. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_ps_against_ptc.py +0 -0
  93. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_ps_multiturn_twiss.py +0 -0
  94. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_psb_chicane.py +0 -0
  95. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_pyht_interface.py +0 -0
  96. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_radial_steering.py +0 -0
  97. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_radiation.py +0 -0
  98. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_radiation_equilibrium_emittances.py +0 -0
  99. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_radiation_equilibrium_emittances_thick.py +0 -0
  100. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_random_gen.py +0 -0
  101. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_random_gen_exp.py +0 -0
  102. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_random_gen_gauss.py +0 -0
  103. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_random_gen_ruth.py +0 -0
  104. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_rbend_rbarc.py +0 -0
  105. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_rf_track.py +0 -0
  106. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_rotation_signs.py +0 -0
  107. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_second_order_taylor_map.py +0 -0
  108. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_seeds.py +0 -0
  109. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_slice_and_insert_with_replicas.py +0 -0
  110. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_slice_elements.py +0 -0
  111. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_slicing.py +0 -0
  112. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  113. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_spacecharge_in_ring.py +0 -0
  114. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_spin.py +0 -0
  115. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_sps_thick.py +0 -0
  116. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_survey.py +0 -0
  117. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_tapering.py +0 -0
  118. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_thick_lhc.py +0 -0
  119. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_tilt_shifts.py +0 -0
  120. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_tracker.py +0 -0
  121. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_twiss.py +0 -0
  122. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_twiss_vs_madx_psb.py +0 -0
  123. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_vs_madx.py +0 -0
  124. {xtrack-0.83.1 → xtrack-0.83.3}/tests/test_xmask_orbit_correction.py +0 -0
  125. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/__init__.py +0 -0
  126. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/__init__.py +0 -0
  127. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  128. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  129. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  130. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/lhc_match/__init__.py +0 -0
  131. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  132. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  133. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  134. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/aperture_meas.py +0 -0
  135. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/base_element.py +0 -0
  136. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/__init__.py +0 -0
  137. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  138. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  139. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  140. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  141. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  142. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  143. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/beam_interaction.py +0 -0
  144. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements.py +0 -0
  145. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/bend.h +0 -0
  146. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  147. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
  148. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  149. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift.h +0 -0
  150. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  151. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  152. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  153. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  154. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift_slice_rbend.h +0 -0
  155. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  156. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/electroncooler.h +0 -0
  157. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/elens.h +0 -0
  158. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  159. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  160. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
  161. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/magnet.h +0 -0
  162. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/magnet_drift.h +0 -0
  163. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/magnet_edge.h +0 -0
  164. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/magnet_kick.h +0 -0
  165. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/marker.h +0 -0
  166. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  167. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/multipoleedge.h +0 -0
  168. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  169. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  170. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  171. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/rbend.h +0 -0
  172. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  173. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  174. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  175. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  176. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  177. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  178. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
  179. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  180. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  181. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  182. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  183. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  184. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_rbend.h +0 -0
  185. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  186. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  187. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  188. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  189. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  190. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  191. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_octupole_entry.h +0 -0
  192. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_octupole_exit.h +0 -0
  193. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  194. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_entry.h +0 -0
  195. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_exit.h +0 -0
  196. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_rbend.h +0 -0
  197. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_rbend_entry.h +0 -0
  198. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_rbend_exit.h +0 -0
  199. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  200. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_sextupole_entry.h +0 -0
  201. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/thin_slice_sextupole_exit.h +0 -0
  202. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  203. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_cavity.h +0 -0
  204. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  205. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  206. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
  207. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_drift.h +0 -0
  208. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_magnet.h +0 -0
  209. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_magnet_drift.h +0 -0
  210. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_magnet_edge.h +0 -0
  211. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_magnet_kick.h +0 -0
  212. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
  213. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  214. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  215. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  216. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  217. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  218. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  219. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  220. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
  221. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  222. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  223. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  224. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/wire.h +0 -0
  225. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  226. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  227. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  228. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  229. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/exciter.py +0 -0
  230. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/magnets.py +0 -0
  231. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/rft_element.py +0 -0
  232. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/slice_elements.py +0 -0
  233. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  234. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/environment.py +0 -0
  235. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/footprint.py +0 -0
  236. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/general.py +0 -0
  237. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/headers/atomicadd.h +0 -0
  238. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/headers/checks.h +0 -0
  239. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/headers/constants.h +0 -0
  240. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/headers/particle_states.h +0 -0
  241. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/headers/synrad_spectrum.h +0 -0
  242. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/headers/track.h +0 -0
  243. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/internal_record.py +0 -0
  244. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/json.py +0 -0
  245. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/linear_normal_form.py +0 -0
  246. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/loss_location_refinement/__init__.py +0 -0
  247. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  248. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/lumi.py +0 -0
  249. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/mad_loader.py +0 -0
  250. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/mad_parser/__init__.py +0 -0
  251. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/mad_parser/loader.py +0 -0
  252. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/mad_parser/madx.lark +0 -0
  253. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/mad_parser/parse.py +0 -0
  254. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/mad_writer.py +0 -0
  255. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/madng_interface.py +0 -0
  256. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/match.py +0 -0
  257. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/__init__.py +0 -0
  258. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/beam_position_monitor.h +0 -0
  259. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/beam_position_monitor.py +0 -0
  260. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/beam_profile_monitor.h +0 -0
  261. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/beam_profile_monitor.py +0 -0
  262. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/beam_size_monitor.h +0 -0
  263. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/beam_size_monitor.py +0 -0
  264. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/last_turns_monitor.h +0 -0
  265. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/last_turns_monitor.py +0 -0
  266. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/particles_monitor.h +0 -0
  267. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/monitors/particles_monitor.py +0 -0
  268. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/multiline.py +0 -0
  269. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/multiline_legacy/__init__.py +0 -0
  270. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/multiline_legacy/multiline_legacy.py +0 -0
  271. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/multiline_legacy/shared_knobs.py +0 -0
  272. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/multisetter/__init__.py +0 -0
  273. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/multisetter/multisetter.py +0 -0
  274. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/__init__.py +0 -0
  275. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/constants.py +0 -0
  276. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/masses.py +0 -0
  277. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/pdg.py +0 -0
  278. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/rng_src/base_rng.h +0 -0
  279. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/particles/rng_src/particles_rng.h +0 -0
  280. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/pipeline/__init__.py +0 -0
  281. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/pipeline/core.py +0 -0
  282. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/pipeline/manager.py +0 -0
  283. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/pipeline/multitracker.py +0 -0
  284. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/progress_indicator.py +0 -0
  285. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/__init__.py +0 -0
  286. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_generators.py +0 -0
  287. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_src/exponential.h +0 -0
  288. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  289. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_src/normal.h +0 -0
  290. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_src/rutherford.h +0 -0
  291. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_src/uniform.h +0 -0
  292. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/random/random_src/uniform_accurate.h +0 -0
  293. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/slicing.py +0 -0
  294. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/survey.py +0 -0
  295. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/svgutils/__init__.py +0 -0
  296. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/svgutils/parser.py +0 -0
  297. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/svgutils/path.py +0 -0
  298. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/svgutils/svgutils.py +0 -0
  299. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/synctime.py +0 -0
  300. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/targets.py +0 -0
  301. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/tracker.py +0 -0
  302. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/tracker_data.py +0 -0
  303. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/tracker_src/tracker.h +0 -0
  304. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack/twissplot.py +0 -0
  305. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack.egg-info/SOURCES.txt +0 -0
  306. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack.egg-info/dependency_links.txt +0 -0
  307. {xtrack-0.83.1 → xtrack-0.83.3}/xtrack.egg-info/requires.txt +0 -0
  308. {xtrack-0.83.1 → xtrack-0.83.3}/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.83.1
3
+ Version: 0.83.3
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
@@ -361,4 +361,21 @@ def test_aperture_svg_path():
361
361
  xo.assert_allclose(aper.x_vertices, x_expected, atol=1e-6, rtol=0)
362
362
  xo.assert_allclose(aper.y_vertices, y_expected, atol=1e-6, rtol=0)
363
363
  xo.assert_allclose(aper2.x_vertices, x_expected, atol=1e-6, rtol=0)
364
- xo.assert_allclose(aper2.y_vertices, y_expected, atol=1e-6, rtol=0)
364
+ xo.assert_allclose(aper2.y_vertices, y_expected, atol=1e-6, rtol=0)
365
+
366
+ def test_limitrect_to_dict():
367
+
368
+ lrect = xt.LimitRect(min_x=-0.03, max_x=0.03, min_y=0.0, max_y=0.09)
369
+ lrect2 = xt.LimitRect.from_dict(lrect.to_dict())
370
+
371
+ assert lrect2.min_x == lrect.min_x
372
+ assert lrect2.max_x == lrect.max_x
373
+ assert lrect2.min_y == lrect.min_y
374
+ assert lrect2.max_y == lrect.max_y
375
+
376
+ lrectdef = xt.LimitRect()
377
+
378
+ assert lrectdef.min_x == -1e10
379
+ assert lrectdef.max_x == 1e10
380
+ assert lrectdef.min_y == -1e10
381
+ assert lrectdef.max_y == 1e10
@@ -618,6 +618,7 @@ def test_assemble_ring():
618
618
  cell3_select = ring2.select(start='start.cell.3.arc.2', end='end.cell.3.arc.2',
619
619
  name='cell3_copy')
620
620
  assert 'cell3_copy' in env.lines
621
+ assert cell3_select.particle_ref is not None
621
622
  assert env.lines['cell3_copy'] is cell3_select
622
623
  assert cell3_select._element_dict is env.element_dict
623
624
  assert cell3_select.element_names[0] == 'start.cell.3.arc.2'
@@ -531,3 +531,109 @@ def test_orbit_correction_tilt_monitors():
531
531
 
532
532
  # Check that there is no vertical reading in the tilted bpm BPMs
533
533
  xo.assert_allclose(correction.y_correction._position_before, 0, atol=1e-15, rtol=0)
534
+
535
+ def test_orbit_correction_with_limits():
536
+
537
+ line = xt.Line.from_json(test_data_folder
538
+ / 'hllhc15_thick/lhc_thick_with_knobs.json')
539
+ line.build_tracker()
540
+ tt = line.get_table()
541
+
542
+ # Define elements to be used as monitors for orbit correction
543
+ tt_monitors = tt.rows['bpm.*','.*(?<!_entry)$','.*(?<!_exit)$']
544
+ line.steering_monitors_x = tt_monitors.name
545
+ line.steering_monitors_y = tt_monitors.name
546
+
547
+ # Define elements to be used as correctors for orbit correction
548
+ tt_h_correctors = tt.rows['mcb.*'].rows[r'.*h\..*']
549
+ line.steering_correctors_x = tt_h_correctors.name
550
+ tt_v_correctors = tt.rows['mcb.*'].rows[r'.*v\..*']
551
+ line.steering_correctors_y = tt_v_correctors.name
552
+
553
+ # Reference twiss (no misalignments)
554
+ tw_ref = line.twiss4d()
555
+
556
+ # Introduce misalignments on all quadrupoles
557
+ tt = line.get_table()
558
+ tt_quad = tt.rows[tt.element_type == 'Quadrupole']
559
+ rgen = np.random.RandomState(1) # fix seed for random number generator
560
+ shift_x = rgen.randn(len(tt_quad)) * 0.01e-3 # 0.01 mm rms shift on all quads
561
+ shift_y = rgen.randn(len(tt_quad)) * 0.01e-3 # 0.01 mm rms shift on all quads
562
+ for nn_quad, sx, sy in zip(tt_quad.name, shift_x, shift_y):
563
+ line.element_refs[nn_quad].shift_x = sx
564
+ line.element_refs[nn_quad].shift_y = sy
565
+
566
+ # Twiss before correction
567
+ tw_before = line.twiss4d()
568
+
569
+ # Define limits for correctors (in radians)
570
+ limits_x = (-1e-6, 1e-6) # 1 urad
571
+ limits_y = (-1e-6, 1e-6) # 1 urad
572
+
573
+ # Orbit correction without limits as reference
574
+ orbit_correction_basic_no_limits = line.correct_trajectory(twiss_table=tw_ref)
575
+
576
+ #print(np.max(np.abs(orbit_correction_basic_no_limits.x_correction.get_kick_values())))
577
+ #print(np.max(np.abs(orbit_correction_basic_no_limits.y_correction.get_kick_values())))
578
+
579
+ #Assert that at least one corrector is beyond each of the limits
580
+ assert np.any(np.abs(orbit_correction_basic_no_limits.x_correction.get_kick_values()) > limits_x[1])
581
+ assert np.any(np.abs(orbit_correction_basic_no_limits.y_correction.get_kick_values()) > limits_y[1])
582
+ orbit_correction_basic_no_limits.clear_correction_knobs()
583
+
584
+ # Set limits on the line
585
+ line.corrector_limits_x = limits_x
586
+ line.corrector_limits_y = limits_y
587
+
588
+ # First test: Basic method with limits
589
+ orbit_correction_basic = line.correct_trajectory(twiss_table=tw_ref)
590
+
591
+ # Twiss after basic correction
592
+ tw_after_basic = line.twiss4d()
593
+
594
+ # Extract correction strength from basic method
595
+ kicks_x_basic = orbit_correction_basic.x_correction.get_kick_values()
596
+ kicks_y_basic = orbit_correction_basic.y_correction.get_kick_values()
597
+
598
+ # Verify that the basic correction stays within limits
599
+ assert np.all(kicks_x_basic >= limits_x[0])
600
+ assert np.all(kicks_x_basic <= limits_x[1])
601
+ assert np.all(kicks_y_basic >= limits_y[0])
602
+ assert np.all(kicks_y_basic <= limits_y[1])
603
+
604
+ # Verify that the orbit is corrected in the correct direction with basic method
605
+ assert tw_before.x.std() > tw_after_basic.x.std()
606
+ assert tw_before.y.std() > tw_after_basic.y.std()
607
+
608
+ # Clear correction
609
+ orbit_correction_basic.clear_correction_knobs()
610
+
611
+ # Second test: Micado method with limits
612
+ n_micado = 5
613
+ orbit_correction_micado = line.correct_trajectory(twiss_table=tw_ref, n_micado=n_micado, n_iter=1)
614
+
615
+ # Twiss after micado correction
616
+ tw_after_micado = line.twiss4d()
617
+
618
+ # Extract correction strength from micado method
619
+ kicks_x_micado = orbit_correction_micado.x_correction.get_kick_values()
620
+ kicks_y_micado = orbit_correction_micado.y_correction.get_kick_values()
621
+
622
+ # Verify that the micado correction stays within limits
623
+ assert np.all(kicks_x_micado >= limits_x[0])
624
+ assert np.all(kicks_x_micado <= limits_x[1])
625
+ assert np.all(kicks_y_micado >= limits_y[0])
626
+ assert np.all(kicks_y_micado <= limits_y[1])
627
+
628
+ # Verify that the orbit is corrected with micado method
629
+ assert tw_after_micado.y.std() < tw_before.y.std()
630
+ assert tw_after_micado.x.std() < tw_before.x.std()
631
+
632
+ # Verify that micado uses at most the specified number of correctors
633
+ assert np.sum(np.abs(kicks_x_micado) > 1e-10) <= n_micado
634
+ assert np.sum(np.abs(kicks_y_micado) > 1e-10) <= n_micado
635
+
636
+ # Compare the two methods
637
+ # Basic method should use more correctors
638
+ assert np.sum(np.abs(kicks_x_basic) > 1e-10) > n_micado
639
+ assert np.sum(np.abs(kicks_y_basic) > 1e-10) > n_micado
@@ -0,0 +1 @@
1
+ __version__ = '0.83.3'
@@ -33,27 +33,16 @@ class LimitRect(BeamElement):
33
33
  """
34
34
 
35
35
  _xofields = {
36
- "min_x": xo.Float64,
37
- "max_x": xo.Float64,
38
- "min_y": xo.Float64,
39
- "max_y": xo.Float64,
36
+ "min_x": xo.Field(xo.Float64, default=-UNLIMITED),
37
+ "max_x": xo.Field(xo.Float64, default=UNLIMITED),
38
+ "min_y": xo.Field(xo.Float64, default=-UNLIMITED),
39
+ "max_y": xo.Field(xo.Float64, default=UNLIMITED),
40
40
  }
41
41
 
42
42
  has_backtrack = True
43
43
 
44
44
  _extra_c_sources = ['#include <beam_elements/apertures_src/limitrect.h>']
45
45
 
46
- def __init__(
47
- self,
48
- min_x=-UNLIMITED,
49
- max_x=UNLIMITED,
50
- min_y=-UNLIMITED,
51
- max_y=UNLIMITED,
52
- **kwargs,
53
- ):
54
-
55
- super().__init__(min_x=min_x, max_x=max_x, min_y=min_y, max_y=max_y, **kwargs)
56
-
57
46
 
58
47
  class LimitRacetrack(BeamElement):
59
48
  """
@@ -77,10 +66,10 @@ class LimitRacetrack(BeamElement):
77
66
  """
78
67
 
79
68
  _xofields = {
80
- "min_x": xo.Float64,
81
- "max_x": xo.Float64,
82
- "min_y": xo.Float64,
83
- "max_y": xo.Float64,
69
+ "min_x": xo.Field(xo.Float64, default=-UNLIMITED),
70
+ "max_x": xo.Field(xo.Float64, default=UNLIMITED),
71
+ "min_y": xo.Field(xo.Float64, default=-UNLIMITED),
72
+ "max_y": xo.Field(xo.Float64, default=UNLIMITED),
84
73
  "a": xo.Float64,
85
74
  "b": xo.Float64,
86
75
  }
@@ -435,8 +424,8 @@ class LimitRectEllipse(BeamElement):
435
424
  """
436
425
 
437
426
  _xofields = {
438
- "max_x": xo.Float64,
439
- "max_y": xo.Float64,
427
+ "max_x": xo.Field(xo.Float64, default=UNLIMITED),
428
+ "max_y": xo.Field(xo.Float64, default=UNLIMITED),
440
429
  "a_squ": xo.Float64,
441
430
  "b_squ": xo.Float64,
442
431
  "a_b_squ": xo.Float64,
@@ -533,10 +522,10 @@ class LongitudinalLimitRect(BeamElement):
533
522
  """
534
523
 
535
524
  _xofields = {
536
- "min_zeta": xo.Float64,
537
- "max_zeta": xo.Float64,
538
- "min_pzeta": xo.Float64,
539
- "max_pzeta": xo.Float64,
525
+ "min_zeta": xo.Field(xo.Float64, default=-UNLIMITED),
526
+ "max_zeta": xo.Field(xo.Float64, default=UNLIMITED),
527
+ "min_pzeta": xo.Field(xo.Float64, default=-UNLIMITED),
528
+ "max_pzeta": xo.Field(xo.Float64, default=UNLIMITED),
540
529
  }
541
530
 
542
531
  has_backtrack = True
@@ -116,95 +116,99 @@ void magnet_apply_radiation_single_particle(
116
116
 
117
117
  if ((spin_flag != 0) && (spin_x_0 != 0. || spin_y_0 != 0. || spin_z_0 != 0.)){
118
118
 
119
- double const kin_px_mean = (old_px + new_ax);
120
- double const kin_py_mean = (old_py + new_ay);
121
-
122
- double const kin_pz_mean = sqrt((1 + delta)*(1 + delta) - kin_px_mean * kin_px_mean - kin_py_mean * kin_py_mean);
123
-
124
- double const beta_x = beta * (kin_px_mean / kin_pz_mean);
125
- double const beta_y = beta * (kin_py_mean / kin_pz_mean);
126
- double const beta_z = sqrt(beta*beta - beta_x * beta_x - beta_y * beta_y);
127
-
128
- double const iv_x = beta_x / beta;
129
- double const iv_y = beta_y / beta;
130
- double const iv_z = beta_z / beta;
131
-
132
- double B_par_spin = Bx_T * iv_x + By_T * iv_y + Bz_T * iv_z;
133
- double const B_par_spin_x = B_par_spin * iv_x;
134
- double const B_par_spin_y = B_par_spin * iv_y;
135
- double const B_par_spin_z = B_par_spin * iv_z;
136
-
137
- double const B_perp_spin_x = Bx_T - B_par_spin_x;
138
- double const B_perp_spin_y = By_T - B_par_spin_y;
139
- double const B_perp_spin_z = Bz_T - B_par_spin_z;
140
-
141
- double const brho_part = P_J / (q0 * QELEM);
142
-
143
- double const G_spin = LocalParticle_get_anomalous_magnetic_moment(part);
144
-
145
- double const Omega_BMT_x = -1/brho_part * (
146
- (1 + G_spin*gamma) * B_perp_spin_x + (1 + G_spin) * B_par_spin_x);
147
- double const Omega_BMT_y = -1/brho_part * (
148
- (1 + G_spin*gamma) * B_perp_spin_y + (1 + G_spin) * B_par_spin_y);
149
- double const Omega_BMT_z = -1/brho_part * (
150
- (1 + G_spin*gamma) * B_perp_spin_z + (1 + G_spin) * B_par_spin_z);
151
-
152
- double Omega_BMT_mod = sqrt(Omega_BMT_x * Omega_BMT_x +
153
- Omega_BMT_y * Omega_BMT_y + Omega_BMT_z * Omega_BMT_z);
154
-
155
- if (Omega_BMT_mod > 1e-10){
156
-
157
- double const omega_x = Omega_BMT_x / Omega_BMT_mod;
158
- double const omega_y = Omega_BMT_y / Omega_BMT_mod;
159
- double const omega_z = Omega_BMT_z / Omega_BMT_mod;
160
-
161
- double const phi = Omega_BMT_mod * l_path;
162
-
163
- double const sin_phi_2 = sin(phi/2);
164
- double const cos_phi_2 = cos(phi/2);
165
-
166
- // Quaternion rotation
167
- double const t0 = cos_phi_2;
168
- double const tx = omega_x * sin_phi_2;
169
- double const ty = omega_y * sin_phi_2;
170
- double const tz = omega_z * sin_phi_2;
171
-
172
- // Rotation matrix
173
- double const M11 = t0 * t0 + tx * tx - ty * ty - tz * tz;
174
- double const M12 = 2 * (tx * ty - t0 * tz);
175
- double const M13 = 2 * (tx * tz + t0 * ty);
176
- double const M21 = 2 * (tx * ty + t0 * tz);
177
- double const M22 = t0 * t0 - tx * tx + ty * ty - tz * tz;
178
- double const M23 = 2 * (ty * tz - t0 * tx);
179
- double const M31 = 2 * (tx * tz - t0 * ty);
180
- double const M32 = 2 * (ty * tz + t0 * tx);
181
- double const M33 = t0 * t0 - tx * tx - ty * ty + tz * tz;
182
-
183
- double sin_hxl2 = 0.;
184
- double cos_hxl2 = 1.;
185
- if (hx != 0.){
186
- sin_hxl2 = sin(hx * length / 2);
187
- cos_hxl2 = cos(hx * length / 2);
119
+ #ifdef XSUITE_BACKTRACK
120
+ LocalParticle_set_state(part, -33);
121
+ #else
122
+ double const kin_px_mean = (old_px + new_ax);
123
+ double const kin_py_mean = (old_py + new_ay);
124
+
125
+ double const kin_pz_mean = sqrt((1 + delta)*(1 + delta) - kin_px_mean * kin_px_mean - kin_py_mean * kin_py_mean);
126
+
127
+ double const beta_x = beta * (kin_px_mean / kin_pz_mean);
128
+ double const beta_y = beta * (kin_py_mean / kin_pz_mean);
129
+ double const beta_z = sqrt(beta*beta - beta_x * beta_x - beta_y * beta_y);
130
+
131
+ double const iv_x = beta_x / beta;
132
+ double const iv_y = beta_y / beta;
133
+ double const iv_z = beta_z / beta;
134
+
135
+ double B_par_spin = Bx_T * iv_x + By_T * iv_y + Bz_T * iv_z;
136
+ double const B_par_spin_x = B_par_spin * iv_x;
137
+ double const B_par_spin_y = B_par_spin * iv_y;
138
+ double const B_par_spin_z = B_par_spin * iv_z;
139
+
140
+ double const B_perp_spin_x = Bx_T - B_par_spin_x;
141
+ double const B_perp_spin_y = By_T - B_par_spin_y;
142
+ double const B_perp_spin_z = Bz_T - B_par_spin_z;
143
+
144
+ double const brho_part = P_J / (q0 * QELEM);
145
+
146
+ double const G_spin = LocalParticle_get_anomalous_magnetic_moment(part);
147
+
148
+ double const Omega_BMT_x = -1/brho_part * (
149
+ (1 + G_spin*gamma) * B_perp_spin_x + (1 + G_spin) * B_par_spin_x);
150
+ double const Omega_BMT_y = -1/brho_part * (
151
+ (1 + G_spin*gamma) * B_perp_spin_y + (1 + G_spin) * B_par_spin_y);
152
+ double const Omega_BMT_z = -1/brho_part * (
153
+ (1 + G_spin*gamma) * B_perp_spin_z + (1 + G_spin) * B_par_spin_z);
154
+
155
+ double Omega_BMT_mod = sqrt(Omega_BMT_x * Omega_BMT_x +
156
+ Omega_BMT_y * Omega_BMT_y + Omega_BMT_z * Omega_BMT_z);
157
+
158
+ if (Omega_BMT_mod > 1e-10){
159
+
160
+ double const omega_x = Omega_BMT_x / Omega_BMT_mod;
161
+ double const omega_y = Omega_BMT_y / Omega_BMT_mod;
162
+ double const omega_z = Omega_BMT_z / Omega_BMT_mod;
163
+
164
+ double const phi = Omega_BMT_mod * l_path;
165
+
166
+ double const sin_phi_2 = sin(phi/2);
167
+ double const cos_phi_2 = cos(phi/2);
168
+
169
+ // Quaternion rotation
170
+ double const t0 = cos_phi_2;
171
+ double const tx = omega_x * sin_phi_2;
172
+ double const ty = omega_y * sin_phi_2;
173
+ double const tz = omega_z * sin_phi_2;
174
+
175
+ // Rotation matrix
176
+ double const M11 = t0 * t0 + tx * tx - ty * ty - tz * tz;
177
+ double const M12 = 2 * (tx * ty - t0 * tz);
178
+ double const M13 = 2 * (tx * tz + t0 * ty);
179
+ double const M21 = 2 * (tx * ty + t0 * tz);
180
+ double const M22 = t0 * t0 - tx * tx + ty * ty - tz * tz;
181
+ double const M23 = 2 * (ty * tz - t0 * tx);
182
+ double const M31 = 2 * (tx * tz - t0 * ty);
183
+ double const M32 = 2 * (ty * tz + t0 * tx);
184
+ double const M33 = t0 * t0 - tx * tx - ty * ty + tz * tz;
185
+
186
+ double sin_hxl2 = 0.;
187
+ double cos_hxl2 = 1.;
188
+ if (hx != 0.){
189
+ sin_hxl2 = sin(hx * length / 2);
190
+ cos_hxl2 = cos(hx * length / 2);
191
+ }
192
+ // Entry rotation (bend frame)
193
+ double const spin_x_1 = spin_x_0 * cos_hxl2 + spin_z_0 * sin_hxl2;
194
+ double const spin_y_1 = spin_y_0;
195
+ double const spin_z_1 = -spin_x_0 * sin_hxl2 + spin_z_0 * cos_hxl2;
196
+
197
+ // BMT rotation
198
+ double const spin_x_2 = M11 * spin_x_1 + M12 * spin_y_1 + M13 * spin_z_1;
199
+ double const spin_y_2 = M21 * spin_x_1 + M22 * spin_y_1 + M23 * spin_z_1;
200
+ double const spin_z_2 = M31 * spin_x_1 + M32 * spin_y_1 + M33 * spin_z_1;
201
+
202
+ // Exit rotation (bend frame)
203
+ double const spin_x_3 = spin_x_2 * cos_hxl2 + spin_z_2 * sin_hxl2;
204
+ double const spin_y_3 = spin_y_2;
205
+ double const spin_z_3 = -spin_x_2 * sin_hxl2 + spin_z_2 * cos_hxl2;
206
+
207
+ LocalParticle_set_spin_x(part, spin_x_3);
208
+ LocalParticle_set_spin_y(part, spin_y_3);
209
+ LocalParticle_set_spin_z(part, spin_z_3);
188
210
  }
189
- // Entry rotation (bend frame)
190
- double const spin_x_1 = spin_x_0 * cos_hxl2 + spin_z_0 * sin_hxl2;
191
- double const spin_y_1 = spin_y_0;
192
- double const spin_z_1 = -spin_x_0 * sin_hxl2 + spin_z_0 * cos_hxl2;
193
-
194
- // BMT rotation
195
- double const spin_x_2 = M11 * spin_x_1 + M12 * spin_y_1 + M13 * spin_z_1;
196
- double const spin_y_2 = M21 * spin_x_1 + M22 * spin_y_1 + M23 * spin_z_1;
197
- double const spin_z_2 = M31 * spin_x_1 + M32 * spin_y_1 + M33 * spin_z_1;
198
-
199
- // Exit rotation (bend frame)
200
- double const spin_x_3 = spin_x_2 * cos_hxl2 + spin_z_2 * sin_hxl2;
201
- double const spin_y_3 = spin_y_2;
202
- double const spin_z_3 = -spin_x_2 * sin_hxl2 + spin_z_2 * cos_hxl2;
203
-
204
- LocalParticle_set_spin_x(part, spin_x_3);
205
- LocalParticle_set_spin_y(part, spin_y_3);
206
- LocalParticle_set_spin_z(part, spin_z_3);
207
- }
211
+ #endif
208
212
  }
209
213
 
210
214
  // Synchrotron radiation
@@ -165,6 +165,8 @@ class Line:
165
165
  self._extra_config['steering_monitors_y'] = None
166
166
  self._extra_config['steering_correctors_x'] = None
167
167
  self._extra_config['steering_correctors_y'] = None
168
+ self._extra_config['corrector_limits_x'] = None
169
+ self._extra_config['corrector_limits_y'] = None
168
170
 
169
171
  if env is None:
170
172
  env = xt.Environment()
@@ -1590,8 +1592,8 @@ class Line:
1590
1592
  monitor_names_x=None, corrector_names_x=None,
1591
1593
  monitor_names_y=None, corrector_names_y=None,
1592
1594
  n_micado=None, n_singular_values=None, rcond=None,
1593
- monitor_alignment=None,
1594
- ):
1595
+ monitor_alignment=None, corrector_limits_x=None,
1596
+ corrector_limits_y=None):
1595
1597
 
1596
1598
  '''
1597
1599
  Correct the beam trajectory using linearized response matrix from optics
@@ -1642,6 +1644,14 @@ class Line:
1642
1644
  rcond : float
1643
1645
  Cutoff for small singular values (relative to the largest singular
1644
1646
  value). Singular values smaller than `rcond` are considered zero.
1647
+ corrector_limits_x : tuple of array-like or None
1648
+ Limits for the horizontal corrector strengths. If not None, it should be a tuple
1649
+ of two arrays (lower_limits, upper_limits) with the same length as
1650
+ the number of horizontal correctors. If None, no limits are applied.
1651
+ corrector_limits_y : tuple of array-like or None
1652
+ Limits for the vertical corrector strengths. If not None, it should be a tuple
1653
+ of two arrays (lower_limits, upper_limits) with the same length as
1654
+ the number of vertical correctors. If None, no limits are applied.
1645
1655
 
1646
1656
  Returns
1647
1657
  -------
@@ -1658,7 +1668,9 @@ class Line:
1658
1668
  corrector_names_y=corrector_names_y,
1659
1669
  n_micado=n_micado, n_singular_values=n_singular_values,
1660
1670
  rcond=rcond,
1661
- monitor_alignment=monitor_alignment)
1671
+ monitor_alignment=monitor_alignment,
1672
+ corrector_limits_x=corrector_limits_x,
1673
+ corrector_limits_y=corrector_limits_y)
1662
1674
 
1663
1675
  if run:
1664
1676
  correction.correct(planes=planes, n_iter=n_iter)
@@ -2236,8 +2248,10 @@ class Line:
2236
2248
  def cut_at_s(self, s: List[float], s_tol=1e-6, return_slices=False):
2237
2249
  """Slice the line so that positions in s never fall inside an element."""
2238
2250
 
2239
- if self._has_valid_tracker():
2240
- self.discard_tracker()
2251
+ if not self._has_valid_tracker():
2252
+ self.build_tracker() # To resolve replicase and slices
2253
+
2254
+ self.discard_tracker()
2241
2255
 
2242
2256
  cuts_for_element = self._elements_intersecting_s(s, s_tol=s_tol)
2243
2257
  strategies = [Strategy(None)] # catch-all, ignore unaffected elements
@@ -3085,7 +3099,8 @@ class Line:
3085
3099
  if mode != 'deprecated':
3086
3100
  raise NameError('mode is deprecated, use model instead')
3087
3101
 
3088
- self._check_valid_tracker()
3102
+ if not self._has_valid_tracker():
3103
+ self.build_tracker()
3089
3104
 
3090
3105
  assert model in [None, 'mean', 'quantum']
3091
3106
  assert model_beamstrahlung in [None, 'mean', 'quantum']
@@ -4169,6 +4184,7 @@ class Line:
4169
4184
  self._env_if_needed()
4170
4185
 
4171
4186
  out = self.env.new_line(components=list(tt.env_name), name=name)
4187
+ out.particle_ref = self.particle_ref.copy() if self.particle_ref else None
4172
4188
 
4173
4189
  if hasattr(self, '_in_multiline') and self._in_multiline is not None:
4174
4190
  out.env._var_management = None
@@ -4694,6 +4710,22 @@ class Line:
4694
4710
  def steering_correctors_y(self, value):
4695
4711
  self._extra_config['steering_correctors_y'] = value
4696
4712
 
4713
+ @property
4714
+ def corrector_limits_x(self):
4715
+ return self._extra_config.get('corrector_limits_x', None)
4716
+
4717
+ @corrector_limits_x.setter
4718
+ def corrector_limits_x(self, value):
4719
+ self._extra_config['corrector_limits_x'] = value
4720
+
4721
+ @property
4722
+ def corrector_limits_y(self):
4723
+ return self._extra_config.get('corrector_limits_y', None)
4724
+
4725
+ @corrector_limits_y.setter
4726
+ def corrector_limits_y(self, value):
4727
+ self._extra_config['corrector_limits_y'] = value
4728
+
4697
4729
  def __getitem__(self, key):
4698
4730
  if np.issubdtype(key.__class__, np.integer):
4699
4731
  key = self.element_names[key]
@@ -221,7 +221,7 @@ class Particles(xo.HybridClass):
221
221
 
222
222
  accepted_args = set(self._xofields.keys()) | {
223
223
  'energy0', 'tau', 'pzeta', 'mass_ratio', 'mass', 'kinetic_energy0',
224
- '_context', '_buffer', '_offset', 'p0',
224
+ '_context', '_buffer', '_offset', 'p0', 'name',
225
225
  }
226
226
  if set(kwargs.keys()) - accepted_args:
227
227
  raise NameError(f'Invalid argument(s) provided: '
@@ -383,6 +383,8 @@ class Particles(xo.HybridClass):
383
383
  if isinstance(self._context, xo.ContextCpu) and not _no_reorganize:
384
384
  self.reorganize()
385
385
 
386
+ if 'name' in kwargs.keys():
387
+ self.name = kwargs['name']
386
388
 
387
389
  @classmethod
388
390
  def from_dict(cls, dct, load_rng_state=True, **kwargs):
@@ -7,7 +7,9 @@ import xtrack as xt
7
7
  import xobjects as xo
8
8
 
9
9
  def compensate_radiation_energy_loss(line, delta0=0, rtol_eneloss=1e-12,
10
- max_iter=100, verbose=True, **kwargs):
10
+ max_iter=100, verbose=True,
11
+ co_search_at=None,
12
+ **kwargs):
11
13
 
12
14
  assert isinstance(line._context, xo.ContextCpu), "Only CPU context is supported"
13
15
  assert line.particle_ref is not None, "Particle reference is not set"
@@ -24,7 +26,7 @@ def compensate_radiation_energy_loss(line, delta0=0, rtol_eneloss=1e-12,
24
26
 
25
27
  line.config.XTRACK_MULTIPOLE_NO_SYNRAD = True
26
28
  with xt.freeze_longitudinal(line):
27
- particle_on_co = line.find_closed_orbit()
29
+ particle_on_co = line.find_closed_orbit(co_search_at=co_search_at)
28
30
  line.config.XTRACK_MULTIPOLE_NO_SYNRAD = False
29
31
 
30
32
  beta0 = float(particle_on_co._xobject.beta0[0])