xtrack 0.68.0__tar.gz → 0.69.1__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 (253) hide show
  1. {xtrack-0.68.0/xtrack.egg-info → xtrack-0.69.1}/PKG-INFO +1 -1
  2. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_environment.py +83 -30
  3. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_psb_chicane.py +0 -1
  4. xtrack-0.69.1/xtrack/_version.py +1 -0
  5. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/environment.py +7 -0
  6. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/line.py +30 -95
  7. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/tracker.py +4 -0
  8. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/twiss.py +42 -38
  9. {xtrack-0.68.0 → xtrack-0.69.1/xtrack.egg-info}/PKG-INFO +1 -1
  10. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack.egg-info/SOURCES.txt +0 -1
  11. xtrack-0.68.0/tests/test_var_cache.py +0 -209
  12. xtrack-0.68.0/xtrack/_version.py +0 -1
  13. {xtrack-0.68.0 → xtrack-0.69.1}/LICENSE +0 -0
  14. {xtrack-0.68.0 → xtrack-0.69.1}/MANIFEST.in +0 -0
  15. {xtrack-0.68.0 → xtrack-0.69.1}/README.md +0 -0
  16. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/__init__.py +0 -0
  17. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/base_classes.py +0 -0
  18. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/BB6D.py +0 -0
  19. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
  20. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/__init__.py +0 -0
  21. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/beambeam.py +0 -0
  22. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/boost.py +0 -0
  23. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
  24. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
  25. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/qgauss.py +0 -0
  26. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/slicing.py +0 -0
  27. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/be_beamfields/spacecharge.py +0 -0
  28. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/elements.py +0 -0
  29. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/line.py +0 -0
  30. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/mathlibs.py +0 -0
  31. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/particles.py +0 -0
  32. {xtrack-0.68.0 → xtrack-0.69.1}/ducktrack/temp_pyparticles.py +0 -0
  33. {xtrack-0.68.0 → xtrack-0.69.1}/pyproject.toml +0 -0
  34. {xtrack-0.68.0 → xtrack-0.69.1}/setup.cfg +0 -0
  35. {xtrack-0.68.0 → xtrack-0.69.1}/setup.py +0 -0
  36. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_acceleration.py +0 -0
  37. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_amplitude_detuning.py +0 -0
  38. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
  39. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_apertures.py +0 -0
  40. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_attr_replicas_and_slices.py +0 -0
  41. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_cavity_absolute_time.py +0 -0
  42. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_chromatic_functions_vs_madx.py +0 -0
  43. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_coasting.py +0 -0
  44. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_collective_tracker.py +0 -0
  45. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_collimation.py +0 -0
  46. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_element_characterization_functions.py +0 -0
  47. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_element_internal_record.py +0 -0
  48. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_elements.py +0 -0
  49. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_elements_classflags.py +0 -0
  50. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_elements_thick.py +0 -0
  51. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_fcc_ee_solenoid_correction.py +0 -0
  52. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
  53. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_footprint.py +0 -0
  54. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_freeze_longitudinal.py +0 -0
  55. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_full_rings.py +0 -0
  56. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_hvkick.py +0 -0
  57. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_ions.py +0 -0
  58. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_lhc_match_phase_15.py +0 -0
  59. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_line.py +0 -0
  60. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_lumi.py +0 -0
  61. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_mad_writer.py +0 -0
  62. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_madloader.py +0 -0
  63. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_and_track_from_element.py +0 -0
  64. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_coupling_knob.py +0 -0
  65. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_nested.py +0 -0
  66. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_optics_and_ip_knob.py +0 -0
  67. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
  68. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_orbit_bump.py +0 -0
  69. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_match_tune_chroma_cminus.py +0 -0
  70. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_monitor.py +0 -0
  71. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_multiline.py +0 -0
  72. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_multisetter.py +0 -0
  73. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_multispecies.py +0 -0
  74. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_particles_api.py +0 -0
  75. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_periodic_symmetric_twiss_and_match.py +0 -0
  76. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_pipeline.py +0 -0
  77. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_prebuild_kernels.py +0 -0
  78. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_ps_against_ptc.py +0 -0
  79. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_ps_multiturn_twiss.py +0 -0
  80. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_pyht_interface.py +0 -0
  81. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_radial_steering.py +0 -0
  82. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_radiation.py +0 -0
  83. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_radiation_equilibrium_emittances.py +0 -0
  84. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_random_gen.py +0 -0
  85. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_random_gen_exp.py +0 -0
  86. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_random_gen_gauss.py +0 -0
  87. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_random_gen_ruth.py +0 -0
  88. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_rf_track.py +0 -0
  89. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_rotation_signs.py +0 -0
  90. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_second_order_taylor_map.py +0 -0
  91. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_seeds.py +0 -0
  92. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_slice_and_insert_with_replicas.py +0 -0
  93. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_slice_elements.py +0 -0
  94. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_slicing.py +0 -0
  95. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
  96. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_spacecharge_in_ring.py +0 -0
  97. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_sps_thick.py +0 -0
  98. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_survey.py +0 -0
  99. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_tapering.py +0 -0
  100. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_thick_lhc.py +0 -0
  101. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_tilt_shifts.py +0 -0
  102. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_tracker.py +0 -0
  103. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_trajectory_correcton.py +0 -0
  104. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_twiss.py +0 -0
  105. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_twiss_vs_madx_psb.py +0 -0
  106. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_vs_madx.py +0 -0
  107. {xtrack-0.68.0 → xtrack-0.69.1}/tests/test_xmask_orbit_correction.py +0 -0
  108. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/__init__.py +0 -0
  109. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/__init__.py +0 -0
  110. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
  111. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
  112. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
  113. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/lhc_match/__init__.py +0 -0
  114. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
  115. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
  116. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/_temp/lhc_match/var_limits.py +0 -0
  117. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/base_element.py +0 -0
  118. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/__init__.py +0 -0
  119. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures.py +0 -0
  120. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
  121. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
  122. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
  123. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
  124. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
  125. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
  126. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/beam_interaction.py +0 -0
  127. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements.py +0 -0
  128. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/bend.h +0 -0
  129. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/cavity.h +0 -0
  130. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
  131. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
  132. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift.h +0 -0
  133. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
  134. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
  135. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
  136. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
  137. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
  138. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
  139. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/elens.h +0 -0
  140. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/exciter.h +0 -0
  141. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
  142. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
  143. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/multipole.h +0 -0
  144. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
  145. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/octupole.h +0 -0
  146. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
  147. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
  148. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
  149. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
  150. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
  151. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
  152. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
  153. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
  154. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/srotation.h +0 -0
  155. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
  156. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
  157. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
  158. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
  159. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
  160. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
  161. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
  162. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
  163. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
  164. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
  165. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
  166. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
  167. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
  168. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
  169. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
  170. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
  171. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
  172. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
  173. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
  174. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
  175. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
  176. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
  177. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
  178. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
  179. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
  180. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
  181. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
  182. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/wedge.h +0 -0
  183. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/wire.h +0 -0
  184. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
  185. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
  186. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
  187. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
  188. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/exciter.py +0 -0
  189. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/rft_element.py +0 -0
  190. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/slice_elements.py +0 -0
  191. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/beam_elements/slice_elements_thick.py +0 -0
  192. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/footprint.py +0 -0
  193. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/general.py +0 -0
  194. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/headers/atomicadd.h +0 -0
  195. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/headers/checks.h +0 -0
  196. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/headers/constants.h +0 -0
  197. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/headers/particle_states.h +0 -0
  198. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/headers/synrad_spectrum.h +0 -0
  199. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/internal_record.py +0 -0
  200. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/json_utils.py +0 -0
  201. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/linear_normal_form.py +0 -0
  202. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/loss_location_refinement/__init__.py +0 -0
  203. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
  204. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/lumi.py +0 -0
  205. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/mad_loader.py +0 -0
  206. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/mad_writer.py +0 -0
  207. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/match.py +0 -0
  208. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/__init__.py +0 -0
  209. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/beam_position_monitor.h +0 -0
  210. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/beam_position_monitor.py +0 -0
  211. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/beam_profile_monitor.h +0 -0
  212. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/beam_profile_monitor.py +0 -0
  213. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/beam_size_monitor.h +0 -0
  214. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/beam_size_monitor.py +0 -0
  215. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/last_turns_monitor.h +0 -0
  216. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/last_turns_monitor.py +0 -0
  217. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/particles_monitor.h +0 -0
  218. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/monitors/particles_monitor.py +0 -0
  219. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/multiline/__init__.py +0 -0
  220. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/multiline/multiline.py +0 -0
  221. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/multiline/shared_knobs.py +0 -0
  222. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/multisetter/__init__.py +0 -0
  223. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/multisetter/multisetter.py +0 -0
  224. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/particles/__init__.py +0 -0
  225. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/particles/constants.py +0 -0
  226. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/particles/particles.py +0 -0
  227. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/particles/rng_src/base_rng.h +0 -0
  228. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/particles/rng_src/particles_rng.h +0 -0
  229. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/pipeline/__init__.py +0 -0
  230. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/pipeline/core.py +0 -0
  231. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/pipeline/manager.py +0 -0
  232. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/pipeline/multitracker.py +0 -0
  233. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/progress_indicator.py +0 -0
  234. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/__init__.py +0 -0
  235. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_generators.py +0 -0
  236. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_src/exponential.h +0 -0
  237. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
  238. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_src/normal.h +0 -0
  239. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_src/rutherford.h +0 -0
  240. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_src/uniform.h +0 -0
  241. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/random/random_src/uniform_accurate.h +0 -0
  242. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/slicing.py +0 -0
  243. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/survey.py +0 -0
  244. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/synctime.py +0 -0
  245. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/tapering.py +0 -0
  246. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/targets.py +0 -0
  247. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/tracker_data.py +0 -0
  248. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/tracker_src/tracker.h +0 -0
  249. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/trajectory_correction.py +0 -0
  250. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack/twissplot.py +0 -0
  251. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack.egg-info/dependency_links.txt +0 -0
  252. {xtrack-0.68.0 → xtrack-0.69.1}/xtrack.egg-info/requires.txt +0 -0
  253. {xtrack-0.68.0 → xtrack-0.69.1}/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.68.0
3
+ Version: 0.69.1
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
@@ -3,6 +3,9 @@ import xobjects as xo
3
3
  import xdeps as xd
4
4
  import numpy as np
5
5
  import pytest
6
+ import pathlib
7
+
8
+ test_data_folder = pathlib.Path(__file__).parent.joinpath('../test_data').absolute()
6
9
 
7
10
  @pytest.mark.parametrize('container_type', ['env', 'line'])
8
11
  def test_vars_and_element_access_modes(container_type):
@@ -568,13 +571,13 @@ def test_assemble_ring():
568
571
  # Check that the cell is matched to the rest of the ring
569
572
  tw = ring.twiss4d()
570
573
  tw_cell_from_ring = tw.rows['start.cell.3.arc.2':'end.cell.3.arc.2']
571
- xo.assert_allclose(tw_cell_from_ring.betx, tw_cell.betx[:-1], atol=0, rtol=2e-4)
572
- xo.assert_allclose(tw_cell_from_ring.bety, tw_cell.bety[:-1], atol=0, rtol=2e-4)
574
+ xo.assert_allclose(tw_cell_from_ring.betx, tw_cell.betx[:-1], atol=0, rtol=5e-4)
575
+ xo.assert_allclose(tw_cell_from_ring.bety, tw_cell.bety[:-1], atol=0, rtol=5e-4)
573
576
 
574
577
  tw2 = ring2.twiss4d()
575
578
  tw_cell_from_ring2 = tw2.rows['start.cell.3.arc.2':'end.cell.3.arc.2']
576
- xo.assert_allclose(tw_cell_from_ring2.betx, tw_cell.betx[:-1], atol=0, rtol=2e-4)
577
- xo.assert_allclose(tw_cell_from_ring2.bety, tw_cell.bety[:-1], atol=0, rtol=2e-4)
579
+ xo.assert_allclose(tw_cell_from_ring2.betx, tw_cell.betx[:-1], atol=0, rtol=5e-4)
580
+ xo.assert_allclose(tw_cell_from_ring2.bety, tw_cell.bety[:-1], atol=0, rtol=5e-4)
578
581
 
579
582
  # Check select
580
583
  cell3_select = ring2.select(start='start.cell.3.arc.2', end='end.cell.3.arc.2',
@@ -598,8 +601,8 @@ def test_assemble_ring():
598
601
  cell3_select.twiss4d()
599
602
 
600
603
  tw2_slice = ring2_sliced.twiss4d()
601
- xo.assert_allclose(tw2_slice['betx', 'ip.l'], tw2['betx', 'ip.l'], atol=0, rtol=2e-4)
602
- xo.assert_allclose(tw2_slice['bety', 'ip.l'], tw2['bety', 'ip.l'], atol=0, rtol=2e-4)
604
+ xo.assert_allclose(tw2_slice['betx', 'ip.l'], tw2['betx', 'ip.l'], atol=0, rtol=5e-4)
605
+ xo.assert_allclose(tw2_slice['bety', 'ip.l'], tw2['bety', 'ip.l'], atol=0, rtol=5e-4)
603
606
  xo.assert_allclose(tw2_slice['alfx', 'ip.l'], 0, atol=1e-6, rtol=0)
604
607
  xo.assert_allclose(tw2_slice['alfy', 'ip.l'], 0, atol=1e-6, rtol=0)
605
608
  xo.assert_allclose(tw2_slice['dx', 'ip.l'], 0, atol=1e-4, rtol=0)
@@ -976,13 +979,13 @@ def test_assemble_ring_builders():
976
979
  # Check that the cell is matched to the rest of the ring
977
980
  tw = ring.twiss4d()
978
981
  tw_cell_from_ring = tw.rows['start.cell.3.arc.2':'end.cell.3.arc.2']
979
- xo.assert_allclose(tw_cell_from_ring.betx, tw_cell.betx[:-1], atol=0, rtol=2e-4)
980
- xo.assert_allclose(tw_cell_from_ring.bety, tw_cell.bety[:-1], atol=0, rtol=2e-4)
982
+ xo.assert_allclose(tw_cell_from_ring.betx, tw_cell.betx[:-1], atol=0, rtol=5e-4)
983
+ xo.assert_allclose(tw_cell_from_ring.bety, tw_cell.bety[:-1], atol=0, rtol=5e-4)
981
984
 
982
985
  tw2 = ring2.twiss4d()
983
986
  tw_cell_from_ring2 = tw2.rows['start.cell.3.arc.2':'end.cell.3.arc.2']
984
- xo.assert_allclose(tw_cell_from_ring2.betx, tw_cell.betx[:-1], atol=0, rtol=2e-4)
985
- xo.assert_allclose(tw_cell_from_ring2.bety, tw_cell.bety[:-1], atol=0, rtol=2e-4)
987
+ xo.assert_allclose(tw_cell_from_ring2.betx, tw_cell.betx[:-1], atol=0, rtol=5e-4)
988
+ xo.assert_allclose(tw_cell_from_ring2.bety, tw_cell.bety[:-1], atol=0, rtol=5e-4)
986
989
 
987
990
  # Check select
988
991
  cell3_select = ring2.select(start='start.cell.3.arc.2', end='end.cell.3.arc.2',
@@ -1006,8 +1009,8 @@ def test_assemble_ring_builders():
1006
1009
  cell3_select.twiss4d()
1007
1010
 
1008
1011
  tw2_slice = ring2_sliced.twiss4d()
1009
- xo.assert_allclose(tw2_slice['betx', 'ip.l'], tw2['betx', 'ip.l'], atol=0, rtol=2e-4)
1010
- xo.assert_allclose(tw2_slice['bety', 'ip.l'], tw2['bety', 'ip.l'], atol=0, rtol=2e-4)
1012
+ xo.assert_allclose(tw2_slice['betx', 'ip.l'], tw2['betx', 'ip.l'], atol=0, rtol=5e-4)
1013
+ xo.assert_allclose(tw2_slice['bety', 'ip.l'], tw2['bety', 'ip.l'], atol=0, rtol=5e-4)
1011
1014
  xo.assert_allclose(tw2_slice['alfx', 'ip.l'], 0, atol=1e-6, rtol=0)
1012
1015
  xo.assert_allclose(tw2_slice['alfy', 'ip.l'], 0, atol=1e-6, rtol=0)
1013
1016
  xo.assert_allclose(tw2_slice['dx', 'ip.l'], 0, atol=1e-4, rtol=0)
@@ -1180,7 +1183,7 @@ def test_assemble_ring_repeated_elements():
1180
1183
  tt_cell = cell.get_table(attr=True)
1181
1184
  tt_cell['s_center'] = (
1182
1185
  tt_cell['s'] + tt_cell['length'] / 2 * np.float64(tt_cell['isthick']))
1183
- assert np.all(tt_cell.name == np.array(
1186
+ assert np.all(tt_cell.env_name == np.array(
1184
1187
  ['mid', 'drift_9', 'ms.f', 'drift_3.f', 'mq.f', 'drift_2.f',
1185
1188
  'corrector.f', 'drift_1.f', 'drift_8', 'mb.3', 'drift_7', 'mb.2',
1186
1189
  'drift_6', 'mb.1', 'drift_5', 'drift_1.d', 'corrector.d',
@@ -1239,8 +1242,8 @@ def test_assemble_ring_repeated_elements():
1239
1242
  tt_arc = arc.get_table(attr=True)
1240
1243
  assert len(tt_arc) == 3 * (len(tt_cell)-1) + 1
1241
1244
  n_cell = len(tt_cell) - 1
1242
- assert np.all(tt_arc.name[n_cell:2*n_cell] == tt_cell.name[:-1])
1243
- for nn in tt_cell.name[:-1]:
1245
+ assert np.all(tt_arc.env_name[n_cell:2*n_cell] == tt_cell.env_name[:-1])
1246
+ for nn in tt_cell.env_name[:-1]:
1244
1247
  assert arc.get(nn) is env.get(nn)
1245
1248
  assert arc.get(nn) is env['cell'].get(nn)
1246
1249
 
@@ -1337,11 +1340,11 @@ def test_assemble_ring_repeated_elements():
1337
1340
 
1338
1341
  # Check that the cell is matched to the rest of the ring
1339
1342
  tw_ring = ring.twiss4d()
1340
- xo.assert_allclose(tw_ring.betx[0], tw_cell.betx[0], atol=0, rtol=2e-4)
1341
- xo.assert_allclose(tw_ring.bety[0], tw_cell.bety[0], atol=0, rtol=2e-4)
1343
+ xo.assert_allclose(tw_ring.betx[0], tw_cell.betx[0], atol=0, rtol=5e-4)
1344
+ xo.assert_allclose(tw_ring.bety[0], tw_cell.bety[0], atol=0, rtol=5e-4)
1342
1345
  tw_ring2 = ring2.twiss4d()
1343
- xo.assert_allclose(tw_ring2.betx[0], tw_cell.betx[0], atol=0, rtol=2e-4)
1344
- xo.assert_allclose(tw_ring2.bety[0], tw_cell.bety[0], atol=0, rtol=2e-4)
1346
+ xo.assert_allclose(tw_ring2.betx[0], tw_cell.betx[0], atol=0, rtol=5e-4)
1347
+ xo.assert_allclose(tw_ring2.bety[0], tw_cell.bety[0], atol=0, rtol=5e-4)
1345
1348
 
1346
1349
  # Check that they share the _element_dict
1347
1350
  assert cell._element_dict is env.element_dict
@@ -1351,14 +1354,29 @@ def test_assemble_ring_repeated_elements():
1351
1354
  assert insertion._element_dict is env.element_dict
1352
1355
  assert ring2._element_dict is env.element_dict
1353
1356
 
1354
- xo.assert_allclose(tw_ring2['betx', 'ip'], tw_half_insertion['betx', 'ip'], atol=0, rtol=2e-4)
1355
- xo.assert_allclose(tw_ring2['bety', 'ip'], tw_half_insertion['bety', 'ip'], atol=0, rtol=2e-4)
1356
- xo.assert_allclose(tw_ring2['alfx', 'ip'], 0, atol=1e-6, rtol=0)
1357
- xo.assert_allclose(tw_ring2['alfy', 'ip'], 0, atol=1e-6, rtol=0)
1358
- xo.assert_allclose(tw_ring2['dx', 'ip'], 0, atol=1e-4, rtol=0)
1359
- xo.assert_allclose(tw_ring2['dpx', 'ip'], 0, atol=1e-6, rtol=0)
1360
- xo.assert_allclose(tw_ring2['dy', 'ip'], 0, atol=1e-4, rtol=0)
1361
- xo.assert_allclose(tw_ring2['dpy', 'ip'], 0, atol=1e-6, rtol=0)
1357
+ xo.assert_allclose(tw_ring2['betx', 'ip::0'], tw_half_insertion['betx', 'ip'], atol=0, rtol=5e-4)
1358
+ xo.assert_allclose(tw_ring2['bety', 'ip::0'], tw_half_insertion['bety', 'ip'], atol=0, rtol=5e-4)
1359
+ xo.assert_allclose(tw_ring2['alfx', 'ip::0'], 0, atol=1e-6, rtol=0)
1360
+ xo.assert_allclose(tw_ring2['alfy', 'ip::0'], 0, atol=1e-6, rtol=0)
1361
+ xo.assert_allclose(tw_ring2['dx', 'ip::0'], 0, atol=1e-4, rtol=0)
1362
+ xo.assert_allclose(tw_ring2['dpx', 'ip::0'], 0, atol=1e-6, rtol=0)
1363
+ xo.assert_allclose(tw_ring2['dy', 'ip::0'], 0, atol=1e-4, rtol=0)
1364
+ xo.assert_allclose(tw_ring2['dpy', 'ip::0'], 0, atol=1e-6, rtol=0)
1365
+
1366
+ # Check a line with the same marker at start and end
1367
+ assert arc.element_names[0] == 'mid'
1368
+ assert arc.element_names[-1] == 'mid'
1369
+ twarc = arc.twiss4d()
1370
+ xo.assert_allclose(twarc.s[0], 0, atol=1e-12, rtol=0)
1371
+ xo.assert_allclose(twarc.s[-1], 228, atol=1e-10, rtol=0)
1372
+ twarc_start_end = arc.twiss4d(start=xt.START, end=xt.END, init=twarc)
1373
+ xo.assert_allclose(twarc_start_end.betx, twarc.betx, atol=1e-12, rtol=0)
1374
+
1375
+ tw_one_cell_ref = twarc.rows['mid::2':'mid::3']
1376
+ tw_one_cell = arc.twiss4d(start='mid::2', end='mid::3', init='periodic')
1377
+ tw_one_cell_stripped = tw_one_cell.rows[:-1] # remove _end_point
1378
+ xo.assert_allclose(tw_one_cell_stripped.betx, tw_one_cell_ref.betx, atol=0, rtol=5e-4)
1379
+
1362
1380
 
1363
1381
  # import matplotlib.pyplot as plt
1364
1382
  # plt.close('all')
@@ -1671,7 +1689,7 @@ def test_repeated_elements():
1671
1689
  ])
1672
1690
 
1673
1691
  tt = line.get_table()
1674
- assert np.all(tt.name == np.array(['mb', 'mb', 'drift_1', 'ip1', 'mb',
1692
+ assert np.all(tt.env_name == np.array(['mb', 'mb', 'drift_1', 'ip1', 'mb',
1675
1693
  'mb', 'drift_2', 'mb', 'ip2', 'mb',
1676
1694
  'mb', '_end_point']))
1677
1695
  assert np.all(tt.s == np.array([
@@ -1692,7 +1710,7 @@ def test_repeated_elements():
1692
1710
  env.place(l1, at=-env.ref['s.l1'], from_='ip'),
1693
1711
  ])
1694
1712
  tt_twol1 = l_twol1.get_table()
1695
- assert np.all(tt_twol1.name == np.array(
1713
+ assert np.all(tt_twol1.env_name == np.array(
1696
1714
  ['drift_3', 'mb', 'mb', 'mid', 'mb', 'mb', 'drift_4', 'ip',
1697
1715
  'drift_5', 'mb', 'mb', 'mid', 'mb', 'mb', '_end_point']))
1698
1716
  assert np.all(tt_twol1.s == np.array(
@@ -1705,7 +1723,42 @@ def test_repeated_elements():
1705
1723
  ])
1706
1724
  tt_mult = l_mult.get_table()
1707
1725
  assert np.all(tt_mult.name == np.array([
1726
+ 'mb::0', 'mb::1', 'mid::0', 'mb::2', 'mb::3', 'mb::4', 'mb::5',
1727
+ 'mid::1', 'mb::6', 'mb::7', 'mb::8', 'mb::9', '_end_point']))
1728
+ assert np.all(tt_mult.env_name == np.array([
1708
1729
  'mb', 'mb', 'mid', 'mb', 'mb', 'mb', 'mb', 'mid', 'mb', 'mb', 'mb',
1709
1730
  'mb', '_end_point']))
1710
1731
  assert np.all(tt_mult.s == np.array(
1711
- [0. , 0.5, 1. , 1. , 1.5, 2. , 2.5, 3. , 3. , 3.5, 4. , 4.5, 5. ]))
1732
+ [0. , 0.5, 1. , 1. , 1.5, 2. , 2.5, 3. , 3. , 3.5, 4. , 4.5, 5. ]))
1733
+
1734
+ def test_select_in_multiline():
1735
+
1736
+ # --- Parameters
1737
+ seq = 'lhcb1'
1738
+ ip_name = 'ip1'
1739
+ s_marker = f'e.ds.l{ip_name[-1]}.b1'
1740
+ e_marker = f's.ds.r{ip_name[-1]}.b1'
1741
+ #-------------------------------------
1742
+
1743
+ collider_file = test_data_folder / 'hllhc15_collider/collider_00_from_mad.json'
1744
+
1745
+ # Load the machine and select line
1746
+ collider= xt.Multiline.from_json(collider_file)
1747
+ collider.vars['test_vars'] = 3.1416
1748
+ line = collider[seq]
1749
+ line_sel = line.select(s_marker,e_marker)
1750
+
1751
+ assert line_sel.element_dict is line.element_dict
1752
+ assert line.get('ip1') is line_sel.get('ip1')
1753
+
1754
+ line_sel['aaa'] = 1e-6
1755
+ assert line_sel['aaa'] == 1e-6
1756
+ assert line['aaa'] == 1e-6
1757
+
1758
+ line_sel.ref['mcbch.7r1.b1'].knl[0] += line.ref['aaa']
1759
+ assert (str(line.ref['mcbch.7r1.b1'].knl[0]._expr)
1760
+ == "((-vars['acbch7.r1b1']) + vars['aaa'])")
1761
+ assert (str(line_sel.ref['mcbch.7r1.b1'].knl[0]._expr)
1762
+ == "((-vars['acbch7.r1b1']) + vars['aaa'])")
1763
+ assert line_sel.get('mcbch.7r1.b1').knl[0] == 1e-6
1764
+ assert line.get('mcbch.7r1.b1').knl[0] == 1e-6
@@ -376,7 +376,6 @@ def test_psb_chicane(test_context):
376
376
 
377
377
  line.enable_time_dependent_vars = True
378
378
  line.dt_update_time_dependent_vars = 3e-6
379
- line.vars.cache_active = True
380
379
 
381
380
  print('Tracking...')
382
381
  line.track(p, num_turns=6000, time=True)
@@ -0,0 +1 @@
1
+ __version__ = '0.69.1'
@@ -61,6 +61,12 @@ class Environment:
61
61
  out._name = name
62
62
  out.builder = Builder(env=self, components=components)
63
63
 
64
+ # Temporary solution to keep consistency in multiline
65
+ if hasattr(self, '_in_multiline') and self._in_multiline is not None:
66
+ out._var_management = None
67
+ out._in_multiline = self._in_multiline
68
+ out._name_in_multiline = self._name_in_multiline
69
+
64
70
  self._lines_weakrefs.add(out) # Weak references
65
71
  if name is not None:
66
72
  self.lines[name] = out
@@ -277,6 +283,7 @@ def _resolve_s_positions(seq_all_places, env):
277
283
  aux_line = env.new_line(components=names_unsorted)
278
284
  aux_tt = aux_line.get_table()
279
285
  aux_tt['length'] = np.diff(aux_tt._data['s'], append=0)
286
+ aux_tt.name = aux_tt.env_name # I want the repeated names here
280
287
 
281
288
  s_center_dct = {}
282
289
  s_center_dct_names = {}
@@ -131,18 +131,6 @@ class Line:
131
131
  else:
132
132
  if element_names is None:
133
133
  element_names = [f"e{ii}" for ii in range(len(elements))]
134
- if len(element_names) > len(set(element_names)):
135
- log.warning("Repetition found in `element_names` -> renaming")
136
- old_element_names = element_names
137
- element_names = []
138
- counters = {nn: 0 for nn in old_element_names}
139
- for nn in old_element_names:
140
- if counters[nn] > 0:
141
- new_nn = nn + '_' + str(counters[nn])
142
- else:
143
- new_nn = nn
144
- counters[nn] += 1
145
- element_names.append(new_nn)
146
134
 
147
135
  assert len(element_names) == len(elements), (
148
136
  "`elements` and `element_names` should have the same length"
@@ -733,7 +721,12 @@ class Line:
733
721
  for kk in data.keys():
734
722
  data[kk] = np.array(data[kk])
735
723
 
736
- return xd.Table(data=data)
724
+ names_table = xd.Table(data={'name': data['name']})
725
+ names_unique = names_table.cols.get_index_unique()
726
+ data['env_name'] = data['name']
727
+ data['name'] = names_unique
728
+ out = xd.Table(data=data, sep_count='::::')
729
+ return out
737
730
 
738
731
  def get_strengths(self, reverse=None):
739
732
 
@@ -3482,6 +3475,14 @@ class Line:
3482
3475
 
3483
3476
  out = self.env.new_line(components=list(tt.name), name=name)
3484
3477
 
3478
+ if hasattr(self, '_in_multiline') and self._in_multiline is not None:
3479
+ out.env._var_management = None
3480
+ out._var_management = None
3481
+ out.env._in_multiline = self._in_multiline
3482
+ out._in_multiline = self._in_multiline
3483
+ out.env._name_in_multiline = self._name_in_multiline
3484
+ out._name_in_multiline = self._name_in_multiline
3485
+
3485
3486
  return out
3486
3487
 
3487
3488
  def set(self, name, *args, **kwargs):
@@ -3542,6 +3543,12 @@ class Line:
3542
3543
  _var_management=self._var_management)
3543
3544
  self.env._lines_weakrefs.add(self)
3544
3545
 
3546
+ # Temporary solution to keep consistency in multiline
3547
+ if hasattr(self, '_in_multiline') and self._in_multiline is not None:
3548
+ self.env._var_management = None
3549
+ self.env._in_multiline = self._in_multiline
3550
+ self.env._name_in_multiline = self._name_in_multiline
3551
+
3545
3552
  def extend(self, line):
3546
3553
  self.element_names.extend(line.element_names)
3547
3554
 
@@ -4252,6 +4259,13 @@ class Line:
4252
4259
  new_ee = ee.get_equivalent_element()
4253
4260
  self.element_dict[nn] = new_ee
4254
4261
 
4262
+ @property
4263
+ def _element_names_unique(self):
4264
+ if not self._has_valid_tracker():
4265
+ raise RuntimeError(
4266
+ '`Line._element_names_unique` con only be called after `Line.build_tracker`')
4267
+ return self.tracker._tracker_data_base._element_names_unique
4268
+
4255
4269
  def frac(x):
4256
4270
  return x % 1
4257
4271
 
@@ -4628,8 +4642,6 @@ class LineVars:
4628
4642
 
4629
4643
  def __init__(self, line):
4630
4644
  self.line = line
4631
- self._cache_active = False
4632
- self._cached_setters = {}
4633
4645
  if '__vary_default' not in self.line._xdeps_vref._owner.keys():
4634
4646
  self.line._xdeps_vref._owner['__vary_default'] = {}
4635
4647
  self.val = VarValues(self)
@@ -4682,26 +4694,9 @@ class LineVars:
4682
4694
  out.append(kk)
4683
4695
  return out
4684
4696
 
4685
- def _setter_from_cache(self, varname):
4686
- if varname not in self._cached_setters:
4687
- if self.line._xdeps_manager is None:
4688
- raise RuntimeError(
4689
- f'Cannot access variable {varname} as the line has no '
4690
- 'xdeps manager')
4691
- try:
4692
- self.cache_active = False
4693
- self._cached_setters[varname] = VarSetter(self.line, varname)
4694
- self.cache_active = True
4695
- except Exception as ee:
4696
- self.cache_active = True
4697
- raise ee
4698
- return self._cached_setters[varname]
4699
-
4700
4697
  def __getitem__(self, key):
4701
4698
  if key not in self: # uses __contains__ method
4702
4699
  raise KeyError(f'Variable `{key}` not found')
4703
- if self.cache_active:
4704
- return self._setter_from_cache(key)
4705
4700
  return self.line._xdeps_vref[key]
4706
4701
 
4707
4702
  def get(self,key,default=0):
@@ -4711,25 +4706,9 @@ class LineVars:
4711
4706
  return default
4712
4707
 
4713
4708
  def __setitem__(self, key, value):
4714
- if self.cache_active:
4715
- if isref(value) or isinstance(value, VarSetter):
4716
- raise ValueError('Cannot set a variable to a ref when the '
4717
- 'cache is active')
4718
- self._setter_from_cache(key)(value)
4719
- else:
4720
- if isinstance(value, str):
4721
- value = self.line._xdeps_eval.eval(value)
4722
- self.line._xdeps_vref[key] = value
4723
-
4724
- @property
4725
- def cache_active(self):
4726
- return self._cache_active
4727
-
4728
- @cache_active.setter
4729
- def cache_active(self, value):
4730
- assert value in (True, False)
4731
- self._cache_active = value
4732
- self.line._xdeps_manager._tree_frozen = value
4709
+ if isinstance(value, str):
4710
+ value = self.line._xdeps_eval.eval(value)
4711
+ self.line._xdeps_vref[key] = value
4733
4712
 
4734
4713
  def set_from_madx_file(self, filename, mad_stdout=False):
4735
4714
 
@@ -4761,9 +4740,6 @@ class LineVars:
4761
4740
  for ff in filename:
4762
4741
  mad.call(str(ff))
4763
4742
 
4764
- assert self.cache_active is False, (
4765
- 'Cannot load optics file when cache is active')
4766
-
4767
4743
  mad.input('''
4768
4744
  elm: marker; dummy: sequence, l=1; e:elm, at=0.5; endsequence;
4769
4745
  beam; use,sequence=dummy;''')
@@ -4829,8 +4805,6 @@ class ActionVars(Action):
4829
4805
  self.line = line
4830
4806
 
4831
4807
  def run(self, **kwargs):
4832
- assert not self.line.vars.cache_active, (
4833
- 'Cannot run action when cache is active')
4834
4808
  return self.line._xdeps_vref._owner
4835
4809
 
4836
4810
  class ActionLine(Action):
@@ -4858,45 +4832,6 @@ class VarValues:
4858
4832
  else:
4859
4833
  return default
4860
4834
 
4861
- class VarSetter:
4862
- def __init__(self, line, varname):
4863
- self.multiline = line
4864
- self.varname = varname
4865
-
4866
- manager = self.multiline._xdeps_manager
4867
- if manager is None:
4868
- raise RuntimeError(
4869
- f'Cannot access variable {varname} as the line has no xdeps manager')
4870
- # assuming line._xdeps_vref is a direct view of a dictionary
4871
- self.owner = line._xdeps_vref[varname]._owner._owner
4872
- self.fstr = manager.mk_fun('setter', **{'val': line._xdeps_vref[varname]})
4873
- self.gbl = {k: r._owner for k, r in manager.containers.items()}
4874
- self._build_fun()
4875
-
4876
- def get_value(self):
4877
- return self.owner[self.varname]
4878
-
4879
- @property
4880
- def _value(self):
4881
- return self.get_value()
4882
-
4883
- def _build_fun(self):
4884
- lcl = {}
4885
- exec(self.fstr, self.gbl.copy(), lcl)
4886
- self.fun = lcl['setter']
4887
-
4888
- def __call__(self, value):
4889
- self.fun(val=value)
4890
-
4891
- def __getstate__(self):
4892
- out = self.__dict__.copy()
4893
- out.pop('fun')
4894
- return out
4895
-
4896
- def __setstate__(self, state):
4897
- self.__dict__.update(state)
4898
- self._build_fun()
4899
-
4900
4835
  class LineAttrItem:
4901
4836
  def __init__(self, name, index=None, line=None):
4902
4837
  self.name = name
@@ -120,6 +120,10 @@ class Tracker:
120
120
  _context=_context,
121
121
  _buffer=_buffer,
122
122
  _no_resolve_parents=_prebuilding_kernels)
123
+ if not _prebuilding_kernels:
124
+ tracker_data_base._line_table = line.get_table()
125
+ tracker_data_base._element_names_unique = tuple(
126
+ tracker_data_base._line_table.name[:-1]) # remove _endpoint
123
127
  line._freeze()
124
128
 
125
129
  if np.any([hasattr(ee, 'needs_rng') and ee.needs_rng for ee in line.elements]):