xtrack 0.65.5__tar.gz → 0.66.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 (250) hide show
  1. {xtrack-0.65.5/xtrack.egg-info → xtrack-0.66.0}/PKG-INFO +1 -1
  2. xtrack-0.66.0/tests/test_periodic_symmetric_twiss_and_match.py +154 -0
  3. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_twiss.py +26 -1
  4. xtrack-0.66.0/xtrack/_version.py +1 -0
  5. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/line.py +1 -2
  6. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/match.py +2 -2
  7. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/twiss.py +80 -33
  8. {xtrack-0.65.5 → xtrack-0.66.0/xtrack.egg-info}/PKG-INFO +1 -1
  9. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack.egg-info/SOURCES.txt +1 -0
  10. xtrack-0.65.5/xtrack/_version.py +0 -1
  11. {xtrack-0.65.5 → xtrack-0.66.0}/LICENSE +0 -0
  12. {xtrack-0.65.5 → xtrack-0.66.0}/MANIFEST.in +0 -0
  13. {xtrack-0.65.5 → xtrack-0.66.0}/README.md +0 -0
  14. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/__init__.py +0 -0
  15. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/base_classes.py +0 -0
  16. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/BB6D.py +0 -0
  17. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  18. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/__init__.py +0 -0
  19. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/beambeam.py +0 -0
  20. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/boost.py +0 -0
  21. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  22. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  23. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/qgauss.py +0 -0
  24. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/slicing.py +0 -0
  25. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
  26. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/elements.py +0 -0
  27. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/line.py +0 -0
  28. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/mathlibs.py +0 -0
  29. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/particles.py +0 -0
  30. {xtrack-0.65.5 → xtrack-0.66.0}/ducktrack/temp_pyparticles.py +0 -0
  31. {xtrack-0.65.5 → xtrack-0.66.0}/pyproject.toml +0 -0
  32. {xtrack-0.65.5 → xtrack-0.66.0}/setup.cfg +0 -0
  33. {xtrack-0.65.5 → xtrack-0.66.0}/setup.py +0 -0
  34. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_acceleration.py +0 -0
  35. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_amplitude_detuning.py +0 -0
  36. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  37. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_apertures.py +0 -0
  38. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_attr_replicas_and_slices.py +0 -0
  39. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_cavity_absolute_time.py +0 -0
  40. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
  41. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_coasting.py +0 -0
  42. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_collective_tracker.py +0 -0
  43. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_collimation.py +0 -0
  44. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_element_characterization_functions.py +0 -0
  45. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_element_internal_record.py +0 -0
  46. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_elements.py +0 -0
  47. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_elements_classflags.py +0 -0
  48. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_elements_thick.py +0 -0
  49. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  50. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  51. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_footprint.py +0 -0
  52. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_freeze_longitudinal.py +0 -0
  53. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_full_rings.py +0 -0
  54. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_hvkick.py +0 -0
  55. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_ions.py +0 -0
  56. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_lhc_match_phase_15.py +0 -0
  57. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_line.py +0 -0
  58. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_lumi.py +0 -0
  59. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_mad_writer.py +0 -0
  60. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_madloader.py +0 -0
  61. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_and_track_from_element.py +0 -0
  62. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_coupling_knob.py +0 -0
  63. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_nested.py +0 -0
  64. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_optics_and_ip_knob.py +0 -0
  65. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  66. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_orbit_bump.py +0 -0
  67. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_match_tune_chroma_cminus.py +0 -0
  68. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_monitor.py +0 -0
  69. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_multiline.py +0 -0
  70. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_multisetter.py +0 -0
  71. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_multispecies.py +0 -0
  72. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_particles_api.py +0 -0
  73. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_pipeline.py +0 -0
  74. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_prebuild_kernels.py +0 -0
  75. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_ps_against_ptc.py +0 -0
  76. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_ps_multiturn_twiss.py +0 -0
  77. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_psb_chicane.py +0 -0
  78. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_pyht_interface.py +0 -0
  79. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_radial_steering.py +0 -0
  80. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_radiation.py +0 -0
  81. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
  82. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_random_gen.py +0 -0
  83. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_random_gen_exp.py +0 -0
  84. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_random_gen_gauss.py +0 -0
  85. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_random_gen_ruth.py +0 -0
  86. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_rf_track.py +0 -0
  87. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_rotation_signs.py +0 -0
  88. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_second_order_taylor_map.py +0 -0
  89. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_seeds.py +0 -0
  90. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_slice_and_insert_with_replicas.py +0 -0
  91. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_slice_elements.py +0 -0
  92. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_slicing.py +0 -0
  93. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  94. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_spacecharge_in_ring.py +0 -0
  95. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_sps_thick.py +0 -0
  96. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_survey.py +0 -0
  97. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_tapering.py +0 -0
  98. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_thick_lhc.py +0 -0
  99. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_tilt_shifts.py +0 -0
  100. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_tracker.py +0 -0
  101. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_trajectory_correcton.py +0 -0
  102. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_twiss_vs_madx_psb.py +0 -0
  103. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_var_cache.py +0 -0
  104. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_vs_madx.py +0 -0
  105. {xtrack-0.65.5 → xtrack-0.66.0}/tests/test_xmask_orbit_correction.py +0 -0
  106. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/__init__.py +0 -0
  107. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/__init__.py +0 -0
  108. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  109. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  110. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  111. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
  112. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  113. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  114. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  115. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/base_element.py +0 -0
  116. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/__init__.py +0 -0
  117. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures.py +0 -0
  118. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  119. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  120. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  121. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  122. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  123. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  124. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/beam_interaction.py +0 -0
  125. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements.py +0 -0
  126. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
  127. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  128. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
  129. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  130. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
  131. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
  132. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  133. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  134. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  135. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  136. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  137. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
  138. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  139. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  140. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
  141. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  142. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  143. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  144. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  145. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  146. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  147. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  148. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  149. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  150. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  151. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
  152. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  153. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  154. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  155. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  156. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  157. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  158. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  159. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  160. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  161. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  162. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  163. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  164. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  165. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  166. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  167. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  168. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
  169. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
  170. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  171. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  172. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  173. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  174. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  175. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  176. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  177. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
  178. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  179. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  180. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  181. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
  182. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  183. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  184. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  185. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  186. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/exciter.py +0 -0
  187. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/rft_element.py +0 -0
  188. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/slice_elements.py +0 -0
  189. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  190. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/footprint.py +0 -0
  191. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/general.py +0 -0
  192. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/headers/atomicadd.h +0 -0
  193. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/headers/checks.h +0 -0
  194. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/headers/constants.h +0 -0
  195. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/headers/particle_states.h +0 -0
  196. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/headers/synrad_spectrum.h +0 -0
  197. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/internal_record.py +0 -0
  198. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/linear_normal_form.py +0 -0
  199. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/loss_location_refinement/__init__.py +0 -0
  200. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  201. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/lumi.py +0 -0
  202. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/mad_loader.py +0 -0
  203. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/mad_writer.py +0 -0
  204. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/__init__.py +0 -0
  205. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/beam_position_monitor.h +0 -0
  206. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/beam_position_monitor.py +0 -0
  207. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
  208. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
  209. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/beam_size_monitor.h +0 -0
  210. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/beam_size_monitor.py +0 -0
  211. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/last_turns_monitor.h +0 -0
  212. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/last_turns_monitor.py +0 -0
  213. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/particles_monitor.h +0 -0
  214. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/monitors/particles_monitor.py +0 -0
  215. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/multiline/__init__.py +0 -0
  216. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/multiline/multiline.py +0 -0
  217. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/multiline/shared_knobs.py +0 -0
  218. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/multisetter/__init__.py +0 -0
  219. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/multisetter/multisetter.py +0 -0
  220. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/particles/__init__.py +0 -0
  221. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/particles/constants.py +0 -0
  222. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/particles/particles.py +0 -0
  223. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/particles/rng_src/base_rng.h +0 -0
  224. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
  225. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/pipeline/__init__.py +0 -0
  226. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/pipeline/core.py +0 -0
  227. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/pipeline/manager.py +0 -0
  228. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/pipeline/multitracker.py +0 -0
  229. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/progress_indicator.py +0 -0
  230. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/__init__.py +0 -0
  231. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_generators.py +0 -0
  232. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_src/exponential.h +0 -0
  233. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  234. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_src/normal.h +0 -0
  235. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_src/rutherford.h +0 -0
  236. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_src/uniform.h +0 -0
  237. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/random/random_src/uniform_accurate.h +0 -0
  238. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/slicing.py +0 -0
  239. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/survey.py +0 -0
  240. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/synctime.py +0 -0
  241. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/tapering.py +0 -0
  242. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/targets.py +0 -0
  243. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/tracker.py +0 -0
  244. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/tracker_data.py +0 -0
  245. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/tracker_src/tracker.h +0 -0
  246. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/trajectory_correction.py +0 -0
  247. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack/twissplot.py +0 -0
  248. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack.egg-info/dependency_links.txt +0 -0
  249. {xtrack-0.65.5 → xtrack-0.66.0}/xtrack.egg-info/requires.txt +0 -0
  250. {xtrack-0.65.5 → xtrack-0.66.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.65.5
3
+ Version: 0.66.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
@@ -0,0 +1,154 @@
1
+
2
+ import xtrack as xt
3
+ import xobjects as xo
4
+ import numpy as np
5
+
6
+ def test_periodic_symmetric_twiss_and_match():
7
+
8
+ # Build line with half a cell
9
+ half_cell = xt.Line(
10
+ elements={
11
+ 'start_cell': xt.Marker(),
12
+ 'drift0': xt.Drift(length=1.),
13
+ 'qf1': xt.Quadrupole(k1=0.027/2, length=1.),
14
+ 'drift1_1': xt.Drift(length=1),
15
+ 'bend1': xt.Bend(k0=3e-4, h=3e-4, length=45.),
16
+ 'drift1_2': xt.Drift(length=1.),
17
+ 'qd1': xt.Quadrupole(k1=-0.0271/2, length=1.),
18
+ 'drift2': xt.Drift(length=1),
19
+ 'mid_cell': xt.Marker(),
20
+ }
21
+ )
22
+ half_cell.particle_ref = xt.Particles(p0c=2e9)
23
+
24
+ tw_half_cell = half_cell.twiss4d(init='periodic_symmetric', # <--- periodic-symmetric boundary
25
+ strengths=True # to get the strengths in table
26
+ )
27
+
28
+ cell = xt.Line(
29
+ elements={
30
+ 'start_cell': xt.Marker(),
31
+ 'drift0': xt.Drift(length=1.),
32
+ 'qf1': xt.Quadrupole(k1=0.027/2, length=1.),
33
+ 'drift1': xt.Drift(length=1),
34
+ 'bend1': xt.Bend(k0=3e-4, h=3e-4, length=45.),
35
+ 'drift2': xt.Drift(length=1.),
36
+ 'qd1': xt.Quadrupole(k1=-0.0271/2, length=1.),
37
+ 'drift3': xt.Drift(length=1),
38
+ 'mid_cell': xt.Marker(),
39
+ 'drift4': xt.Replica('drift3'),
40
+ 'qd2': xt.Replica('qd1'),
41
+ 'drift5': xt.Replica('drift2'),
42
+ 'bend2': xt.Replica('bend1'),
43
+ 'drift6': xt.Replica('drift1'),
44
+ 'qf2': xt.Replica('qf1'),
45
+ 'drift7': xt.Replica('drift0'),
46
+ 'end_cell': xt.Marker(),
47
+ }
48
+ )
49
+ cell.particle_ref = xt.Particles(p0c=2e9)
50
+ tw_cell = cell.twiss4d(strengths=True)
51
+
52
+ xo.assert_allclose(tw_half_cell.betx[:-1], # remove '_end_point'
53
+ tw_cell.rows[:'mid_cell'].betx, atol=0, rtol=1e-8)
54
+ xo.assert_allclose(tw_half_cell.bety[:-1], # remove '_end_point'
55
+ tw_cell.rows[:'mid_cell'].bety, atol=0, rtol=1e-8)
56
+ xo.assert_allclose(tw_half_cell.alfx[:-1], # remove '_end_point'
57
+ tw_cell.rows[:'mid_cell'].alfx, atol=1e-8, rtol=0)
58
+ xo.assert_allclose(tw_half_cell.alfy[:-1], # remove '_end_point'
59
+ tw_cell.rows[:'mid_cell'].alfy, atol=1e-8, rtol=0)
60
+ xo.assert_allclose(tw_half_cell.dx[:-1], # remove '_end_point'
61
+ tw_cell.rows[:'mid_cell'].dx, atol=1e-8, rtol=0)
62
+ xo.assert_allclose(tw_half_cell.dpx[:-1], # remove '_end_point'
63
+ tw_cell.rows[:'mid_cell'].dpx, atol=1e-8, rtol=0)
64
+
65
+ xo.assert_allclose(tw_half_cell.ax_chrom[:-1], # remove '_end_point'
66
+ tw_cell.rows[:'mid_cell'].ax_chrom, atol=1e-5, rtol=0)
67
+ xo.assert_allclose(tw_half_cell.ay_chrom[:-1], # remove '_end_point'
68
+ tw_cell.rows[:'mid_cell'].ay_chrom, atol=1e-5, rtol=0)
69
+ xo.assert_allclose(tw_half_cell.bx_chrom[:-1], # remove '_end_point'
70
+ tw_cell.rows[:'mid_cell'].bx_chrom, atol=1e-5, rtol=0)
71
+ xo.assert_allclose(tw_half_cell.by_chrom[:-1], # remove '_end_point'
72
+ tw_cell.rows[:'mid_cell'].by_chrom, atol=1e-5, rtol=0)
73
+
74
+ xo.assert_allclose(tw_half_cell.qx, tw_cell.qx / 2, atol=1e-9, rtol=0)
75
+ xo.assert_allclose(tw_half_cell.qy, tw_cell.qy / 2, atol=1e-9, rtol=0)
76
+ xo.assert_allclose(tw_half_cell.dqx, tw_cell.dqx / 2, atol=1e-6, rtol=0)
77
+ xo.assert_allclose(tw_half_cell.dqy, tw_cell.dqy / 2, atol=1e-6, rtol=0)
78
+
79
+ for ll in [cell, half_cell]:
80
+ ll.vars['kqf'] = 0.027/2
81
+ ll.vars['kqd'] = -0.0271/2
82
+ ll.element_refs['qf1'].k1 = ll.vars['kqf']
83
+ ll.element_refs['qd1'].k1 = ll.vars['kqd']
84
+
85
+ tw_cell = cell.twiss4d(strengths=True)
86
+ tw_half_cell = half_cell.twiss4d(init='periodic_symmetric', strengths=True)
87
+
88
+ xo.assert_allclose(tw_cell.mux[-1], 0.231, atol=1e-3, rtol=0)
89
+ xo.assert_allclose(tw_cell.muy[-1], 0.233, atol=1e-3, rtol=0)
90
+ xo.assert_allclose(tw_half_cell.mux[-1], 0.231 / 2, atol=1e-3, rtol=0)
91
+ xo.assert_allclose(tw_half_cell.muy[-1], 0.233 / 2, atol=1e-3, rtol=0)
92
+
93
+ opt_halfcell = half_cell.match(
94
+ method='4d',
95
+ start='start_cell', end='mid_cell',
96
+ init='periodic_symmetric',
97
+ targets=xt.TargetSet(mux=0.2501/2, muy=0.2502/2, at='mid_cell'),
98
+ vary=xt.VaryList(['kqf', 'kqd'], step=1e-5),
99
+ )
100
+
101
+ tw_cell = cell.twiss4d(strengths=True)
102
+ tw_half_cell = half_cell.twiss4d(init='periodic_symmetric', strengths=True)
103
+
104
+ xo.assert_allclose(tw_half_cell.mux[-1], 0.2501 / 2, atol=1e-3, rtol=0)
105
+ xo.assert_allclose(tw_half_cell.muy[-1], 0.2502 / 2, atol=1e-3, rtol=0)
106
+ xo.assert_allclose(tw_cell.mux[-1], 0.231, atol=1e-3, rtol=0) # unaffected
107
+ xo.assert_allclose(tw_cell.muy[-1], 0.233, atol=1e-3, rtol=0) # unaffected
108
+
109
+ opt_cell = cell.match(
110
+ method='4d',
111
+ start='start_cell', end='end_cell',
112
+ init='periodic',
113
+ targets=xt.TargetSet(mux=0.2501, muy=0.2502, at='end_cell'),
114
+ vary=xt.VaryList(['kqf', 'kqd'], step=1e-5),
115
+ )
116
+
117
+ xo.assert_allclose(half_cell.vv['kqf'], cell.vv['kqf'], rtol=1e-9, atol=0)
118
+ xo.assert_allclose(half_cell.vv['kqd'], cell.vv['kqd'], rtol=1e-9, atol=0)
119
+
120
+ tw_cell = cell.twiss4d(strengths=True)
121
+ tw_half_cell = half_cell.twiss4d(init='periodic_symmetric', strengths=True)
122
+
123
+ xo.assert_allclose(tw_half_cell.mux[-1], 0.2501 / 2, atol=1e-3, rtol=0)
124
+ xo.assert_allclose(tw_half_cell.muy[-1], 0.2502 / 2, atol=1e-3, rtol=0)
125
+ xo.assert_allclose(tw_cell.mux[-1], 0.2501, atol=1e-3, rtol=0)
126
+ xo.assert_allclose(tw_cell.muy[-1], 0.2502, atol=1e-3, rtol=0)
127
+
128
+ xo.assert_allclose(tw_half_cell.betx[:-1], # remove '_end_point'
129
+ tw_cell.rows[:'mid_cell'].betx, atol=0, rtol=1e-8)
130
+ xo.assert_allclose(tw_half_cell.bety[:-1], # remove '_end_point'
131
+ tw_cell.rows[:'mid_cell'].bety, atol=0, rtol=1e-8)
132
+ xo.assert_allclose(tw_half_cell.alfx[:-1], # remove '_end_point'
133
+ tw_cell.rows[:'mid_cell'].alfx, atol=1e-8, rtol=0)
134
+ xo.assert_allclose(tw_half_cell.alfy[:-1], # remove '_end_point'
135
+ tw_cell.rows[:'mid_cell'].alfy, atol=1e-8, rtol=0)
136
+ xo.assert_allclose(tw_half_cell.dx[:-1], # remove '_end_point'
137
+ tw_cell.rows[:'mid_cell'].dx, atol=1e-8, rtol=0)
138
+ xo.assert_allclose(tw_half_cell.dpx[:-1], # remove '_end_point'
139
+ tw_cell.rows[:'mid_cell'].dpx, atol=1e-8, rtol=0)
140
+
141
+ xo.assert_allclose(tw_half_cell.ax_chrom[:-1], # remove '_end_point'
142
+ tw_cell.rows[:'mid_cell'].ax_chrom, atol=1e-5, rtol=0)
143
+ xo.assert_allclose(tw_half_cell.ay_chrom[:-1], # remove '_end_point'
144
+ tw_cell.rows[:'mid_cell'].ay_chrom, atol=1e-5, rtol=0)
145
+ xo.assert_allclose(tw_half_cell.bx_chrom[:-1], # remove '_end_point'
146
+ tw_cell.rows[:'mid_cell'].bx_chrom, atol=1e-5, rtol=0)
147
+ xo.assert_allclose(tw_half_cell.by_chrom[:-1], # remove '_end_point'
148
+ tw_cell.rows[:'mid_cell'].by_chrom, atol=1e-5, rtol=0)
149
+
150
+ xo.assert_allclose(tw_half_cell.qx, tw_cell.qx / 2, atol=1e-9, rtol=0)
151
+ xo.assert_allclose(tw_half_cell.qy, tw_cell.qy / 2, atol=1e-9, rtol=0)
152
+ xo.assert_allclose(tw_half_cell.dqx, tw_cell.dqx / 2, atol=1e-6, rtol=0)
153
+ xo.assert_allclose(tw_half_cell.dqy, tw_cell.dqy / 2, atol=1e-6, rtol=0)
154
+
@@ -51,7 +51,6 @@ def test_twiss_4d_fodo_vs_beta_rel(test_context):
51
51
  xo.assert_allclose(tw.dqx, tw_4d_list[0].dqx, atol=1e-4, rtol=0)
52
52
  xo.assert_allclose(tw.dqy, tw_4d_list[0].dqy, atol=1e-4, rtol=0)
53
53
 
54
-
55
54
  @for_all_test_contexts
56
55
  def test_coupled_beta(test_context):
57
56
  mad = Madx(stdout=False)
@@ -1905,3 +1904,29 @@ def test_part_from_full_periodic(test_context, collider_for_test_twiss_range):
1905
1904
  tw_part2[kk, 'ip2'],
1906
1905
  tw[kk, 'ip2'] - tw[kk, 0] +(tw[kk, '_end_point'] - tw[kk, 'ip8']),
1907
1906
  rtol=1e-12, atol=5e-7)
1907
+
1908
+
1909
+
1910
+
1911
+ @for_all_test_contexts
1912
+ def test_twiss_add_strengths(test_context):
1913
+ ## Generate a simple line
1914
+ n = 6
1915
+ fodo = [
1916
+ xt.Multipole(length=0.2, knl=[0, +0.2], ksl=[0, 0]),
1917
+ xt.Drift(length=1.0),
1918
+ xt.Multipole(length=0.2, knl=[0, -0.2], ksl=[0, 0]),
1919
+ xt.Drift(length=1.0),
1920
+ xt.Multipole(length=1.0, knl=[2 * np.pi / n], hxl=[2 * np.pi / n]),
1921
+ xt.Drift(length=1.0),
1922
+ ]
1923
+ line = xt.Line(elements=n * fodo + [xt.Cavity(frequency=1e9, voltage=0, lag=180)])
1924
+ line.build_tracker(_context=test_context)
1925
+
1926
+ ## Twiss
1927
+ line.particle_ref = xp.Particles(mass0=xp.PROTON_MASS_EV, q0=1, p0c=1e8)
1928
+ tw = line.twiss(method="4d")
1929
+
1930
+ assert "length" not in tw.keys()
1931
+ tw.add_strengths()
1932
+ assert "length" in tw.keys()
@@ -0,0 +1 @@
1
+ __version__ = '0.66.0'
@@ -115,8 +115,7 @@ class Line:
115
115
  if isinstance(elements, dict):
116
116
  element_dict = elements
117
117
  if element_names is None:
118
- raise ValueError('`element_names` must be provided'
119
- ' if `elements` is a dictionary.')
118
+ element_names = list(element_dict.keys())
120
119
  else:
121
120
  if element_names is None:
122
121
  element_names = [f"e{ii}" for ii in range(len(elements))]
@@ -104,7 +104,7 @@ class ActionTwiss(xd.Action):
104
104
  if isinstance(twinit, xt.TwissInit):
105
105
  twinit_list[ii] = twinit.copy()
106
106
  elif isinstance(twinit, str):
107
- assert twinit == 'periodic'
107
+ assert twinit == 'periodic' or twinit == 'periodic_symmetric'
108
108
 
109
109
  # Handle init_at as xt.START or xt.END
110
110
  for ii, init_at in enumerate(ele_init_list):
@@ -126,7 +126,7 @@ class ActionTwiss(xd.Action):
126
126
  twinit_list[ii] = twinit.get_twiss_init(at_element=init_at)
127
127
  ele_init_list[ii] = None
128
128
  else:
129
- assert twinit is None or twinit == 'periodic'
129
+ assert twinit is None or twinit in ['periodic', 'periodic_symmetric']
130
130
 
131
131
  if not ismultiline:
132
132
  # Handle case in which twiss init is defined through kwargs
@@ -119,7 +119,7 @@ def twiss_line(line, particle_ref=None, method=None,
119
119
  normal form is used. If '4d' the 4D normal form is used.
120
120
  start : int or str, optional
121
121
  Index of the element at which the computation starts. If not provided,
122
- the periodic sulution is computed. `init` must be provided if
122
+ the periodic solution is computed. `init` must be provided if
123
123
  `start` is provided.
124
124
  end : int or str, optional
125
125
  Index of the element at which the computation stops.
@@ -405,11 +405,13 @@ def twiss_line(line, particle_ref=None, method=None,
405
405
  if zero_at is None:
406
406
  out.zero_at(start)
407
407
  return _add_action_in_res(out, input_kwargs)
408
- elif (init is not None and init != 'periodic'
408
+ elif (init is not None and init not in ['periodic', 'periodic_symmetric']
409
409
  or betx is not None or bety is not None):
410
410
  periodic = False
411
+ periodic_mode = None
411
412
  else:
412
413
  periodic = True
414
+ periodic_mode = init or 'periodic'
413
415
 
414
416
  if freeze_longitudinal:
415
417
  kwargs = _updated_kwargs_from_locals(kwargs, locals().copy())
@@ -615,6 +617,7 @@ def twiss_line(line, particle_ref=None, method=None,
615
617
  compute_R_element_by_element=compute_R_element_by_element,
616
618
  only_markers=only_markers,
617
619
  only_orbit=only_orbit,
620
+ periodic_mode=periodic_mode
618
621
  )
619
622
  else:
620
623
  # force
@@ -687,7 +690,8 @@ def twiss_line(line, particle_ref=None, method=None,
687
690
  num_turns=num_turns,
688
691
  hide_thin_groups=hide_thin_groups,
689
692
  only_markers=only_markers,
690
- periodic=periodic)
693
+ periodic=periodic,
694
+ periodic_mode=periodic_mode)
691
695
  twiss_res._data.update(cols_chrom)
692
696
  twiss_res._data.update(scalars_chrom)
693
697
  twiss_res._col_names += list(cols_chrom.keys())
@@ -758,11 +762,7 @@ def twiss_line(line, particle_ref=None, method=None,
758
762
  twiss_res._data['values_at'] = 'entry'
759
763
 
760
764
  if strengths:
761
- tt = line.get_table(attr=True).rows[list(twiss_res.name)]
762
- for kk in (NORMAL_STRENGTHS_FROM_ATTR + SKEW_STRENGTHS_FROM_ATTR
763
- + OTHER_FIELDS_FROM_ATTR + OTHER_FIELDS_FROM_TABLE):
764
- twiss_res._col_names.append(kk)
765
- twiss_res._data[kk] = tt[kk].copy()
765
+ _add_strengths_to_twiss_res(twiss_res, line)
766
766
 
767
767
  twiss_res._data['method'] = method
768
768
  twiss_res._data['radiation_method'] = radiation_method
@@ -1245,7 +1245,8 @@ def _compute_chromatic_functions(line, init, delta_chrom, steps_r_matrix,
1245
1245
  start=None, end=None, num_turns=None,
1246
1246
  hide_thin_groups=False,
1247
1247
  only_markers=False,
1248
- periodic=False):
1248
+ periodic=False,
1249
+ periodic_mode=None):
1249
1250
 
1250
1251
  if only_markers:
1251
1252
  raise NotImplementedError('only_markers not supported anymore')
@@ -1264,13 +1265,19 @@ def _compute_chromatic_functions(line, init, delta_chrom, steps_r_matrix,
1264
1265
  particle_on_co=on_momentum_twiss_res.particle_on_co.copy(),
1265
1266
  nemitt_x=nemitt_x, nemitt_y=nemitt_y,
1266
1267
  W_matrix=tw_init_chrom.W_matrix)
1267
- part_chrom = line.find_closed_orbit(delta0=dd, co_guess=part_guess,
1268
+ if periodic_mode == 'periodic_symmetric':
1269
+ part_chrom = part_guess.copy() # Finding closed orbit does not make sense in this case
1270
+ else:
1271
+ part_chrom = line.find_closed_orbit(delta0=dd, co_guess=part_guess,
1268
1272
  start=start, end=end, num_turns=num_turns)
1269
1273
  tw_init_chrom.particle_on_co = part_chrom
1270
1274
  RR_chrom = line.compute_one_turn_matrix_finite_differences(
1271
1275
  particle_on_co=tw_init_chrom.particle_on_co.copy(),
1272
1276
  start=start, end=end, num_turns=num_turns,
1273
1277
  steps_r_matrix=steps_r_matrix)['R_matrix']
1278
+ if periodic_mode == 'periodic_symmetric':
1279
+ RR_chrom = _compute_R_periodic_symmetric(RR_chrom)
1280
+
1274
1281
  (WW_chrom, _, _, _) = lnf.compute_linear_normal_form(RR_chrom,
1275
1282
  only_4d_block=method=='4d',
1276
1283
  responsiveness_tol=matrix_responsiveness_tol,
@@ -1742,12 +1749,16 @@ def _find_periodic_solution(line, particle_on_co, particle_ref, method,
1742
1749
  num_turns_search_t_rev=1,
1743
1750
  compute_R_element_by_element=False,
1744
1751
  only_markers=False,
1745
- only_orbit=False):
1752
+ only_orbit=False,
1753
+ periodic_mode='periodic'):
1746
1754
 
1747
1755
  eigenvalues = None
1748
1756
  Rot = None
1749
1757
  RR_ebe = None
1750
1758
 
1759
+ assert periodic_mode in ['periodic', 'periodic_symmetric']
1760
+
1761
+
1751
1762
  if start is not None or end is not None:
1752
1763
  assert start is not None and end is not None, (
1753
1764
  'start and end must be both None or both not None')
@@ -1758,6 +1769,11 @@ def _find_periodic_solution(line, particle_on_co, particle_ref, method,
1758
1769
  if method == '4d' and delta0 is None:
1759
1770
  delta0 = 0
1760
1771
 
1772
+ if periodic_mode == 'periodic_symmetric':
1773
+ assert R_matrix is None, 'R_matrix must be None for `periodic_symmetric`'
1774
+ assert W_matrix is None, 'W_matrix must be None for `periodic_symmetric`'
1775
+ assert delta0 == 0, 'delta0 must be 0 for `periodic_symmetric`'
1776
+
1761
1777
  if particle_on_co is not None:
1762
1778
  part_on_co = particle_on_co
1763
1779
  else:
@@ -1780,6 +1796,15 @@ def _find_periodic_solution(line, particle_on_co, particle_ref, method,
1780
1796
  if only_orbit:
1781
1797
  W_matrix = np.eye(6)
1782
1798
 
1799
+ if periodic_mode == 'periodic_symmetric':
1800
+ assert np.allclose(part_on_co.x[0], 0, atol=1e-12, rtol=0)
1801
+ assert np.allclose(part_on_co.px[0], 0, atol=1e-12, rtol=0)
1802
+ assert np.allclose(part_on_co.y[0], 0, atol=1e-12, rtol=0)
1803
+ assert np.allclose(part_on_co.py[0], 0, atol=1e-12, rtol=0)
1804
+ assert np.allclose(part_on_co.delta[0], 0, atol=1e-12, rtol=0)
1805
+ assert np.allclose(part_on_co.zeta[0], 0, atol=1e-12, rtol=0)
1806
+
1807
+
1783
1808
  if W_matrix is not None:
1784
1809
  W = W_matrix
1785
1810
  RR = None
@@ -1807,6 +1832,10 @@ def _find_periodic_solution(line, particle_on_co, particle_ref, method,
1807
1832
  )
1808
1833
  RR = RR_out['R_matrix']
1809
1834
  RR_ebe = RR_out['R_matrix_ebe']
1835
+
1836
+ if periodic_mode == 'periodic_symmetric':
1837
+ RR = _compute_R_periodic_symmetric(RR)
1838
+
1810
1839
  if matrix_responsiveness_tol is not None:
1811
1840
  lnf._assert_matrix_responsiveness(RR,
1812
1841
  matrix_responsiveness_tol, only_4d=(method == '4d'))
@@ -3062,7 +3091,7 @@ class TwissTable(Table):
3062
3091
 
3063
3092
  return R_matrix
3064
3093
 
3065
- def get_normalized_coordinates(self, particles, nemitt_x=None, nemitt_y=None,
3094
+ def get_normalized_coordinates(self, particles, nemitt_x=None, nemitt_y=None,
3066
3095
  nemitt_zeta=None, _force_at_element=None):
3067
3096
 
3068
3097
  # TODO: check consistency of gamma0
@@ -3243,6 +3272,12 @@ class TwissTable(Table):
3243
3272
 
3244
3273
  ind_per_table = []
3245
3274
 
3275
+ def add_strengths(self, line=None):
3276
+ if line is None:
3277
+ line = self._action.line
3278
+ _add_strengths_to_twiss_res(self, line)
3279
+ return self
3280
+
3246
3281
  @classmethod
3247
3282
  def concatenate(cls, tables_to_concat):
3248
3283
 
@@ -3357,8 +3392,8 @@ class TwissTable(Table):
3357
3392
  yl='betx bety'
3358
3393
  yr='dx dy'
3359
3394
 
3360
- if 'length' not in self.keys():
3361
- lattice=False
3395
+ if lattice and 'length' not in self.keys():
3396
+ self.add_strengths()
3362
3397
 
3363
3398
  if mask is not None:
3364
3399
  if isinstance(mask,str):
@@ -3793,41 +3828,53 @@ def _reverse_strengths(out):
3793
3828
 
3794
3829
 
3795
3830
  def _W_phys2norm(x, px, y, py, zeta, pzeta, W_matrix, co_dict, nemitt_x=None, nemitt_y=None, nemitt_zeta=None):
3796
-
3797
-
3831
+
3798
3832
  # Compute geometric emittances if normalized emittances are provided
3799
- gemitt_x = np.ones(shape=np.shape(co_dict['beta0'])) if nemitt_x is None else (nemitt_x / co_dict['beta0'] / co_dict['gamma0'])
3800
- gemitt_y = np.ones(shape=np.shape(co_dict['beta0'])) if nemitt_y is None else (nemitt_y / co_dict['beta0'] / co_dict['gamma0'])
3801
- gemitt_zeta = np.ones(shape=np.shape(co_dict['beta0'])) if nemitt_zeta is None else (nemitt_zeta / co_dict['beta0'] / co_dict['gamma0'])
3833
+ gemitt_x = np.ones(shape=np.shape(co_dict['beta0'])) if nemitt_x is None else (
3834
+ nemitt_x / co_dict['beta0'] / co_dict['gamma0'])
3835
+ gemitt_y = np.ones(shape=np.shape(co_dict['beta0'])) if nemitt_y is None else (
3836
+ nemitt_y / co_dict['beta0'] / co_dict['gamma0'])
3837
+ gemitt_zeta = np.ones(shape=np.shape(co_dict['beta0'])) if nemitt_zeta is None else (
3838
+ nemitt_zeta / co_dict['beta0'] / co_dict['gamma0'])
3802
3839
 
3803
-
3804
3840
  # Prepaing co arrray and gemitt array:
3805
- co = np.array([co_dict['x'], co_dict['px'], co_dict['y'], co_dict['py'], co_dict['zeta'], co_dict['ptau'] / co_dict['beta0']])
3806
- gemitt_values = np.array([gemitt_x, gemitt_x, gemitt_y, gemitt_y, gemitt_zeta, gemitt_zeta])
3841
+ co = np.array([co_dict['x'], co_dict['px'], co_dict['y'], co_dict['py'],
3842
+ co_dict['zeta'], co_dict['ptau'] / co_dict['beta0']])
3843
+ gemitt_values = np.array(
3844
+ [gemitt_x, gemitt_x, gemitt_y, gemitt_y, gemitt_zeta, gemitt_zeta])
3807
3845
 
3808
3846
  # Ensuring consistent dimensions
3809
- for add_axis in range(-1,len(np.shape(x))-len(np.shape(co))):
3810
- co = co[:,np.newaxis]
3811
- for add_axis in range(-1,len(np.shape(x))-len(np.shape(gemitt_values))):
3812
- gemitt_values = gemitt_values[:,np.newaxis]
3847
+ for add_axis in range(-1, len(np.shape(x))-len(np.shape(co))):
3848
+ co = co[:, np.newaxis]
3849
+ for add_axis in range(-1, len(np.shape(x))-len(np.shape(gemitt_values))):
3850
+ gemitt_values = gemitt_values[:, np.newaxis]
3813
3851
 
3814
-
3815
3852
  # substracting closed orbit
3816
3853
  XX = np.array([x, px, y, py, zeta, pzeta])
3817
3854
  XX -= co
3818
-
3819
3855
 
3820
3856
  # Apply the inverse transformation matrix
3821
3857
  W_inv = np.linalg.inv(W_matrix)
3822
-
3858
+
3823
3859
  if len(np.shape(XX)) == 3:
3824
- XX_norm = np.dot(W_inv, XX.reshape(6,x.shape[0]*x.shape[1]))
3860
+ XX_norm = np.dot(W_inv, XX.reshape(6, x.shape[0]*x.shape[1]))
3825
3861
  XX_norm = XX_norm.reshape(6, x.shape[0], x.shape[1])
3826
- else:
3862
+ else:
3827
3863
  XX_norm = np.dot(W_inv, XX)
3828
-
3864
+
3829
3865
  # Normalize the coordinates with the geometric emittances
3830
3866
  XX_norm /= np.sqrt(gemitt_values)
3831
-
3832
3867
 
3833
3868
  return XX_norm
3869
+
3870
+ def _add_strengths_to_twiss_res(twiss_res, line):
3871
+ tt = line.get_table(attr=True).rows[list(twiss_res.name)]
3872
+ for kk in (NORMAL_STRENGTHS_FROM_ATTR + SKEW_STRENGTHS_FROM_ATTR
3873
+ + OTHER_FIELDS_FROM_ATTR + OTHER_FIELDS_FROM_TABLE):
3874
+ twiss_res._col_names.append(kk)
3875
+ twiss_res._data[kk] = tt[kk].copy()
3876
+
3877
+ def _compute_R_periodic_symmetric(RR):
3878
+ inv_momenta = np.diag([1., -1., 1., -1., 1., 1.])
3879
+ RR_symm = inv_momenta @ np.linalg.inv(RR) @ inv_momenta @ RR
3880
+ return RR_symm
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtrack
3
- Version: 0.65.5
3
+ Version: 0.66.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
@@ -59,6 +59,7 @@ tests/test_multiline.py
59
59
  tests/test_multisetter.py
60
60
  tests/test_multispecies.py
61
61
  tests/test_particles_api.py
62
+ tests/test_periodic_symmetric_twiss_and_match.py
62
63
  tests/test_pipeline.py
63
64
  tests/test_prebuild_kernels.py
64
65
  tests/test_ps_against_ptc.py
@@ -1 +0,0 @@
1
- __version__ = '0.65.5'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes