xtrack 0.66.0__tar.gz → 0.67.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.
- {xtrack-0.66.0/xtrack.egg-info → xtrack-0.67.0}/PKG-INFO +1 -1
- xtrack-0.67.0/tests/test_environment.py +443 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_line.py +31 -17
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_periodic_symmetric_twiss_and_match.py +10 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_slice_and_insert_with_replicas.py +16 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/__init__.py +1 -0
- xtrack-0.67.0/xtrack/_version.py +1 -0
- xtrack-0.67.0/xtrack/environment.py +371 -0
- xtrack-0.67.0/xtrack/json_utils.py +39 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/line.py +203 -32
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/multiline/multiline.py +9 -19
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/slicing.py +6 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/survey.py +14 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/synctime.py +7 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/tracker.py +91 -79
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/tracker_data.py +4 -1
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/trajectory_correction.py +114 -39
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/twiss.py +92 -75
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/twissplot.py +106 -51
- {xtrack-0.66.0 → xtrack-0.67.0/xtrack.egg-info}/PKG-INFO +1 -1
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack.egg-info/SOURCES.txt +3 -0
- xtrack-0.66.0/xtrack/_version.py +0 -1
- {xtrack-0.66.0 → xtrack-0.67.0}/LICENSE +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/MANIFEST.in +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/README.md +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/base_classes.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/elements.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/line.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/particles.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/pyproject.toml +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/setup.cfg +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/setup.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_acceleration.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_apertures.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_attr_replicas_and_slices.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_coasting.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_collimation.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_element_characterization_functions.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_elements.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_elements_thick.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_footprint.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_full_rings.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_hvkick.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_ions.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_lumi.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_mad_writer.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_madloader.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_nested.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_multiline.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_multisetter.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_multispecies.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_particles_api.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_pipeline.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_prebuild_kernels.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_radial_steering.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_radiation.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_random_gen.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_rf_track.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_rotation_signs.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_seeds.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_slice_elements.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_slicing.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_sps_thick.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_survey.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_tapering.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_tilt_shifts.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_tracker.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_trajectory_correcton.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_twiss.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_var_cache.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_vs_madx.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/tests/test_xmask_orbit_correction.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/base_element.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/slice_elements.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/footprint.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/general.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/headers/checks.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/headers/constants.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/internal_record.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/lumi.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/mad_loader.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/mad_writer.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/match.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/multiline/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/multiline/shared_knobs.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/particles/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/particles/constants.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/particles/particles.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/__init__.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/random/random_src/uniform_accurate.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/tapering.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/targets.py +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.66.0 → xtrack-0.67.0}/xtrack.egg-info/top_level.txt +0 -0
@@ -0,0 +1,443 @@
|
|
1
|
+
import xtrack as xt
|
2
|
+
import xobjects as xo
|
3
|
+
import numpy as np
|
4
|
+
import pytest
|
5
|
+
|
6
|
+
@pytest.mark.parametrize('container_type', ['env', 'line'])
|
7
|
+
def test_vars_and_element_access_modes(container_type):
|
8
|
+
|
9
|
+
env = xt.Environment()
|
10
|
+
|
11
|
+
env.vars({
|
12
|
+
'k.1': 1.,
|
13
|
+
'a': 2.,
|
14
|
+
'b': '2 * a + k.1',
|
15
|
+
})
|
16
|
+
|
17
|
+
line = env.new_line([])
|
18
|
+
|
19
|
+
ee = {'env': env, 'line': line}[container_type]
|
20
|
+
|
21
|
+
assert ee.vv['b'] == 2 * 2 + 1
|
22
|
+
|
23
|
+
ee.vars['a'] = ee.vars['k.1']
|
24
|
+
assert ee.vv['b'] == 2 * 1 + 1
|
25
|
+
|
26
|
+
ee.vars(a=3.)
|
27
|
+
ee.vars({'k.1': 'a'})
|
28
|
+
assert ee.vv['k.1'] == 3.
|
29
|
+
assert ee.vv['b'] == 2 * 3 + 3.
|
30
|
+
|
31
|
+
ee.vars['k.1'] = 2 * ee.vars['a'] + 5
|
32
|
+
assert ee.vv['k.1'] == 2 * 3 + 5
|
33
|
+
assert ee.vv['b'] == 2 * 3 + 2 * 3 + 5
|
34
|
+
|
35
|
+
ee.vars.set('a', 4.)
|
36
|
+
assert ee.vv['k.1'] == 2 * 4 + 5
|
37
|
+
assert ee.vv['b'] == 2 * 4 + 2 * 4 + 5
|
38
|
+
|
39
|
+
ee.vars.set('k.1', '2*a + 5')
|
40
|
+
assert ee.vv['k.1'] == 2 * 4 + 5
|
41
|
+
assert ee.vv['b'] == 2 * 4 + 2 * 4 + 5
|
42
|
+
|
43
|
+
ee.vars.set('k.1', 3 * ee.vars['a'] + 6)
|
44
|
+
assert ee.vv['k.1'] == 3 * 4 + 6
|
45
|
+
assert ee.vv['b'] == 2 * 4 + 3 * 4 + 6
|
46
|
+
|
47
|
+
env.set('c', '2*b')
|
48
|
+
assert env.vv['c'] == 2 * (2 * 4 + 3 * 4 + 6)
|
49
|
+
env.set('d', 6)
|
50
|
+
assert env.vv['d'] == 6
|
51
|
+
env.set('d', '7')
|
52
|
+
assert env.vv['d'] == 7
|
53
|
+
|
54
|
+
ee.set('a', 0.)
|
55
|
+
assert ee.vv['k.1'] == 3 * 0 + 6
|
56
|
+
assert ee.vv['b'] == 2 * 0 + 3 * 0 + 6
|
57
|
+
|
58
|
+
ee.set('a', 2.)
|
59
|
+
ee.set('k.1', '2 * a + 5')
|
60
|
+
assert ee.vv['k.1'] == 2 * 2 + 5
|
61
|
+
assert ee.vv['b'] == 2 * 2 + 2 * 2 + 5
|
62
|
+
|
63
|
+
ee.set('k.1', 3 * ee.vars['a'] + 6)
|
64
|
+
assert ee.vv['k.1'] == 3 * 2 + 6
|
65
|
+
assert ee.vv['b'] == 2 * 2 + 3 * 2 + 6
|
66
|
+
|
67
|
+
assert hasattr(ee.ref['k.1'], '_value') # is a Ref
|
68
|
+
|
69
|
+
ee.ref['a'] = 0
|
70
|
+
assert ee.vv['k.1'] == 3 * 0 + 6
|
71
|
+
assert ee.vv['b'] == 2 * 0 + 3 * 0 + 6
|
72
|
+
|
73
|
+
ee.ref['a'] = 2
|
74
|
+
ee.ref['k.1'] = 2 * ee.ref['a'] + 5
|
75
|
+
assert ee.vv['k.1'] == 2 * 2 + 5
|
76
|
+
assert ee.vv['b'] == 2 * 2 + 2 * 2 + 5
|
77
|
+
|
78
|
+
#--------------------------------------------------
|
79
|
+
|
80
|
+
ee.vars({
|
81
|
+
'a': 4.,
|
82
|
+
'b': '2 * a + 5',
|
83
|
+
'k.1': '2 * a + 5',
|
84
|
+
})
|
85
|
+
|
86
|
+
env.new('bb', xt.Bend, k0='2 * b', length=3+env.vars['a'] + env.vars['b'],
|
87
|
+
h=5.)
|
88
|
+
assert env['bb'].k0 == 2 * (2 * 4 + 5)
|
89
|
+
assert env['bb'].length == 3 + 4 + 2 * 4 + 5
|
90
|
+
assert env['bb'].h == 5.
|
91
|
+
|
92
|
+
env.vars['a'] = 2.
|
93
|
+
assert env['bb'].k0 == 2 * (2 * 2 + 5)
|
94
|
+
assert env['bb'].length == 3 + 2 + 2 * 2 + 5
|
95
|
+
assert env['bb'].h == 5.
|
96
|
+
|
97
|
+
line = env.new_line([
|
98
|
+
env.new('bb1', 'bb', length=3*env.vars['a'], at='2*a'),
|
99
|
+
env.place('bb', at=10 * env.vars['a'], from_='bb1'),
|
100
|
+
])
|
101
|
+
|
102
|
+
assert hasattr(env.ref['bb1'].length, '_value') # is a Ref
|
103
|
+
assert not hasattr(env['bb1'].length, '_value') # a number
|
104
|
+
assert env.ref['bb1'].length._value == 3 * 2
|
105
|
+
assert env['bb1'].length == 3 * 2
|
106
|
+
|
107
|
+
assert hasattr(env.ref['bb1'].length, '_value') # is a Ref
|
108
|
+
assert not hasattr(env['bb1'].length, '_value') # a number
|
109
|
+
assert env.ref['bb1'].length._value == 3 * 2
|
110
|
+
assert env['bb1'].length == 3 * 2
|
111
|
+
|
112
|
+
assert line['bb1'] is not env['bb']
|
113
|
+
assert line['bb'] is env['bb']
|
114
|
+
|
115
|
+
a = env.vv['a']
|
116
|
+
assert line['bb1'].length == 3 * a
|
117
|
+
assert line['bb1'].k0 == 2 * (2 * a + 5)
|
118
|
+
assert line['bb1'].h == 5.
|
119
|
+
|
120
|
+
assert line['bb'].k0 == 2 * (2 * a + 5)
|
121
|
+
assert line['bb'].length == 3 + a + 2 * a + 5
|
122
|
+
assert line['bb'].h == 5.
|
123
|
+
|
124
|
+
tt = line.get_table(attr=True)
|
125
|
+
tt['s_center'] = tt['s'] + tt['length']/2
|
126
|
+
|
127
|
+
assert np.all(tt.name == np.array(['drift_1', 'bb1', 'drift_2', 'bb', '_end_point']))
|
128
|
+
|
129
|
+
assert tt['s_center', 'bb1'] == 2*a
|
130
|
+
assert tt['s_center', 'bb'] - tt['s_center', 'bb1'] == 10*a
|
131
|
+
|
132
|
+
old_a = a
|
133
|
+
line.vars['a'] = 3.
|
134
|
+
a = line.vv['a']
|
135
|
+
assert line['bb1'].length == 3 * a
|
136
|
+
assert line['bb1'].k0 == 2 * (2 * a + 5)
|
137
|
+
assert line['bb1'].h == 5.
|
138
|
+
|
139
|
+
assert line['bb'].k0 == 2 * (2 * a + 5)
|
140
|
+
assert line['bb'].length == 3 + a + 2 * a + 5
|
141
|
+
assert line['bb'].h == 5.
|
142
|
+
|
143
|
+
tt_new = line.get_table(attr=True)
|
144
|
+
|
145
|
+
# Drifts are not changed:
|
146
|
+
tt_new['length', 'drift_1'] == tt['length', 'drift_1']
|
147
|
+
tt_new['length', 'drift_2'] == tt['length', 'drift_2']
|
148
|
+
|
149
|
+
def test_element_placing_at_s():
|
150
|
+
|
151
|
+
env = xt.Environment()
|
152
|
+
|
153
|
+
env.vars({
|
154
|
+
'l.b1': 1.0,
|
155
|
+
'l.q1': 0.5,
|
156
|
+
's.ip': 10,
|
157
|
+
's.left': -5,
|
158
|
+
's.right': 5,
|
159
|
+
'l.before_right': 1,
|
160
|
+
'l.after_left2': 0.5,
|
161
|
+
})
|
162
|
+
|
163
|
+
# names, tab_sorted = handle_s_places(seq)
|
164
|
+
line = env.new_line(components=[
|
165
|
+
env.new('b1', xt.Bend, length='l.b1'),
|
166
|
+
env.new('q1', xt.Quadrupole, length='l.q1'),
|
167
|
+
env.new('ip', xt.Marker, at='s.ip'),
|
168
|
+
(
|
169
|
+
env.new('before_before_right', xt.Marker),
|
170
|
+
env.new('before_right', xt.Sextupole, length=1),
|
171
|
+
env.new('right',xt.Quadrupole, length=0.8, at='s.right', from_='ip'),
|
172
|
+
env.new('after_right', xt.Marker),
|
173
|
+
env.new('after_right2', xt.Marker),
|
174
|
+
),
|
175
|
+
env.new('left', xt.Quadrupole, length=1, at='s.left', from_='ip'),
|
176
|
+
env.new('after_left', xt.Marker),
|
177
|
+
env.new('after_left2', xt.Bend, length='l.after_left2'),
|
178
|
+
])
|
179
|
+
|
180
|
+
tt = line.get_table(attr=True)
|
181
|
+
tt['s_center'] = tt['s'] + tt['length']/2
|
182
|
+
assert np.all(tt.name == np.array([
|
183
|
+
'b1', 'q1', 'drift_1', 'left', 'after_left', 'after_left2',
|
184
|
+
'drift_2', 'ip', 'drift_3', 'before_before_right', 'before_right',
|
185
|
+
'right', 'after_right', 'after_right2', '_end_point']))
|
186
|
+
|
187
|
+
xo.assert_allclose(env['b1'].length, 1.0, rtol=0, atol=1e-14)
|
188
|
+
xo.assert_allclose(env['q1'].length, 0.5, rtol=0, atol=1e-14)
|
189
|
+
xo.assert_allclose(tt['s', 'ip'], 10, rtol=0, atol=1e-14)
|
190
|
+
xo.assert_allclose(tt['s', 'before_before_right'], tt['s', 'before_right'],
|
191
|
+
rtol=0, atol=1e-14)
|
192
|
+
xo.assert_allclose(tt['s_center', 'before_right'] - tt['s_center', 'right'],
|
193
|
+
-(1 + 0.8)/2, rtol=0, atol=1e-14)
|
194
|
+
xo.assert_allclose(tt['s_center', 'right'] - tt['s', 'ip'], 5, rtol=0, atol=1e-14)
|
195
|
+
xo.assert_allclose(tt['s_center', 'after_right'] - tt['s_center', 'right'],
|
196
|
+
0.8/2, rtol=0, atol=1e-14)
|
197
|
+
xo.assert_allclose(tt['s_center', 'after_right2'] - tt['s_center', 'right'],
|
198
|
+
0.8/2, rtol=0, atol=1e-14)
|
199
|
+
xo.assert_allclose(tt['s_center', 'left'] - tt['s_center', 'ip'], -5,
|
200
|
+
rtol=0, atol=1e-14)
|
201
|
+
xo.assert_allclose(tt['s_center', 'after_left'] - tt['s_center', 'left'], 1/2,
|
202
|
+
rtol=0, atol=1e-14)
|
203
|
+
xo.assert_allclose(tt['s_center', 'after_left2'] - tt['s_center', 'after_left'],
|
204
|
+
0.5/2, rtol=0, atol=1e-14)
|
205
|
+
|
206
|
+
|
207
|
+
# import matplotlib.pyplot as plt
|
208
|
+
# plt.close('all')
|
209
|
+
# line.survey().plot()
|
210
|
+
|
211
|
+
# plt.show()
|
212
|
+
|
213
|
+
def test_assemble_ring():
|
214
|
+
|
215
|
+
env = xt.Environment()
|
216
|
+
env.particle_ref = xt.Particles(p0c=2e9)
|
217
|
+
|
218
|
+
n_bends_per_cell = 6
|
219
|
+
n_cells_par_arc = 3
|
220
|
+
n_arcs = 3
|
221
|
+
|
222
|
+
n_bends = n_bends_per_cell * n_cells_par_arc * n_arcs
|
223
|
+
|
224
|
+
env.vars({
|
225
|
+
'l.mq': 0.5,
|
226
|
+
'kqf': 0.027,
|
227
|
+
'kqd': -0.0271,
|
228
|
+
'l.mb': 10,
|
229
|
+
'l.ms': 0.3,
|
230
|
+
'k2sf': 0.001,
|
231
|
+
'k2sd': -0.001,
|
232
|
+
'angle.mb': 2 * np.pi / n_bends,
|
233
|
+
'k0.mb': 'angle.mb / l.mb',
|
234
|
+
'k0l.corrector': 0,
|
235
|
+
'k1sl.corrector': 0,
|
236
|
+
'l.halfcell': 38,
|
237
|
+
})
|
238
|
+
|
239
|
+
env.new('mb', xt.Bend, length='l.mb', k0='k0.mb', h='k0.mb')
|
240
|
+
env.new('mq', xt.Quadrupole, length='l.mq')
|
241
|
+
env.new('ms', xt.Sextupole, length='l.ms')
|
242
|
+
env.new('corrector', xt.Multipole, knl=[0], length=0.1)
|
243
|
+
|
244
|
+
girder = env.new_line(components=[
|
245
|
+
env.place('mq', at=1),
|
246
|
+
env.place('ms', at=0.8, from_='mq'),
|
247
|
+
env.place('corrector', at=-0.8, from_='mq'),
|
248
|
+
])
|
249
|
+
|
250
|
+
girder_f = girder.clone(name='f')
|
251
|
+
girder_d = girder.clone(name='d', mirror=True)
|
252
|
+
env.set('mq.f', k1='3') # Test string with value
|
253
|
+
assert env['mq.f'].k1 == 3.
|
254
|
+
env.set('mq.f', k1='kqf')
|
255
|
+
env.set('mq.d', k1='kqd')
|
256
|
+
|
257
|
+
halfcell = env.new_line(components=[
|
258
|
+
|
259
|
+
# End of the half cell (will be mid of the cell)
|
260
|
+
env.new('mid', xt.Marker, at='l.halfcell'),
|
261
|
+
|
262
|
+
# Bends
|
263
|
+
env.new('mb.2', 'mb', at='l.halfcell / 2'),
|
264
|
+
env.new('mb.1', 'mb', at='-l.mb - 1', from_='mb.2'),
|
265
|
+
env.new('mb.3', 'mb', at='l.mb + 1', from_='mb.2'),
|
266
|
+
|
267
|
+
# Quadrupoles, sextupoles and correctors
|
268
|
+
env.place(girder_d, at=1.2),
|
269
|
+
env.place(girder_f, at='l.halfcell - 1.2'),
|
270
|
+
|
271
|
+
])
|
272
|
+
|
273
|
+
|
274
|
+
hcell_left = halfcell.replicate(name='l', mirror=True)
|
275
|
+
hcell_right = halfcell.replicate(name='r')
|
276
|
+
|
277
|
+
cell = env.new_line(components=[
|
278
|
+
env.new('start', xt.Marker),
|
279
|
+
hcell_left,
|
280
|
+
hcell_right,
|
281
|
+
env.new('end', xt.Marker),
|
282
|
+
])
|
283
|
+
|
284
|
+
opt = cell.match(
|
285
|
+
method='4d',
|
286
|
+
vary=xt.VaryList(['kqf', 'kqd'], step=1e-5),
|
287
|
+
targets=xt.TargetSet(
|
288
|
+
qx=0.333333,
|
289
|
+
qy=0.333333,
|
290
|
+
))
|
291
|
+
tw_cell = cell.twiss4d()
|
292
|
+
|
293
|
+
|
294
|
+
env.vars({
|
295
|
+
'kqf.ss': 0.027 / 2,
|
296
|
+
'kqd.ss': -0.0271 / 2,
|
297
|
+
})
|
298
|
+
|
299
|
+
halfcell_ss = env.new_line(components=[
|
300
|
+
|
301
|
+
env.new('mid', xt.Marker, at='l.halfcell'),
|
302
|
+
|
303
|
+
env.new('mq.ss.d', 'mq', k1='kqd.ss', at = '0.5 + l.mq / 2'),
|
304
|
+
env.new('mq.ss.f', 'mq', k1='kqf.ss', at = 'l.halfcell - l.mq / 2 - 0.5'),
|
305
|
+
|
306
|
+
env.new('corrector.ss.v', 'corrector', at=0.75, from_='mq.ss.d'),
|
307
|
+
env.new('corrector.ss.h', 'corrector', at=-0.75, from_='mq.ss.f')
|
308
|
+
])
|
309
|
+
|
310
|
+
hcell_left_ss = halfcell_ss.replicate(name='l', mirror=True)
|
311
|
+
hcell_right_ss = halfcell_ss.replicate(name='r')
|
312
|
+
cell_ss = env.new_line(components=[
|
313
|
+
env.new('start.ss', xt.Marker),
|
314
|
+
hcell_left_ss,
|
315
|
+
hcell_right_ss,
|
316
|
+
env.new('end.ss', xt.Marker),
|
317
|
+
])
|
318
|
+
|
319
|
+
opt = cell_ss.match(
|
320
|
+
solve=False,
|
321
|
+
method='4d',
|
322
|
+
vary=xt.VaryList(['kqf.ss', 'kqd.ss'], step=1e-5),
|
323
|
+
targets=xt.TargetSet(
|
324
|
+
betx=tw_cell.betx[-1], bety=tw_cell.bety[-1], at='start.ss',
|
325
|
+
))
|
326
|
+
opt.solve()
|
327
|
+
|
328
|
+
|
329
|
+
arc = env.new_line(components=[
|
330
|
+
cell.replicate(name='cell.1'),
|
331
|
+
cell.replicate(name='cell.2'),
|
332
|
+
cell.replicate(name='cell.3'),
|
333
|
+
])
|
334
|
+
|
335
|
+
|
336
|
+
ss = env.new_line(components=[
|
337
|
+
cell_ss.replicate('cell.1'),
|
338
|
+
cell_ss.replicate('cell.2'),
|
339
|
+
])
|
340
|
+
|
341
|
+
ring = env.new_line(components=[
|
342
|
+
arc.replicate(name='arc.1'),
|
343
|
+
ss.replicate(name='ss.1'),
|
344
|
+
arc.replicate(name='arc.2'),
|
345
|
+
ss.replicate(name='ss.2'),
|
346
|
+
arc.replicate(name='arc.3'),
|
347
|
+
ss.replicate(name='ss.3'),
|
348
|
+
])
|
349
|
+
|
350
|
+
## Insertion
|
351
|
+
|
352
|
+
env.vars({
|
353
|
+
'k1.q1': 0.025,
|
354
|
+
'k1.q2': -0.025,
|
355
|
+
'k1.q3': 0.025,
|
356
|
+
'k1.q4': -0.02,
|
357
|
+
'k1.q5': 0.025,
|
358
|
+
})
|
359
|
+
|
360
|
+
half_insertion = env.new_line(components=[
|
361
|
+
|
362
|
+
# Start-end markers
|
363
|
+
env.new('ip', xt.Marker),
|
364
|
+
env.new('e.insertion', xt.Marker, at=76),
|
365
|
+
|
366
|
+
# Quads
|
367
|
+
env.new('mq.1', xt.Quadrupole, k1='k1.q1', length='l.mq', at = 20),
|
368
|
+
env.new('mq.2', xt.Quadrupole, k1='k1.q2', length='l.mq', at = 25),
|
369
|
+
env.new('mq.3', xt.Quadrupole, k1='k1.q3', length='l.mq', at=37),
|
370
|
+
env.new('mq.4', xt.Quadrupole, k1='k1.q4', length='l.mq', at=55),
|
371
|
+
env.new('mq.5', xt.Quadrupole, k1='k1.q5', length='l.mq', at=73),
|
372
|
+
|
373
|
+
# Dipole correctors (will use h and v on the same corrector)
|
374
|
+
env.new('corrector.ss.1', 'corrector', at=0.75, from_='mq.1'),
|
375
|
+
env.new('corrector.ss.2', 'corrector', at=-0.75, from_='mq.2'),
|
376
|
+
env.new('corrector.ss.3', 'corrector', at=0.75, from_='mq.3'),
|
377
|
+
env.new('corrector.ss.4', 'corrector', at=-0.75, from_='mq.4'),
|
378
|
+
env.new('corrector.ss.5', 'corrector', at=0.75, from_='mq.5'),
|
379
|
+
|
380
|
+
])
|
381
|
+
|
382
|
+
tw_arc = arc.twiss4d()
|
383
|
+
|
384
|
+
opt = half_insertion.match(
|
385
|
+
solve=False,
|
386
|
+
betx=tw_arc.betx[0], bety=tw_arc.bety[0],
|
387
|
+
alfx=tw_arc.alfx[0], alfy=tw_arc.alfy[0],
|
388
|
+
init_at='e.insertion',
|
389
|
+
start='ip', end='e.insertion',
|
390
|
+
vary=xt.VaryList(['k1.q1', 'k1.q2', 'k1.q3', 'k1.q4'], step=1e-5),
|
391
|
+
targets=[
|
392
|
+
xt.TargetSet(alfx=0, alfy=0, at='ip'),
|
393
|
+
xt.Target(lambda tw: tw.betx[0] - tw.bety[0], 0),
|
394
|
+
xt.Target(lambda tw: tw.betx.max(), xt.LessThan(400)),
|
395
|
+
xt.Target(lambda tw: tw.bety.max(), xt.LessThan(400)),
|
396
|
+
xt.Target(lambda tw: tw.betx.min(), xt.GreaterThan(2)),
|
397
|
+
xt.Target(lambda tw: tw.bety.min(), xt.GreaterThan(2)),
|
398
|
+
]
|
399
|
+
)
|
400
|
+
opt.step(40)
|
401
|
+
opt.solve()
|
402
|
+
|
403
|
+
insertion = env.new_line([
|
404
|
+
half_insertion.replicate('l', mirror=True),
|
405
|
+
half_insertion.replicate('r')])
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
ring2 = env.new_line(components=[
|
410
|
+
arc.replicate(name='arcc.1'),
|
411
|
+
ss.replicate(name='sss.2'),
|
412
|
+
arc.replicate(name='arcc.2'),
|
413
|
+
insertion,
|
414
|
+
arc.replicate(name='arcc.3'),
|
415
|
+
ss.replicate(name='sss.3')
|
416
|
+
])
|
417
|
+
|
418
|
+
|
419
|
+
# # Check buffer behavior
|
420
|
+
ring2_sliced = ring2.select()
|
421
|
+
ring2_sliced.cut_at_s(np.arange(0, ring2.get_length(), 0.5))
|
422
|
+
|
423
|
+
|
424
|
+
# import matplotlib.pyplot as plt
|
425
|
+
# plt.close('all')
|
426
|
+
# for ii, rr in enumerate([ring, ring2_sliced]):
|
427
|
+
|
428
|
+
# tw = rr.twiss4d()
|
429
|
+
|
430
|
+
# fig = plt.figure(ii, figsize=(6.4*1.2, 4.8))
|
431
|
+
# ax1 = fig.add_subplot(2, 1, 1)
|
432
|
+
# pltbet = tw.plot('betx bety', ax=ax1)
|
433
|
+
# ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)
|
434
|
+
# pltdx = tw.plot('dx', ax=ax2)
|
435
|
+
# fig.subplots_adjust(right=.85)
|
436
|
+
# pltbet.move_legend(1.2,1)
|
437
|
+
# pltdx.move_legend(1.2,1)
|
438
|
+
|
439
|
+
# ring2.survey().plot()
|
440
|
+
|
441
|
+
# plt.show()
|
442
|
+
|
443
|
+
|
@@ -656,36 +656,50 @@ def test_from_json_to_json(tmp_path):
|
|
656
656
|
}
|
657
657
|
line.metadata = example_metadata
|
658
658
|
|
659
|
+
def asserts():
|
660
|
+
assert len(result.element_dict.keys()) == 2
|
661
|
+
assert result.element_names == ['m', 'd', 'm', 'd']
|
662
|
+
|
663
|
+
assert isinstance(result['m'], xt.Multipole)
|
664
|
+
assert (result['m'].knl == [1, 2]).all()
|
665
|
+
|
666
|
+
assert isinstance(result['d'], xt.Drift)
|
667
|
+
assert result['d'].length == 1
|
668
|
+
|
669
|
+
assert result.metadata == example_metadata
|
670
|
+
result.metadata['qx']['lhcb1'] = result.metadata['qx']['lhcb1'] + 1
|
671
|
+
assert result.metadata != example_metadata
|
672
|
+
result.metadata['qx']['lhcb1'] = result.metadata['qx']['lhcb1'] - 1
|
673
|
+
|
659
674
|
line.to_json(tmp_path / 'test.json')
|
660
675
|
result = xt.Line.from_json(tmp_path / 'test.json')
|
661
676
|
|
662
|
-
|
663
|
-
assert result.element_names == ['m', 'd', 'm', 'd']
|
677
|
+
asserts()
|
664
678
|
|
665
|
-
|
666
|
-
|
679
|
+
with open(tmp_path / 'test2.json', 'w') as f:
|
680
|
+
line.to_json(f)
|
667
681
|
|
668
|
-
|
669
|
-
|
682
|
+
with open(tmp_path / 'test2.json', 'r') as f:
|
683
|
+
result = xt.Line.from_json(f)
|
684
|
+
|
685
|
+
asserts()
|
670
686
|
|
671
687
|
with open(tmp_path / 'test2.json', 'w') as f:
|
672
|
-
line.to_json(f)
|
688
|
+
line.to_json(f,indent=None)
|
673
689
|
|
674
690
|
with open(tmp_path / 'test2.json', 'r') as f:
|
675
691
|
result = xt.Line.from_json(f)
|
676
692
|
|
677
|
-
|
678
|
-
assert result.element_names == ['m', 'd', 'm', 'd']
|
693
|
+
asserts()
|
679
694
|
|
680
|
-
|
681
|
-
|
695
|
+
with open(tmp_path / 'test2.json.gz', 'w') as f:
|
696
|
+
line.to_json(f,indent=2)
|
682
697
|
|
683
|
-
|
684
|
-
|
698
|
+
with open(tmp_path / 'test2.json.gz', 'r') as f:
|
699
|
+
result = xt.Line.from_json(f)
|
700
|
+
|
701
|
+
asserts()
|
685
702
|
|
686
|
-
assert result.metadata == example_metadata
|
687
|
-
result.metadata['qx']['lhcb1'] = result.metadata['qx']['lhcb1'] + 1
|
688
|
-
assert result.metadata != example_metadata
|
689
703
|
|
690
704
|
@for_all_test_contexts
|
691
705
|
def test_config_propagation(test_context):
|
@@ -1060,4 +1074,4 @@ def test_get_strengths(test_context):
|
|
1060
1074
|
rtol=0, atol=1e-14)
|
1061
1075
|
xo.assert_allclose(line['mbw.a6l3.b2'].h,
|
1062
1076
|
str_table['angle_rad', 'mbw.a6l3.b2'] / str_table['length', 'mbw.a6l3.b2'],
|
1063
|
-
rtol=0, atol=1e-14)
|
1077
|
+
rtol=0, atol=1e-14)
|
@@ -137,6 +137,8 @@ def test_periodic_symmetric_twiss_and_match():
|
|
137
137
|
tw_cell.rows[:'mid_cell'].dx, atol=1e-8, rtol=0)
|
138
138
|
xo.assert_allclose(tw_half_cell.dpx[:-1], # remove '_end_point'
|
139
139
|
tw_cell.rows[:'mid_cell'].dpx, atol=1e-8, rtol=0)
|
140
|
+
xo.assert_allclose(tw_half_cell.ddx[:-1], # remove '_end_point'
|
141
|
+
tw_cell.rows[:'mid_cell'].ddx, atol=1e-7, rtol=0)
|
140
142
|
|
141
143
|
xo.assert_allclose(tw_half_cell.ax_chrom[:-1], # remove '_end_point'
|
142
144
|
tw_cell.rows[:'mid_cell'].ax_chrom, atol=1e-5, rtol=0)
|
@@ -146,9 +148,17 @@ def test_periodic_symmetric_twiss_and_match():
|
|
146
148
|
tw_cell.rows[:'mid_cell'].bx_chrom, atol=1e-5, rtol=0)
|
147
149
|
xo.assert_allclose(tw_half_cell.by_chrom[:-1], # remove '_end_point'
|
148
150
|
tw_cell.rows[:'mid_cell'].by_chrom, atol=1e-5, rtol=0)
|
151
|
+
xo.assert_allclose(tw_half_cell.ddx[:-1], # remove '_end_point'
|
152
|
+
tw_cell.rows[:'mid_cell'].ddx, atol=1e-7, rtol=0)
|
149
153
|
|
150
154
|
xo.assert_allclose(tw_half_cell.qx, tw_cell.qx / 2, atol=1e-9, rtol=0)
|
151
155
|
xo.assert_allclose(tw_half_cell.qy, tw_cell.qy / 2, atol=1e-9, rtol=0)
|
152
156
|
xo.assert_allclose(tw_half_cell.dqx, tw_cell.dqx / 2, atol=1e-6, rtol=0)
|
153
157
|
xo.assert_allclose(tw_half_cell.dqy, tw_cell.dqy / 2, atol=1e-6, rtol=0)
|
154
158
|
|
159
|
+
tw_off_mom_cell = cell.twiss4d(strengths=True, delta0=1e-3)
|
160
|
+
tw_off_mom_half_cell = half_cell.twiss4d(
|
161
|
+
init='periodic_symmetric', strengths=True, delta0=1e-3)
|
162
|
+
|
163
|
+
xo.assert_allclose(tw_off_mom_half_cell.x[:-1],
|
164
|
+
tw_off_mom_cell.rows[:'mid_cell'].x, atol=1e-12, rtol=0)
|
@@ -236,6 +236,8 @@ def test_slice_thick_and_insert_with_replicas(test_context):
|
|
236
236
|
element_names=list(elements.keys()))
|
237
237
|
line.build_tracker(_context=test_context)
|
238
238
|
|
239
|
+
assert line['e2']._movable
|
240
|
+
|
239
241
|
element_no_repl={
|
240
242
|
'e0': xt.Bend(k0=0.3, h=0.31, length=1),
|
241
243
|
'e1': xt.Bend(k0=0.3, h=0.31, length=1),
|
@@ -275,18 +277,26 @@ def test_slice_thick_and_insert_with_replicas(test_context):
|
|
275
277
|
assert_allclose(p2.zeta, p1.zeta, rtol=0, atol=1e-14)
|
276
278
|
assert_allclose(p2.delta, p1.delta, rtol=0, atol=1e-14)
|
277
279
|
|
280
|
+
assert line['e2']._movable
|
281
|
+
# line['e2']._mark = True
|
282
|
+
|
278
283
|
line.slice_thick_elements(
|
279
284
|
slicing_strategies=[
|
280
285
|
xt.Strategy(None),
|
281
286
|
xt.Strategy(xt.Teapot(3, mode='thick'), name='e2|e3|e4')])
|
287
|
+
assert line['e2']._movable
|
282
288
|
line.build_tracker(_context=test_context)
|
283
289
|
|
290
|
+
assert line['e2']._movable
|
291
|
+
|
284
292
|
line_no_repl.slice_thick_elements(
|
285
293
|
slicing_strategies=[
|
286
294
|
xt.Strategy(None),
|
287
295
|
xt.Strategy(xt.Teapot(3, mode='thick'), name='e2|e3|e4')])
|
288
296
|
line_no_repl.build_tracker(_context=test_context)
|
289
297
|
|
298
|
+
assert line['e2']._movable
|
299
|
+
|
290
300
|
tt = line.get_table()
|
291
301
|
tt_no_repl = line_no_repl.get_table()
|
292
302
|
|
@@ -341,13 +351,17 @@ def test_slice_thick_and_insert_with_replicas(test_context):
|
|
341
351
|
assert_allclose(p2.zeta, p1.zeta, rtol=0, atol=1e-14)
|
342
352
|
assert_allclose(p2.delta, p1.delta, rtol=0, atol=1e-14)
|
343
353
|
|
354
|
+
assert line['e2']._movable
|
355
|
+
|
344
356
|
line.discard_tracker()
|
357
|
+
assert line['e2']._movable
|
345
358
|
line.insert_element(name='mkins1', element=xt.Marker(), at_s=0.5)
|
346
359
|
line.insert_element(name='mkins2', element=xt.Marker(), at_s=1.5)
|
347
360
|
line.insert_element(name='mkins3', element=xt.Marker(), at_s=2.5)
|
348
361
|
line.insert_element(name='mkins4', element=xt.Marker(), at_s=3.5)
|
349
362
|
line.insert_element(name='mkins5', element=xt.Marker(), at_s=4.5)
|
350
363
|
line.build_tracker(_context=test_context)
|
364
|
+
assert line['e2']._movable
|
351
365
|
|
352
366
|
line_no_repl.discard_tracker()
|
353
367
|
line_no_repl.insert_element(name='mkins1', element=xt.Marker(), at_s=0.5)
|
@@ -356,6 +370,7 @@ def test_slice_thick_and_insert_with_replicas(test_context):
|
|
356
370
|
line_no_repl.insert_element(name='mkins4', element=xt.Marker(), at_s=3.5)
|
357
371
|
line_no_repl.insert_element(name='mkins5', element=xt.Marker(), at_s=4.5)
|
358
372
|
line_no_repl.build_tracker(_context=test_context)
|
373
|
+
assert line['e2']._movable
|
359
374
|
|
360
375
|
tt = line.get_table()
|
361
376
|
tt_no_repl = line_no_repl.get_table()
|
@@ -428,6 +443,7 @@ def test_slice_thick_and_insert_with_replicas(test_context):
|
|
428
443
|
|
429
444
|
line.track(p1)
|
430
445
|
line_no_repl.track(p2)
|
446
|
+
assert line['e2']._movable
|
431
447
|
|
432
448
|
assert_allclose(p2.x, p1.x, rtol=0, atol=1e-14)
|
433
449
|
assert_allclose(p2.px, p1.px, rtol=0, atol=1e-14)
|
@@ -13,6 +13,7 @@ from .beam_elements import *
|
|
13
13
|
from .random import *
|
14
14
|
from .tracker_data import TrackerData
|
15
15
|
from .line import Line, Node, freeze_longitudinal, _temp_knobs, EnergyProgram
|
16
|
+
from .environment import Environment, Place
|
16
17
|
from .tracker import Tracker, Log
|
17
18
|
from .match import (Vary, Target, TargetList, VaryList, TargetInequality, Action,
|
18
19
|
TargetRelPhaseAdvance, TargetSet, GreaterThan, LessThan,
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.67.0'
|