xtrack 0.62.0__tar.gz → 0.63.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. {xtrack-0.62.0/xtrack.egg-info → xtrack-0.63.0}/PKG-INFO +1 -1
  2. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_line.py +30 -1
  3. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_tracker.py +11 -7
  4. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_twiss.py +113 -12
  5. xtrack-0.63.0/xtrack/_version.py +1 -0
  6. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/line.py +38 -2
  7. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/twiss.py +95 -30
  8. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/twissplot.py +15 -0
  9. {xtrack-0.62.0 → xtrack-0.63.0/xtrack.egg-info}/PKG-INFO +1 -1
  10. xtrack-0.62.0/xtrack/_version.py +0 -1
  11. {xtrack-0.62.0 → xtrack-0.63.0}/LICENSE +0 -0
  12. {xtrack-0.62.0 → xtrack-0.63.0}/MANIFEST.in +0 -0
  13. {xtrack-0.62.0 → xtrack-0.63.0}/README.md +0 -0
  14. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/__init__.py +0 -0
  15. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/base_classes.py +0 -0
  16. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/BB6D.py +0 -0
  17. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  18. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/__init__.py +0 -0
  19. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/beambeam.py +0 -0
  20. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/boost.py +0 -0
  21. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  22. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  23. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/qgauss.py +0 -0
  24. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/slicing.py +0 -0
  25. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
  26. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/elements.py +0 -0
  27. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/line.py +0 -0
  28. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/mathlibs.py +0 -0
  29. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/particles.py +0 -0
  30. {xtrack-0.62.0 → xtrack-0.63.0}/ducktrack/temp_pyparticles.py +0 -0
  31. {xtrack-0.62.0 → xtrack-0.63.0}/pyproject.toml +0 -0
  32. {xtrack-0.62.0 → xtrack-0.63.0}/setup.cfg +0 -0
  33. {xtrack-0.62.0 → xtrack-0.63.0}/setup.py +0 -0
  34. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_acceleration.py +0 -0
  35. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_amplitude_detuning.py +0 -0
  36. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  37. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_apertures.py +0 -0
  38. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_attr_replicas_and_slices.py +0 -0
  39. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_cavity_absolute_time.py +0 -0
  40. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
  41. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_coasting.py +0 -0
  42. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_collective_tracker.py +0 -0
  43. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_collimation.py +0 -0
  44. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_element_characterization_functions.py +0 -0
  45. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_element_internal_record.py +0 -0
  46. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_elements.py +0 -0
  47. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_elements_classflags.py +0 -0
  48. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_elements_thick.py +0 -0
  49. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  50. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  51. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_footprint.py +0 -0
  52. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_freeze_longitudinal.py +0 -0
  53. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_full_rings.py +0 -0
  54. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_hvkick.py +0 -0
  55. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_ions.py +0 -0
  56. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_lhc_match_phase_15.py +0 -0
  57. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_lumi.py +0 -0
  58. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_mad_writer.py +0 -0
  59. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_madloader.py +0 -0
  60. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_and_track_from_element.py +0 -0
  61. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_coupling_knob.py +0 -0
  62. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_nested.py +0 -0
  63. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_optics_and_ip_knob.py +0 -0
  64. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  65. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_orbit_bump.py +0 -0
  66. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_match_tune_chroma_cminus.py +0 -0
  67. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_monitor.py +0 -0
  68. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_multiline.py +0 -0
  69. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_multisetter.py +0 -0
  70. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_multispecies.py +0 -0
  71. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_particles_api.py +0 -0
  72. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_pipeline.py +0 -0
  73. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_prebuild_kernels.py +0 -0
  74. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_ps_against_ptc.py +0 -0
  75. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_ps_multiturn_twiss.py +0 -0
  76. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_psb_chicane.py +0 -0
  77. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_pyht_interface.py +0 -0
  78. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_radial_steering.py +0 -0
  79. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_radiation.py +0 -0
  80. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
  81. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_random_gen.py +0 -0
  82. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_random_gen_exp.py +0 -0
  83. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_random_gen_gauss.py +0 -0
  84. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_random_gen_ruth.py +0 -0
  85. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_rf_track.py +0 -0
  86. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_rotation_signs.py +0 -0
  87. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_second_order_taylor_map.py +0 -0
  88. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_slice_and_insert_with_replicas.py +0 -0
  89. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_slice_elements.py +0 -0
  90. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_slicing.py +0 -0
  91. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  92. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_spacecharge_in_ring.py +0 -0
  93. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_sps_thick.py +0 -0
  94. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_survey.py +0 -0
  95. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_tapering.py +0 -0
  96. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_thick_lhc.py +0 -0
  97. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_tilt_shifts.py +0 -0
  98. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_trajectory_correcton.py +0 -0
  99. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_twiss_vs_madx_psb.py +0 -0
  100. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_var_cache.py +0 -0
  101. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_vs_madx.py +0 -0
  102. {xtrack-0.62.0 → xtrack-0.63.0}/tests/test_xmask_orbit_correction.py +0 -0
  103. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/__init__.py +0 -0
  104. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/__init__.py +0 -0
  105. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  106. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  107. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  108. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
  109. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  110. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  111. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  112. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/base_element.py +0 -0
  113. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/__init__.py +0 -0
  114. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures.py +0 -0
  115. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  116. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  117. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  118. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  119. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  120. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  121. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/beam_interaction.py +0 -0
  122. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements.py +0 -0
  123. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
  124. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  125. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  126. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
  127. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
  128. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  129. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  130. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  131. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  132. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  133. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
  134. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  135. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  136. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/fringe.h +0 -0
  137. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/fringe_track.h +0 -0
  138. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
  139. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  140. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  141. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  142. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  143. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  144. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  145. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  146. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  147. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  148. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  149. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
  150. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  151. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  152. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  153. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  154. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  155. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  156. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  157. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  158. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  159. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  160. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  161. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  162. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  163. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  164. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  165. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  166. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  167. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  168. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  169. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  170. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  171. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  172. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  173. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  174. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  175. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  176. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/wedge_track.h +0 -0
  177. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
  178. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  179. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  180. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  181. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  182. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/exciter.py +0 -0
  183. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/rft_element.py +0 -0
  184. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/slice_elements.py +0 -0
  185. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  186. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/footprint.py +0 -0
  187. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/general.py +0 -0
  188. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/headers/atomicadd.h +0 -0
  189. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/headers/checks.h +0 -0
  190. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/headers/constants.h +0 -0
  191. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/headers/particle_states.h +0 -0
  192. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/headers/synrad_spectrum.h +0 -0
  193. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/internal_record.py +0 -0
  194. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/linear_normal_form.py +0 -0
  195. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/loss_location_refinement/__init__.py +0 -0
  196. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  197. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/lumi.py +0 -0
  198. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/mad_loader.py +0 -0
  199. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/mad_writer.py +0 -0
  200. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/match.py +0 -0
  201. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/__init__.py +0 -0
  202. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/beam_position_monitor.h +0 -0
  203. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/beam_position_monitor.py +0 -0
  204. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
  205. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
  206. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/beam_size_monitor.h +0 -0
  207. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/beam_size_monitor.py +0 -0
  208. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/last_turns_monitor.h +0 -0
  209. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/last_turns_monitor.py +0 -0
  210. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/particles_monitor.h +0 -0
  211. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/monitors/particles_monitor.py +0 -0
  212. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/multiline/__init__.py +0 -0
  213. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/multiline/multiline.py +0 -0
  214. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/multiline/shared_knobs.py +0 -0
  215. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/multisetter/__init__.py +0 -0
  216. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/multisetter/multisetter.py +0 -0
  217. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/particles/__init__.py +0 -0
  218. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/particles/constants.py +0 -0
  219. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/particles/particles.py +0 -0
  220. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/particles/rng_src/base_rng.h +0 -0
  221. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
  222. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/pipeline/__init__.py +0 -0
  223. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/pipeline/core.py +0 -0
  224. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/pipeline/manager.py +0 -0
  225. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/pipeline/multitracker.py +0 -0
  226. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/progress_indicator.py +0 -0
  227. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/__init__.py +0 -0
  228. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/random_generators.py +0 -0
  229. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/random_src/exponential.h +0 -0
  230. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  231. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/random_src/normal.h +0 -0
  232. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/random_src/rutherford.h +0 -0
  233. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/random/random_src/uniform.h +0 -0
  234. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/slicing.py +0 -0
  235. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/survey.py +0 -0
  236. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/synctime.py +0 -0
  237. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/tapering.py +0 -0
  238. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/targets.py +0 -0
  239. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/tracker.py +0 -0
  240. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/tracker_data.py +0 -0
  241. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/tracker_src/tracker.h +0 -0
  242. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack/trajectory_correction.py +0 -0
  243. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack.egg-info/SOURCES.txt +0 -0
  244. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack.egg-info/dependency_links.txt +0 -0
  245. {xtrack-0.62.0 → xtrack-0.63.0}/xtrack.egg-info/requires.txt +0 -0
  246. {xtrack-0.62.0 → xtrack-0.63.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.62.0
3
+ Version: 0.63.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
@@ -1031,4 +1031,33 @@ def test_multiple_thick_elements():
1031
1031
 
1032
1032
  assert np.all(tt.element_type == ['Drift', 'Drift', 'DriftSlice', 'Sextupole', 'DriftSlice', 'Drift',
1033
1033
  'DriftSlice', 'Sextupole', 'DriftSlice', 'Sextupole', 'Drift',
1034
- 'Drift', ''])
1034
+ 'Drift', ''])
1035
+
1036
+ @for_all_test_contexts
1037
+ def test_get_strengths(test_context):
1038
+ collider = xt.Multiline.from_json(
1039
+ test_data_folder / 'hllhc15_thick/hllhc15_collider_thick.json')
1040
+ collider.build_trackers(_context=test_context)
1041
+
1042
+ collider.lhcb1.twiss_default['method'] = '4d'
1043
+ collider.lhcb2.twiss_default['method'] = '4d'
1044
+ collider.lhcb2.twiss_default['reverse'] = True
1045
+
1046
+ line = collider.lhcb2 # <- use lhcb2 to test the reverse option
1047
+
1048
+ import xobjects as xo
1049
+ str_table_rev = line.get_strengths() # Takes reverse from twiss_default
1050
+ xo.assert_allclose(line['mbw.a6l3.b2'].k0,
1051
+ -str_table_rev['k0l', 'mbw.a6l3.b2'] / str_table_rev['length', 'mbw.a6l3.b2'],
1052
+ rtol=0, atol=1e-14)
1053
+ xo.assert_allclose(line['mbw.a6l3.b2'].h,
1054
+ -str_table_rev['angle_rad', 'mbw.a6l3.b2'] / str_table_rev['length', 'mbw.a6l3.b2'],
1055
+ rtol=0, atol=1e-14)
1056
+
1057
+ str_table = line.get_strengths(reverse=False) # Takes reverse from twiss_default
1058
+ xo.assert_allclose(line['mbw.a6l3.b2'].k0,
1059
+ str_table['k0l', 'mbw.a6l3.b2'] / str_table['length', 'mbw.a6l3.b2'],
1060
+ rtol=0, atol=1e-14)
1061
+ xo.assert_allclose(line['mbw.a6l3.b2'].h,
1062
+ str_table['angle_rad', 'mbw.a6l3.b2'] / str_table['length', 'mbw.a6l3.b2'],
1063
+ rtol=0, atol=1e-14)
@@ -79,8 +79,13 @@ def test_cycle(test_context):
79
79
  line.build_tracker(_context=test_context)
80
80
  line.particle_ref = particle_ref
81
81
 
82
- cline_name = line.cycle(name_first_element='e2')
83
- cline_index = line.cycle(index_first_element=2)
82
+ cline_name = line.copy()
83
+ cline_index = line.copy()
84
+ cline_name.build_tracker(_context=test_context)
85
+ cline_index.build_tracker(_context=test_context)
86
+
87
+ cline_name.cycle(name_first_element='e2')
88
+ cline_index.cycle(index_first_element=2)
84
89
 
85
90
  assert cline_name.tracker is not None
86
91
  assert cline_index.tracker is not None
@@ -91,15 +96,14 @@ def test_cycle(test_context):
91
96
  assert cline.element_names[2] == 'e0'
92
97
  assert cline.element_names[3] == 'e1'
93
98
 
94
- assert cline.elements[0] is d1
95
- assert cline.elements[1] is r0
96
- assert cline.elements[2] is d0
97
- assert cline.elements[3] is c0
99
+ assert isinstance(cline.elements[0], xt.Drift)
100
+ assert isinstance(cline.elements[1], xt.SRotation)
101
+ assert isinstance(cline.elements[2], xt.Drift)
102
+ assert isinstance(cline.elements[3], xt.Cavity)
98
103
 
99
104
  assert cline.particle_ref.mass0 == xp.PROTON_MASS_EV
100
105
  assert cline.particle_ref.gamma0 == 1.05
101
106
 
102
-
103
107
  @for_all_test_contexts
104
108
  def test_synrad_configuration(test_context):
105
109
  for collective in [False, True]:
@@ -1079,7 +1079,7 @@ def test_custom_twiss_init(test_context):
1079
1079
  'hllhc15_noerrors_nobb/line_w_knobs_and_particle.json')
1080
1080
  line.particle_ref = xp.Particles(
1081
1081
  mass0=xp.PROTON_MASS_EV, q0=1, energy0=7e12)
1082
- line.build_tracker()
1082
+ line.build_tracker(_context=test_context)
1083
1083
  line.vars['on_disp'] = 1
1084
1084
 
1085
1085
  tw = line.twiss()
@@ -1676,14 +1676,13 @@ def test_twiss_strength_reverse_vs_madx(test_context):
1676
1676
 
1677
1677
  @for_all_test_contexts
1678
1678
  @pytest.mark.parametrize('line_name', ['lhcb1'])
1679
- @pytest.mark.parametrize('reverse', [False, True])
1680
1679
  @pytest.mark.parametrize('section', [
1681
1680
  (xt.START, xt.END),
1682
1681
  (xt.START, '_end_point'),
1683
1682
  (xt.START, 'ip6'),
1684
1683
  ('ip4', xt.END),
1685
1684
  ])
1686
- def test_twiss_range_start_end(test_context, line_name, reverse, section, collider_for_test_twiss_range):
1685
+ def test_twiss_range_start_end(test_context, line_name, section, collider_for_test_twiss_range):
1687
1686
  collider = collider_for_test_twiss_range
1688
1687
  init_at = 'ip5'
1689
1688
 
@@ -1709,18 +1708,14 @@ def test_twiss_range_start_end(test_context, line_name, reverse, section, collid
1709
1708
 
1710
1709
  line.build_tracker(_buffer=buffer)
1711
1710
 
1712
- tw = line.twiss()
1711
+ reverse = {'lhcb1': False, 'lhcb2':True}[line_name]
1712
+
1713
+ tw = line.twiss(reverse=reverse)
1713
1714
  tw_init = tw.get_twiss_init(init_at)
1714
1715
 
1715
1716
  start = section[0]
1716
1717
  end = section[1]
1717
- if not reverse:
1718
- tw_test = line.twiss(start=start, end=end, init=tw_init, reverse=reverse)
1719
- else:
1720
- with pytest.raises(ValueError) as excinfo:
1721
- line.twiss(start=start, end=end, init=tw_init, reverse=reverse)
1722
- assert 'reverse' in str(excinfo.value)
1723
- return
1718
+ tw_test = line.twiss(start=start, end=end, init=tw_init, reverse=reverse)
1724
1719
 
1725
1720
  start_el = (line.element_names[0] if start == xt.START else start)
1726
1721
  end_el = (line.element_names[-1] if (end == xt.END or end == '_end_point') else end)
@@ -1734,4 +1729,110 @@ def test_twiss_range_start_end(test_context, line_name, reverse, section, collid
1734
1729
  assert np.all(tw_test._data[kk] == tw_ref._data[kk])
1735
1730
  continue
1736
1731
 
1737
- xo.assert_allclose(tw_test._data[kk], tw_ref._data[kk], rtol=0, atol=5e-13)
1732
+ xo.assert_allclose(tw_test._data[kk], tw_ref._data[kk], rtol=1e-12, atol=5e-13)
1733
+
1734
+ @for_all_test_contexts
1735
+ def test_arbitrary_start(test_context, collider_for_test_twiss_range):
1736
+
1737
+ collider = collider_for_test_twiss_range
1738
+
1739
+ # No orbit
1740
+ for kk in collider.vars.get_table().rows['on_.*'].name:
1741
+ collider.vars[kk] = 0
1742
+
1743
+ if collider.lhcb1.element_names[0] != 'ip1':
1744
+ collider.lhcb1.cycle('ip1', inplace=True)
1745
+ if collider.lhcb2.element_names[0] != 'ip1':
1746
+ collider.lhcb2.cycle('ip1', inplace=True)
1747
+
1748
+ line = collider.lhcb2 # <- use lhcb2 to test the reverse option
1749
+ assert line.twiss_default['method'] == '4d'
1750
+ assert line.twiss_default['reverse']
1751
+
1752
+ if isinstance(test_context, xo.ContextCpu) and (
1753
+ test_context.omp_num_threads != line._context.omp_num_threads):
1754
+ buffer = test_context.new_buffer()
1755
+ elif isinstance(test_context, line._context.__class__):
1756
+ buffer = line._buffer
1757
+ else:
1758
+ buffer = test_context.new_buffer()
1759
+
1760
+ line.build_tracker(_buffer=buffer)
1761
+
1762
+ tw8_closed = line.twiss(start='ip8')
1763
+ tw8_open = line.twiss(start='ip8', betx=1.5, bety=1.5)
1764
+
1765
+ tw = line.twiss()
1766
+
1767
+ for tw8 in [tw8_closed, tw8_open]:
1768
+ assert tw8.name[-1] == '_end_point'
1769
+ assert np.all(tw8.rows['ip.?'].name
1770
+ == np.array(['ip8', 'ip1', 'ip2', 'ip3', 'ip4', 'ip5', 'ip6', 'ip7']))
1771
+
1772
+ for nn in ['s', 'mux', 'muy']:
1773
+ assert np.all(np.diff(tw8.rows['ip.?'][nn]) > 0)
1774
+ assert tw8[nn][0] == 0
1775
+ xo.assert_allclose(tw8[nn][-1], tw[nn][-1], rtol=1e-12, atol=5e-7)
1776
+
1777
+ xo.assert_allclose(
1778
+ tw8['betx', ['ip8', 'ip1', 'ip2', 'ip3', 'ip4', 'ip5', 'ip6', 'ip7']],
1779
+ tw[ 'betx', ['ip8', 'ip1', 'ip2', 'ip3', 'ip4', 'ip5', 'ip6', 'ip7']],
1780
+ rtol=1e-5, atol=0)
1781
+
1782
+ collider.to_json('ok.json')
1783
+
1784
+ @for_all_test_contexts
1785
+ def test_part_from_full_periodic(test_context, collider_for_test_twiss_range):
1786
+
1787
+ collider = collider_for_test_twiss_range
1788
+
1789
+ if collider.lhcb1.element_names[0] != 'ip1':
1790
+ collider.lhcb1.cycle('ip1', inplace=True)
1791
+ if collider.lhcb2.element_names[0] != 'ip1':
1792
+ collider.lhcb2.cycle('ip1', inplace=True)
1793
+
1794
+ line = collider.lhcb2 # <- use lhcb2 to test the reverse option
1795
+ assert line.twiss_default['method'] == '4d'
1796
+ assert line.twiss_default['reverse']
1797
+
1798
+ if isinstance(test_context, xo.ContextCpu) and (
1799
+ test_context.omp_num_threads != line._context.omp_num_threads):
1800
+ buffer = test_context.new_buffer()
1801
+ elif isinstance(test_context, line._context.__class__):
1802
+ buffer = line._buffer
1803
+ else:
1804
+ buffer = test_context.new_buffer()
1805
+
1806
+ line.build_tracker(_buffer=buffer)
1807
+
1808
+ tw = line.twiss()
1809
+
1810
+ tw_part1 = line.twiss(start='ip8', end='ip2', zero_at='ip1', init='full_periodic')
1811
+
1812
+ assert tw_part1.name[0] == 'ip8'
1813
+ assert tw_part1.name[-2] == 'ip2'
1814
+ assert tw_part1.name[-1] == '_end_point'
1815
+
1816
+ for kk in ['s', 'mux', 'muy']:
1817
+ tw_part1[kk, 'ip1'] == 0.
1818
+ assert np.all(np.diff(tw_part1[kk]) >= 0)
1819
+ xo.assert_allclose(
1820
+ tw_part1[kk, 'ip8'], -(tw[kk, '_end_point'] - tw[kk, 'ip8']),
1821
+ rtol=1e-12, atol=5e-7)
1822
+ xo.assert_allclose(
1823
+ tw_part1[kk, 'ip2'], tw[kk, 'ip2'] - tw[kk, 0],
1824
+ rtol=1e-12, atol=5e-7)
1825
+
1826
+ tw_part2 = line.twiss(start='ip8', end='ip2', init='full_periodic')
1827
+
1828
+ assert tw_part2.name[0] == 'ip8'
1829
+ assert tw_part2.name[-2] == 'ip2'
1830
+ assert tw_part2.name[-1] == '_end_point'
1831
+
1832
+ for kk in ['s', 'mux', 'muy']:
1833
+ tw_part2[kk, 'ip8'] == 0.
1834
+ assert np.all(np.diff(tw_part2[kk]) >= 0)
1835
+ xo.assert_allclose(
1836
+ tw_part2[kk, 'ip2'],
1837
+ tw[kk, 'ip2'] - tw[kk, 0] +(tw[kk, '_end_point'] - tw[kk, 'ip8']),
1838
+ rtol=1e-12, atol=5e-7)
@@ -0,0 +1 @@
1
+ __version__ = '0.63.0'
@@ -723,6 +723,35 @@ class Line:
723
723
 
724
724
  return xd.Table(data=data)
725
725
 
726
+ def get_strengths(self, reverse=None):
727
+
728
+ if reverse is None:
729
+ reverse = self.twiss_default.get('reverse', False)
730
+
731
+ out = {}
732
+ out['name'] = np.array(list(self.element_names) + ['_end_point'])
733
+ for kk in (xt.twiss.NORMAL_STRENGTHS_FROM_ATTR
734
+ + xt.twiss.SKEW_STRENGTHS_FROM_ATTR
735
+ + xt.twiss.OTHER_FIELDS_FROM_ATTR):
736
+ this_attr = self.attr[kk]
737
+ if hasattr(this_attr, 'get'):
738
+ this_attr = this_attr.get() # bring to cpu
739
+ # Add zero at the end (there is _end_point)
740
+ out[kk] = np.concatenate((this_attr, [this_attr[-1]*0]))
741
+
742
+ if reverse:
743
+ for kk in out:
744
+ # Change order
745
+ out[kk][:-1] = out[kk][:-1][::-1]
746
+
747
+ tab = xt.Table(out)
748
+ if reverse:
749
+ xt.twiss._reverse_strengths(tab) # Change signs
750
+
751
+ tab._data['reference_frame'] = {
752
+ True: 'reverse', False: 'proper'}[reverse]
753
+ return tab
754
+
726
755
  def copy(self, _context=None, _buffer=None):
727
756
  '''
728
757
  Return a copy of the line.
@@ -1134,6 +1163,7 @@ class Line:
1134
1163
  mux=None, muy=None, muzeta=None,
1135
1164
  ax_chrom=None, bx_chrom=None, ay_chrom=None, by_chrom=None,
1136
1165
  ddx=None, ddpx=None, ddy=None, ddpy=None,
1166
+ zero_at=None,
1137
1167
  co_search_at=None,
1138
1168
  _continue_if_lost=None,
1139
1169
  _keep_tracking_data=None,
@@ -1330,7 +1360,7 @@ class Line:
1330
1360
 
1331
1361
 
1332
1362
  def survey(self,X0=0,Y0=0,Z0=0,theta0=0, phi0=0, psi0=0,
1333
- element0=0, reverse=False):
1363
+ element0=0, reverse=None):
1334
1364
 
1335
1365
  """
1336
1366
  Returns a survey of the beamline (based on MAD-X survey command).
@@ -1358,6 +1388,9 @@ class Line:
1358
1388
  Survey table.
1359
1389
  """
1360
1390
 
1391
+ if reverse is None:
1392
+ reverse = self.twiss_default.get('reverse', False)
1393
+
1361
1394
  return survey_from_line(self, X0=X0, Y0=Y0, Z0=Z0, theta0=theta0,
1362
1395
  phi0=phi0, psi0=psi0, element0=element0,
1363
1396
  reverse=reverse)
@@ -2183,7 +2216,7 @@ class Line:
2183
2216
  return new_line
2184
2217
 
2185
2218
  def cycle(self, index_first_element=None, name_first_element=None,
2186
- inplace=False):
2219
+ inplace=True):
2187
2220
 
2188
2221
  """
2189
2222
  Cycle the line to start from a given element.
@@ -2204,6 +2237,9 @@ class Line:
2204
2237
 
2205
2238
  """
2206
2239
 
2240
+ if not inplace:
2241
+ raise ValueError('`inplace=False` is not anymore supported')
2242
+
2207
2243
  if ((index_first_element is not None and name_first_element is not None)
2208
2244
  or (index_first_element is None and name_first_element is None)):
2209
2245
  raise ValueError(
@@ -47,9 +47,12 @@ VARS_FOR_TWISS_INIT_GENERATION = [
47
47
  'ddx', 'ddpx', 'ddy', 'ddpy',
48
48
  ]
49
49
 
50
+ CYCLICAL_QUANTITIES = ['mux', 'muy', 'dzeta', 's']
51
+
50
52
  NORMAL_STRENGTHS_FROM_ATTR=['k0l', 'k1l', 'k2l', 'k3l', 'k4l', 'k5l']
51
53
  SKEW_STRENGTHS_FROM_ATTR=['k0sl', 'k1sl', 'k2sl', 'k3sl', 'k4sl', 'k5sl']
52
- OTHER_FIELDS_FROM_ATTR=['angle_rad', 'rot_s_rad', 'hkick', 'vkick', 'element_type', 'isthick', 'length', 'parent_name']
54
+ OTHER_FIELDS_FROM_ATTR=['angle_rad', 'rot_s_rad', 'hkick', 'vkick', 'ks', 'length']
55
+ OTHER_FIELDS_FROM_TABLE=['element_type', 'isthick', 'parent_name']
53
56
 
54
57
  log = logging.getLogger(__name__)
55
58
 
@@ -90,6 +93,7 @@ def twiss_line(line, particle_ref=None, method=None,
90
93
  mux=None, muy=None, muzeta=None,
91
94
  ax_chrom=None, bx_chrom=None, ay_chrom=None, by_chrom=None,
92
95
  ddx=None, ddpx=None, ddy=None, ddpy=None,
96
+ zero_at=None,
93
97
  co_search_at=None,
94
98
  _continue_if_lost=None,
95
99
  _keep_tracking_data=None,
@@ -329,29 +333,75 @@ def twiss_line(line, particle_ref=None, method=None,
329
333
  assert init is None
330
334
  assert reverse is False
331
335
 
336
+ if zero_at is not None:
337
+ kwargs = _updated_kwargs_from_locals(kwargs, locals().copy())
338
+ kwargs.pop('zero_at')
339
+ out = twiss_line(**kwargs)
340
+ out.zero_at(zero_at)
341
+ return _add_action_in_res(out, input_kwargs)
342
+
332
343
  if start is not None:
333
344
  if isinstance(start, xt.match._LOC):
345
+ assert start in [xt.START, xt.END]
334
346
  if reverse:
335
- raise ValueError('If reverse=True, `start` must be a name of'
336
- 'an element in the line.')
337
- if start is not xt.START:
338
- raise ValueError('The value of `start` must be an element name '
339
- 'or xt.START.')
340
- start = line.element_names[0]
347
+ start = {xt.START: xt.END, xt.END: xt.START}[start]
348
+ start = {xt.START: line.element_names[0],
349
+ xt.END: line.element_names[-1]}[start]
341
350
  assert isinstance(start, str) # index not supported anymore
342
351
 
343
352
  if end is not None:
344
353
  if isinstance(end, xt.match._LOC):
354
+ assert end in [xt.START, xt.END]
345
355
  if reverse:
346
- raise ValueError('If reverse=True, `end` must be a name of'
347
- 'an element in the line.')
348
- if end is not xt.END:
349
- raise ValueError('The value of `end` must be an element name '
350
- 'or xt.END.')
351
- end = line.element_names[-1]
356
+ end = {xt.START: xt.END, xt.END: xt.START}[end]
357
+ end = {xt.START: line.element_names[0],
358
+ xt.END: line.element_names[-1]}[end]
352
359
  assert isinstance(end, str) # index not supported anymore
353
360
 
354
- if (init is not None and init != 'periodic'
361
+ if start is not None and end is None:
362
+ # One turn twiss from start to start
363
+ kwargs = _updated_kwargs_from_locals(kwargs, locals().copy())
364
+ kwargs.pop('start')
365
+ if (init is None or init == 'periodic') and betx is None and bety is None:
366
+ # Periodic twiss
367
+ tw = twiss_line(**kwargs)
368
+ t1 = tw.rows[start:]
369
+ t2 = tw.rows[:start]
370
+ out = xt.TwissTable.concatenate([t1, t2])
371
+ out.zero_at(out.name[0])
372
+ out.name[-1] = '_end_point'
373
+ else:
374
+ kwargs.pop('end')
375
+ kwargs.pop('init')
376
+ t1o = twiss_line(start=start, end=xt.END, **kwargs)
377
+ init_part2 = t1o.get_twiss_init('_end_point')
378
+ # Dummy twiss to get the name at the start of the secon part
379
+ init_part2.element_name = line.twiss(
380
+ start=xt.START, end=xt.START, betx=1, bety=1).name[0]
381
+
382
+ for kk in VARS_FOR_TWISS_INIT_GENERATION:
383
+ kwargs.pop(kk, None)
384
+
385
+ t2o = twiss_line(start=xt.START, end=start, init=init_part2, **kwargs)
386
+ # remove repeated element
387
+ t2o = t2o.rows[:-1]
388
+ t2o.name[-1] = '_end_point'
389
+ out = xt.TwissTable.concatenate([t1o, t2o])
390
+ return _add_action_in_res(out, input_kwargs)
391
+
392
+ if init == 'full_periodic' and (start is not None or end is not None):
393
+ kwargs = _updated_kwargs_from_locals(kwargs, locals().copy())
394
+ kwargs.pop('init')
395
+ kwargs.pop('start')
396
+ kwargs.pop('end')
397
+ kwargs.pop('init_at')
398
+ tw = twiss_line(**kwargs) # Periodic twiss of the full line
399
+ init = tw.get_twiss_init(init_at or start)
400
+ out = twiss_line(start=start, end=end, init=init, **kwargs)
401
+ if zero_at is None:
402
+ out.zero_at(start)
403
+ return _add_action_in_res(out, input_kwargs)
404
+ elif (init is not None and init != 'periodic'
355
405
  or betx is not None or bety is not None):
356
406
  periodic = False
357
407
  else:
@@ -533,7 +583,7 @@ def twiss_line(line, particle_ref=None, method=None,
533
583
  if isinstance(init, str):
534
584
  if init in ['preserve', 'preserve_start', 'preserve_end']:
535
585
  raise ValueError(f'init={init} not anymore supported')
536
- assert init == 'periodic'
586
+ assert init == 'periodic' or 'full_periodic'
537
587
 
538
588
  if periodic:
539
589
 
@@ -706,7 +756,7 @@ def twiss_line(line, particle_ref=None, method=None,
706
756
  if strengths:
707
757
  tt = line.get_table(attr=True).rows[list(twiss_res.name)]
708
758
  for kk in (NORMAL_STRENGTHS_FROM_ATTR + SKEW_STRENGTHS_FROM_ATTR
709
- + OTHER_FIELDS_FROM_ATTR):
759
+ + OTHER_FIELDS_FROM_ATTR + OTHER_FIELDS_FROM_TABLE):
710
760
  twiss_res._col_names.append(kk)
711
761
  twiss_res._data[kk] = tt[kk].copy()
712
762
 
@@ -3052,7 +3102,9 @@ class TwissTable(Table):
3052
3102
  for kk in self._col_names:
3053
3103
  if (kk == 'name' or kk in NORMAL_STRENGTHS_FROM_ATTR
3054
3104
  or kk in SKEW_STRENGTHS_FROM_ATTR
3055
- or kk in OTHER_FIELDS_FROM_ATTR):
3105
+ or kk in OTHER_FIELDS_FROM_ATTR
3106
+ or kk in OTHER_FIELDS_FROM_TABLE
3107
+ ):
3056
3108
  new_data[kk][:-1] = new_data[kk][:-1][::-1]
3057
3109
  new_data[kk][-1] = self[kk][-1]
3058
3110
  elif kk == 'W_matrix':
@@ -3139,18 +3191,7 @@ class TwissTable(Table):
3139
3191
  out.qs = 0
3140
3192
  out.muzeta[:] = 0
3141
3193
 
3142
- # Same convention as in MAD-X for reversing strengths
3143
- for kk in NORMAL_STRENGTHS_FROM_ATTR:
3144
- if kk not in out._col_names:
3145
- continue
3146
- ii = int(kk.split('k')[-1].split('l')[0])
3147
- out[kk] *= (-1)**(ii+1)
3148
-
3149
- for kk in SKEW_STRENGTHS_FROM_ATTR:
3150
- if kk not in out._col_names:
3151
- continue
3152
- ii = int(kk.split('k')[-1].split('sl')[0])
3153
- out[kk] *= (-1)**ii
3194
+ _reverse_strengths(out)
3154
3195
 
3155
3196
  out._data['reference_frame'] = {
3156
3197
  'proper': 'reverse', 'reverse': 'proper'}[self.reference_frame]
@@ -3209,7 +3250,7 @@ class TwissTable(Table):
3209
3250
  continue
3210
3251
  new_data[kk][i_start:i_end] = (
3211
3252
  tt[kk][ind_per_table[ii][0]:ind_per_table[ii][1]])
3212
- if kk in ['mux', 'muy', 'dzeta', 's']:
3253
+ if kk in CYCLICAL_QUANTITIES:
3213
3254
  new_data[kk][i_start:i_end] -= new_data[kk][i_start]
3214
3255
  if ii > 0:
3215
3256
  new_data[kk][i_start:i_end] += new_data[kk][i_start-1]
@@ -3226,6 +3267,10 @@ class TwissTable(Table):
3226
3267
 
3227
3268
  return new_table
3228
3269
 
3270
+ def zero_at(self, name):
3271
+ for kk in CYCLICAL_QUANTITIES:
3272
+ self[kk] -= self[kk, name]
3273
+
3229
3274
  def target(self, tars=None, value=None, at=None, **kwargs):
3230
3275
  if value is None:
3231
3276
  value = self
@@ -3678,3 +3723,23 @@ def _find_closed_orbit_search_t_rev(line, num_turns_search_t_rev=None):
3678
3723
  delta=x_sol[5])
3679
3724
 
3680
3725
  return particle_on_co
3726
+
3727
+ def _reverse_strengths(out):
3728
+ # Same convention as in MAD-X for reversing strengths
3729
+ for kk in NORMAL_STRENGTHS_FROM_ATTR:
3730
+ if kk not in out._col_names:
3731
+ continue
3732
+ ii = int(kk.split('k')[-1].split('l')[0])
3733
+ out[kk] *= (-1)**(ii+1)
3734
+
3735
+ for kk in SKEW_STRENGTHS_FROM_ATTR:
3736
+ if kk not in out._col_names:
3737
+ continue
3738
+ ii = int(kk.split('k')[-1].split('sl')[0])
3739
+ out[kk] *= (-1)**ii
3740
+
3741
+ if 'vkick' in out._col_names:
3742
+ out['vkick'] *= -1
3743
+
3744
+ if 'angle_rad' in out._col_names:
3745
+ out['angle_rad'] *= -1
@@ -287,3 +287,18 @@ class TwissPlot(object):
287
287
  def savefig(self, name):
288
288
  self.figure.savefig(name)
289
289
  return self
290
+
291
+ def ylim(self,left_lo=None,left_hi=None,right_lo=None,right_hi=None):
292
+ lo,hi=self.left.get_ylim()
293
+ if left_lo is None:
294
+ left_lo = lo
295
+ if left_hi is None:
296
+ left_hi = hi
297
+ self.left.set_ylim(left_lo,left_hi)
298
+ lo,hi=self.right.get_ylim()
299
+ if right_lo is None:
300
+ right_lo = lo
301
+ if right_hi is None:
302
+ right_hi = hi
303
+ self.right.set_ylim(right_lo,right_hi)
304
+ return self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtrack
3
- Version: 0.62.0
3
+ Version: 0.63.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
@@ -1 +0,0 @@
1
- __version__ = '0.62.0'
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