xtrack 0.59.0__tar.gz → 0.60.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.59.0 → xtrack-0.60.0}/PKG-INFO +1 -1
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_attr_replicas_and_slices.py +1 -1
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_coasting.py +3 -2
- xtrack-0.60.0/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +402 -0
- xtrack-0.60.0/tests/test_hvkick.py +39 -0
- xtrack-0.60.0/tests/test_match_optics_and_ip_knob_new_optimize_api.py +724 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_prebuild_kernels.py +26 -10
- xtrack-0.60.0/tests/test_rotation_signs.py +24 -0
- xtrack-0.60.0/tests/test_trajectory_correcton.py +334 -0
- xtrack-0.59.0/tests/test_orbit_correction.py → xtrack-0.60.0/tests/test_xmask_orbit_correction.py +1 -1
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/__init__.py +1 -0
- xtrack-0.60.0/xtrack/_version.py +1 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements.py +2 -1
- xtrack-0.59.0/xtrack/beam_elements/elements_src/xrotation.h → xtrack-0.60.0/xtrack/beam_elements/elements_src/track_xrotation.h +7 -29
- xtrack-0.60.0/xtrack/beam_elements/elements_src/xrotation.h +27 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/line.py +129 -1
- xtrack-0.60.0/xtrack/trajectory_correction.py +648 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/twiss.py +57 -17
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/twissplot.py +10 -10
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack.egg-info/PKG-INFO +1 -1
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack.egg-info/SOURCES.txt +8 -1
- xtrack-0.59.0/xtrack/_version.py +0 -1
- {xtrack-0.59.0 → xtrack-0.60.0}/LICENSE +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/MANIFEST.in +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/README.md +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/base_classes.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/elements.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/line.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/particles.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/pyproject.toml +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/setup.cfg +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/setup.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_acceleration.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_apertures.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_collimation.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_element_characterization_functions.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_elements.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_elements_thick.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_footprint.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_full_rings.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_ions.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_line.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_lumi.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_mad_writer.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_madloader.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_match_nested.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_multiline.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_multisetter.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_multispecies.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_particles_api.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_pipeline.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_radial_steering.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_radiation.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_random_gen.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_rf_track.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_slice_and_insert_with_replicas.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_slice_elements.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_slicing.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_sps_thick.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_survey.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_tapering.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_tilt_shifts.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_tracker.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_twiss.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_var_cache.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/tests/test_vs_madx.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/base_element.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/fringe.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/fringe_track.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/wedge_track.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/slice_elements.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/footprint.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/general.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/headers/checks.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/headers/constants.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/internal_record.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/lumi.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/mad_loader.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/mad_writer.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/match.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/multiline/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/multiline/multiline.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/multiline/shared_knobs.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/particles/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/particles/constants.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/particles/particles.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/__init__.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/slicing.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/survey.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/synctime.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/tapering.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/targets.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/tracker.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/tracker_data.py +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.59.0 → xtrack-0.60.0}/xtrack.egg-info/top_level.txt +0 -0
@@ -1028,4 +1028,4 @@ def test_attr_thick_slicing(test_context, check_expr, use_copy):
|
|
1028
1028
|
assert_allclose(tt['k0sl', 'e6..entry_map'], 0, rtol=0, atol=1e-14)
|
1029
1029
|
assert_allclose(tt['k1sl', 'e6..entry_map'], 0, rtol=0, atol=1e-14)
|
1030
1030
|
assert_allclose(tt['k2sl', 'e6..entry_map'], 0, rtol=0, atol=1e-14)
|
1031
|
-
assert_allclose(tt['k3sl', 'e6..entry_map'], 0, rtol=0, atol=1e-14)
|
1031
|
+
assert_allclose(tt['k3sl', 'e6..entry_map'], 0, rtol=0, atol=1e-14)
|
@@ -125,7 +125,8 @@ def test_coasting():
|
|
125
125
|
t_range_size = z_range_size / (tw.beta0 * clight)
|
126
126
|
|
127
127
|
import nafflib
|
128
|
-
|
128
|
+
intensity_no_ave = intensity_vs_t - np.mean(intensity_vs_t)
|
129
|
+
f_harmons = nafflib.get_tunes(intensity_no_ave, N=50)[0] / (t_unwrapped[1] - t_unwrapped[0])
|
129
130
|
f_nominal = 1 / tw.T_rev0
|
130
131
|
dt_expected = -(twom.zeta[-1] - twom.zeta[0]) / tw.beta0 / clight
|
131
132
|
f_expected = 1 / (tw.T_rev0 + dt_expected)
|
@@ -137,7 +138,7 @@ def test_coasting():
|
|
137
138
|
print('f_measured: ', f_measured, ' Hz')
|
138
139
|
print('Error: ', f_measured - f_expected, 'Hz')
|
139
140
|
|
140
|
-
assert np.isclose(f_expected, f_measured, rtol=0, atol=
|
141
|
+
assert np.isclose(f_expected, f_measured, rtol=0, atol=5.) # 5 Hz tolerance (to account for random fluctuations)
|
141
142
|
assert np.isclose(np.mean(inten), inten_exp, rtol=1e-2, atol=0)
|
142
143
|
assert np.allclose(p.at_turn, num_turns*0.9, rtol=3e-2, atol=0) #beta1 defaults to 0.1
|
143
144
|
|
@@ -0,0 +1,402 @@
|
|
1
|
+
import numpy as np
|
2
|
+
import xtrack as xt
|
3
|
+
from scipy.constants import c as clight
|
4
|
+
from scipy.constants import e as qe
|
5
|
+
import pathlib
|
6
|
+
|
7
|
+
from cpymad.madx import Madx
|
8
|
+
|
9
|
+
|
10
|
+
test_data_folder = pathlib.Path(
|
11
|
+
__file__).parent.joinpath('../test_data').absolute()
|
12
|
+
|
13
|
+
|
14
|
+
def test_fcc_ee_solenoid_correction_new_optimizer_api():
|
15
|
+
fname = 'fccee_t'; pc_gev = 182.5
|
16
|
+
|
17
|
+
mad = Madx(stdout=False)
|
18
|
+
mad.call(str(test_data_folder) + '/fcc_ee/' + fname + '.seq')
|
19
|
+
mad.beam(particle='positron', pc=pc_gev)
|
20
|
+
mad.use('fccee_p_ring')
|
21
|
+
|
22
|
+
line = xt.Line.from_madx_sequence(mad.sequence.fccee_p_ring, allow_thick=True,
|
23
|
+
deferred_expressions=True)
|
24
|
+
line.particle_ref = xt.Particles(mass0=xt.ELECTRON_MASS_EV,
|
25
|
+
gamma0=mad.sequence.fccee_p_ring.beam.gamma)
|
26
|
+
line.cycle('ip.4', inplace=True)
|
27
|
+
line.append_element(element=xt.Marker(), name='ip.4.l')
|
28
|
+
|
29
|
+
tt = line.get_table()
|
30
|
+
bz_data_file = test_data_folder / 'fcc_ee/Bz_closed_before_quads.dat'
|
31
|
+
|
32
|
+
line.vars['voltca1_ref'] = line.vv['voltca1']
|
33
|
+
if 'voltca2' in line.vars.keys():
|
34
|
+
line.vars['voltca2_ref'] = line.vv['voltca2']
|
35
|
+
else:
|
36
|
+
line.vars['voltca2_ref'] = 0
|
37
|
+
|
38
|
+
line.vars['voltca1'] = 0
|
39
|
+
line.vars['voltca2'] = 0
|
40
|
+
|
41
|
+
import pandas as pd
|
42
|
+
bz_df = pd.read_csv(bz_data_file, sep=r'\s+', skiprows=1, names=['z', 'Bz'])
|
43
|
+
|
44
|
+
l_solenoid = 4.4
|
45
|
+
ds_sol_start = -l_solenoid / 2 * np.cos(15e-3)
|
46
|
+
ds_sol_end = +l_solenoid / 2 * np.cos(15e-3)
|
47
|
+
ip_sol = 'ip.1'
|
48
|
+
|
49
|
+
theta_tilt = 15e-3 # rad
|
50
|
+
l_beam = 4.4
|
51
|
+
l_solenoid = l_beam * np.cos(theta_tilt)
|
52
|
+
ds_sol_start = -l_beam / 2
|
53
|
+
ds_sol_end = +l_beam / 2
|
54
|
+
ip_sol = 'ip.1'
|
55
|
+
|
56
|
+
s_sol_slices = np.linspace(-l_solenoid/2, l_solenoid/2, 1001)
|
57
|
+
bz_sol_slices = np.interp(s_sol_slices, bz_df.z, bz_df.Bz)
|
58
|
+
bz_sol_slices[0] = 0
|
59
|
+
bz_sol_slices[-1] = 0
|
60
|
+
|
61
|
+
P0_J = line.particle_ref.p0c[0] * qe / clight
|
62
|
+
brho = P0_J / qe / line.particle_ref.q0
|
63
|
+
ks = 0.5 * (bz_sol_slices[:-1] + bz_sol_slices[1:]) / brho
|
64
|
+
l_sol_slices = np.diff(s_sol_slices)
|
65
|
+
s_sol_slices_entry = s_sol_slices[:-1]
|
66
|
+
|
67
|
+
sol_slices = []
|
68
|
+
for ii in range(len(s_sol_slices_entry)):
|
69
|
+
sol_slices.append(xt.Solenoid(length=l_sol_slices[ii], ks=0)) # Off for now
|
70
|
+
|
71
|
+
s_ip = tt['s', ip_sol]
|
72
|
+
|
73
|
+
line.discard_tracker()
|
74
|
+
line.insert_element(name='sol_start_'+ip_sol, element=xt.Marker(),
|
75
|
+
at_s=s_ip + ds_sol_start)
|
76
|
+
line.insert_element(name='sol_end_'+ip_sol, element=xt.Marker(),
|
77
|
+
at_s=s_ip + ds_sol_end)
|
78
|
+
|
79
|
+
sol_start_tilt = xt.YRotation(angle=-theta_tilt * 180 / np.pi)
|
80
|
+
sol_end_tilt = xt.YRotation(angle=+theta_tilt * 180 / np.pi)
|
81
|
+
sol_start_shift = xt.XYShift(dx=l_solenoid/2 * np.tan(theta_tilt))
|
82
|
+
sol_end_shift = xt.XYShift(dx=l_solenoid/2 * np.tan(theta_tilt))
|
83
|
+
|
84
|
+
line.element_dict['sol_start_tilt_'+ip_sol] = sol_start_tilt
|
85
|
+
line.element_dict['sol_end_tilt_'+ip_sol] = sol_end_tilt
|
86
|
+
line.element_dict['sol_start_shift_'+ip_sol] = sol_start_shift
|
87
|
+
line.element_dict['sol_end_shift_'+ip_sol] = sol_end_shift
|
88
|
+
|
89
|
+
line.element_dict['sol_entry_'+ip_sol] = xt.Solenoid(length=0, ks=0)
|
90
|
+
line.element_dict['sol_exit_'+ip_sol] = xt.Solenoid(length=0, ks=0)
|
91
|
+
|
92
|
+
sol_slice_names = []
|
93
|
+
sol_slice_names.append('sol_entry_'+ip_sol)
|
94
|
+
for ii in range(len(s_sol_slices_entry)):
|
95
|
+
nn = f'sol_slice_{ii}_{ip_sol}'
|
96
|
+
line.element_dict[nn] = sol_slices[ii]
|
97
|
+
sol_slice_names.append(nn)
|
98
|
+
sol_slice_names.append('sol_exit_'+ip_sol)
|
99
|
+
|
100
|
+
tt = line.get_table()
|
101
|
+
names_upstream = list(tt.rows[:'sol_start_'+ip_sol].name)
|
102
|
+
names_downstream = list(tt.rows['sol_end_'+ip_sol:].name[:-1]) # -1 to exclude '_end_point' added by the table
|
103
|
+
|
104
|
+
element_names = (names_upstream
|
105
|
+
+ ['sol_start_tilt_'+ip_sol, 'sol_start_shift_'+ip_sol]
|
106
|
+
+ sol_slice_names
|
107
|
+
+ ['sol_end_shift_'+ip_sol, 'sol_end_tilt_'+ip_sol]
|
108
|
+
+ names_downstream)
|
109
|
+
|
110
|
+
line.element_names = element_names
|
111
|
+
|
112
|
+
# re-insert the ip
|
113
|
+
line.element_dict.pop(ip_sol)
|
114
|
+
tt = line.get_table()
|
115
|
+
line.insert_element(name=ip_sol, element=xt.Marker(),
|
116
|
+
at_s = 0.5 * (tt['s', 'sol_start_'+ip_sol] + tt['s', 'sol_end_'+ip_sol]))
|
117
|
+
|
118
|
+
line.vars['on_corr_ip.1'] = 0
|
119
|
+
|
120
|
+
line.build_tracker()
|
121
|
+
|
122
|
+
# Set strength
|
123
|
+
line.vars['on_sol_'+ip_sol] = 0
|
124
|
+
for ii in range(len(s_sol_slices_entry)):
|
125
|
+
nn = f'sol_slice_{ii}_{ip_sol}'
|
126
|
+
line.element_refs[nn].ks = ks[ii] * line.vars['on_sol_'+ip_sol]
|
127
|
+
|
128
|
+
tt = line.get_table()
|
129
|
+
|
130
|
+
tt.rows['sol_start_ip.1':'sol_end_ip.1'].show()
|
131
|
+
|
132
|
+
line.vars['on_corr_ip.1'] = 1
|
133
|
+
line.vars['ks0.r1'] = 0
|
134
|
+
line.vars['ks1.r1'] = 0
|
135
|
+
line.vars['ks2.r1'] = 0
|
136
|
+
line.vars['ks3.r1'] = 0
|
137
|
+
line.vars['ks4.r1'] = 0
|
138
|
+
line.vars['ks0.l1'] = 0
|
139
|
+
line.vars['ks1.l1'] = 0
|
140
|
+
line.vars['ks2.l1'] = 0
|
141
|
+
line.vars['ks3.l1'] = 0
|
142
|
+
line.vars['ks4.l1'] = 0
|
143
|
+
|
144
|
+
line.element_refs['qc1r1.1'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks0.r1']
|
145
|
+
line.element_refs['qc2r1.1'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks1.r1']
|
146
|
+
line.element_refs['qc2r2.1'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks2.r1']
|
147
|
+
line.element_refs['qc1r2.1'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks3.r1']
|
148
|
+
line.element_refs['qc1l1.4'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks0.l1']
|
149
|
+
line.element_refs['qc2l1.4'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks1.l1']
|
150
|
+
line.element_refs['qc2l2.4'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks2.l1']
|
151
|
+
line.element_refs['qc1l2.4'].k1s = line.vars['on_corr_ip.1'] * line.vars['ks3.l1']
|
152
|
+
|
153
|
+
line.vars['corr_k0.r1'] = 0
|
154
|
+
line.vars['corr_k1.r1'] = 0
|
155
|
+
line.vars['corr_k2.r1'] = 0
|
156
|
+
line.vars['corr_k3.r1'] = 0
|
157
|
+
line.vars['corr_k4.r1'] = 0
|
158
|
+
line.vars['corr_k0.l1'] = 0
|
159
|
+
line.vars['corr_k1.l1'] = 0
|
160
|
+
line.vars['corr_k2.l1'] = 0
|
161
|
+
line.vars['corr_k3.l1'] = 0
|
162
|
+
line.vars['corr_k4.l1'] = 0
|
163
|
+
|
164
|
+
line.element_refs['qc1r1.1'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k0.r1']
|
165
|
+
line.element_refs['qc2r1.1'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k1.r1']
|
166
|
+
line.element_refs['qc2r2.1'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k2.r1']
|
167
|
+
line.element_refs['qc1r2.1'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k3.r1']
|
168
|
+
line.element_refs['qc1l1.4'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k0.l1']
|
169
|
+
line.element_refs['qc2l1.4'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k1.l1']
|
170
|
+
line.element_refs['qc2l2.4'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k2.l1']
|
171
|
+
line.element_refs['qc1l2.4'].k1 += line.vars['on_corr_ip.1'] * line.vars['corr_k3.l1']
|
172
|
+
|
173
|
+
|
174
|
+
Strategy = xt.Strategy
|
175
|
+
Teapot = xt.Teapot
|
176
|
+
slicing_strategies = [
|
177
|
+
Strategy(slicing=None), # Default catch-all as in MAD-X
|
178
|
+
Strategy(slicing=Teapot(3), element_type=xt.Bend),
|
179
|
+
Strategy(slicing=Teapot(3), element_type=xt.CombinedFunctionMagnet),
|
180
|
+
# Strategy(slicing=Teapot(50), element_type=xt.Quadrupole), # Starting point
|
181
|
+
Strategy(slicing=Teapot(5), name=r'^qf.*'),
|
182
|
+
Strategy(slicing=Teapot(5), name=r'^qd.*'),
|
183
|
+
Strategy(slicing=Teapot(5), name=r'^qfg.*'),
|
184
|
+
Strategy(slicing=Teapot(5), name=r'^qdg.*'),
|
185
|
+
Strategy(slicing=Teapot(5), name=r'^ql.*'),
|
186
|
+
Strategy(slicing=Teapot(5), name=r'^qs.*'),
|
187
|
+
Strategy(slicing=Teapot(10), name=r'^qb.*'),
|
188
|
+
Strategy(slicing=Teapot(10), name=r'^qg.*'),
|
189
|
+
Strategy(slicing=Teapot(10), name=r'^qh.*'),
|
190
|
+
Strategy(slicing=Teapot(10), name=r'^qi.*'),
|
191
|
+
Strategy(slicing=Teapot(10), name=r'^qr.*'),
|
192
|
+
Strategy(slicing=Teapot(10), name=r'^qu.*'),
|
193
|
+
Strategy(slicing=Teapot(10), name=r'^qy.*'),
|
194
|
+
Strategy(slicing=Teapot(50), name=r'^qa.*'),
|
195
|
+
Strategy(slicing=Teapot(50), name=r'^qc.*'),
|
196
|
+
Strategy(slicing=Teapot(20), name=r'^sy\..*'),
|
197
|
+
Strategy(slicing=Teapot(30), name=r'^mwi\..*'),
|
198
|
+
]
|
199
|
+
line.discard_tracker()
|
200
|
+
line.slice_thick_elements(slicing_strategies=slicing_strategies)
|
201
|
+
|
202
|
+
# Add dipole correctors
|
203
|
+
line.insert_element(name='mcb1.r1', element=xt.Multipole(knl=[0]),
|
204
|
+
at='qc1r1.1_exit')
|
205
|
+
line.insert_element(name='mcb2.r1', element=xt.Multipole(knl=[0]),
|
206
|
+
at='qc1r2.1_exit')
|
207
|
+
line.insert_element(name='mcb1.l1', element=xt.Multipole(knl=[0]),
|
208
|
+
at='qc1l1.4_entry')
|
209
|
+
line.insert_element(name='mcb2.l1', element=xt.Multipole(knl=[0]),
|
210
|
+
at='qc1l2.4_entry')
|
211
|
+
|
212
|
+
line.vars['acb1h.r1'] = 0
|
213
|
+
line.vars['acb1v.r1'] = 0
|
214
|
+
line.vars['acb2h.r1'] = 0
|
215
|
+
line.vars['acb2v.r1'] = 0
|
216
|
+
line.vars['acb1h.l1'] = 0
|
217
|
+
line.vars['acb1v.l1'] = 0
|
218
|
+
line.vars['acb2h.l1'] = 0
|
219
|
+
line.vars['acb2v.l1'] = 0
|
220
|
+
|
221
|
+
line.element_refs['mcb1.r1'].knl[0] = line.vars['on_corr_ip.1']*line.vars['acb1h.r1']
|
222
|
+
line.element_refs['mcb2.r1'].knl[0] = line.vars['on_corr_ip.1']*line.vars['acb2h.r1']
|
223
|
+
line.element_refs['mcb1.r1'].ksl[0] = line.vars['on_corr_ip.1']*line.vars['acb1v.r1']
|
224
|
+
line.element_refs['mcb2.r1'].ksl[0] = line.vars['on_corr_ip.1']*line.vars['acb2v.r1']
|
225
|
+
line.element_refs['mcb1.l1'].knl[0] = line.vars['on_corr_ip.1']*line.vars['acb1h.l1']
|
226
|
+
line.element_refs['mcb2.l1'].knl[0] = line.vars['on_corr_ip.1']*line.vars['acb2h.l1']
|
227
|
+
line.element_refs['mcb1.l1'].ksl[0] = line.vars['on_corr_ip.1']*line.vars['acb1v.l1']
|
228
|
+
line.element_refs['mcb2.l1'].ksl[0] = line.vars['on_corr_ip.1']*line.vars['acb2v.l1']
|
229
|
+
|
230
|
+
tw_thick_no_rad = line.twiss(method='4d')
|
231
|
+
|
232
|
+
assert line.element_names[-1] == 'ip.4.l'
|
233
|
+
assert line.element_names[0] == 'ip.4'
|
234
|
+
|
235
|
+
opt = line.match(
|
236
|
+
method='4d',
|
237
|
+
start='ip.4', end='ip.4.l',
|
238
|
+
init=tw_thick_no_rad,
|
239
|
+
vary=xt.VaryList(['k1qf4', 'k1qf2', 'k1qd3', 'k1qd1',], step=1e-8,
|
240
|
+
),
|
241
|
+
targets=[
|
242
|
+
xt.TargetSet(at=xt.END, mux=tw_thick_no_rad.qx, muy=tw_thick_no_rad.qy, tol=1e-5),
|
243
|
+
]
|
244
|
+
)
|
245
|
+
opt.solve()
|
246
|
+
|
247
|
+
line.vars['on_sol_ip.1'] = 0
|
248
|
+
tw_sol_off = line.twiss(method='4d')
|
249
|
+
line.vars['on_sol_ip.1'] = 1
|
250
|
+
tw_sol_on = line.twiss(method='4d')
|
251
|
+
|
252
|
+
opt_l = line.match(
|
253
|
+
solve=False,
|
254
|
+
method='4d', n_steps_max=30,
|
255
|
+
start='pqc2le.4', end='ip.1', init=tw_sol_off, init_at=xt.START,
|
256
|
+
vary=[
|
257
|
+
xt.VaryList(['acb1h.l1', 'acb2h.l1','acb1v.l1', 'acb2v.l1'], step=1e-8, tag='corr_l'),
|
258
|
+
xt.VaryList(['ks1.l1', 'ks2.l1', 'ks3.l1', 'ks0.l1'], step=1e-7, tag='skew_l'),
|
259
|
+
xt.VaryList(['corr_k1.l1', 'corr_k2.l1', 'corr_k3.l1', 'corr_k0.l1'], step=1e-6, tag='normal_l'),
|
260
|
+
],
|
261
|
+
targets=[
|
262
|
+
xt.TargetSet(['x', 'y'], value=tw_sol_off, tol=1e-7, at='ip.1', tag='orbit'),
|
263
|
+
xt.TargetSet(['px', 'py'], value=tw_sol_off, tol=1e-10, at='ip.1', tag='orbit'),
|
264
|
+
xt.TargetRmatrix(
|
265
|
+
r13=0, r14=0, r23=0, r24=0, # Y-X block
|
266
|
+
r31=0, r32=0, r41=0, r42=0, # X-Y block,
|
267
|
+
start='pqc2le.4', end='ip.1', tol=1e-6, tag='coupl'),
|
268
|
+
xt.Target('mux', value=tw_sol_off, at='ip.1', tag='mu_ip', weight=0.1, tol=1e-6),
|
269
|
+
xt.Target('muy', value=tw_sol_off, at='ip.1', tag='mu_ip', weight=0.1, tol=1e-6),
|
270
|
+
xt.Target('betx', value=tw_sol_off, at='ip.1', tag='bet_ip', weight=1, tol=1e-5),
|
271
|
+
xt.Target('bety', value=tw_sol_off, at='ip.1', tag='bet_ip', weight=10, tol=1e-6),
|
272
|
+
xt.Target('alfx', value=tw_sol_off, at='ip.1', tag='alf_ip', weight=0.1, tol=1e-4),
|
273
|
+
xt.Target('alfy', value=tw_sol_off, at='ip.1', tag='alf_ip', weight=0.1, tol=1e-4),
|
274
|
+
|
275
|
+
]
|
276
|
+
)
|
277
|
+
|
278
|
+
|
279
|
+
for iter in range(2):
|
280
|
+
# Orbit alone
|
281
|
+
opt_l.disable(target=True); opt_l.disable(vary=True)
|
282
|
+
opt_l.enable(target='orbit'); opt_l.enable(vary='corr_l'); opt_l.solve()
|
283
|
+
|
284
|
+
# Coupling alone
|
285
|
+
opt_l.disable(target=True); opt_l.disable(vary=True)
|
286
|
+
opt_l.enable(target='coupl'); opt_l.enable(vary='skew_l'); opt_l.solve()
|
287
|
+
|
288
|
+
# phase, beta and alpha alone
|
289
|
+
opt_l.disable(target=True); opt_l.disable(vary=True)
|
290
|
+
opt_l.enable(vary='normal_l')
|
291
|
+
opt_l.enable(target='mu_ip'); opt_l.solve()
|
292
|
+
opt_l.enable(target='bet_ip'); opt_l.solve()
|
293
|
+
opt_l.enable(target='alf_ip'); opt_l.solve()
|
294
|
+
|
295
|
+
# All together
|
296
|
+
opt_l.enable(target=True)
|
297
|
+
opt_l.enable(vary=True)
|
298
|
+
opt_l.solve()
|
299
|
+
|
300
|
+
|
301
|
+
opt_r = line.match(
|
302
|
+
solve=False,
|
303
|
+
method='4d', n_steps_max=30,
|
304
|
+
start='ip.1', end='pqc2re.1', init=tw_sol_off, init_at=xt.END,
|
305
|
+
vary=[
|
306
|
+
xt.VaryList(['acb1h.r1', 'acb2h.r1','acb1v.r1', 'acb2v.r1'], step=1e-8, tag='corr_r'),
|
307
|
+
xt.VaryList(['ks1.r1', 'ks2.r1', 'ks3.r1', 'ks0.r1'], step=1e-7, tag='skew_r'),
|
308
|
+
xt.VaryList(['corr_k1.r1', 'corr_k2.r1', 'corr_k3.r1', 'corr_k0.r1'], step=1e-6, tag='normal_r'),
|
309
|
+
],
|
310
|
+
targets=[
|
311
|
+
xt.TargetSet(['x', 'y'], value=tw_sol_off, tol=1e-7, at='ip.1', tag='orbit'),
|
312
|
+
xt.TargetSet(['px', 'py'], value=tw_sol_off, tol=1e-10, at='ip.1', tag='orbit'),
|
313
|
+
xt.TargetRmatrix(r13=0, r14=0, r23=0, r24=0, # Y-X block
|
314
|
+
r31=0, r32=0, r41=0, r42=0, # X-Y block,
|
315
|
+
start='ip.1', end='pqc2re.1', tol=1e-6, tag='coupl'),
|
316
|
+
xt.Target('mux', value=tw_sol_off, at='ip.1', tag='mu_ip', weight=0.1, tol=1e-6),
|
317
|
+
xt.Target('muy', value=tw_sol_off, at='ip.1', tag='mu_ip', weight=0.1, tol=1e-6),
|
318
|
+
xt.Target('betx', value=tw_sol_off, at='ip.1', tag='bet_ip', weight=1, tol=1e-5),
|
319
|
+
xt.Target('bety', value=tw_sol_off, at='ip.1', tag='bet_ip', weight=10, tol=1e-6),
|
320
|
+
xt.Target('alfx', value=tw_sol_off, at='ip.1', tag='alf_ip', weight=0.1, tol=1e-4),
|
321
|
+
xt.Target('alfy', value=tw_sol_off, at='ip.1', tag='alf_ip', weight=0.1, tol=1e-4),
|
322
|
+
|
323
|
+
]
|
324
|
+
)
|
325
|
+
|
326
|
+
for iter in range(2):
|
327
|
+
# Orbit alone
|
328
|
+
opt_r.disable(target=True); opt_r.disable(vary=True)
|
329
|
+
opt_r.enable(target='orbit'); opt_r.enable(vary='corr_r'); opt_r.solve()
|
330
|
+
|
331
|
+
# Coupling alone
|
332
|
+
opt_r.disable(target=True); opt_r.disable(vary=True)
|
333
|
+
opt_r.enable(target='coupl'); opt_r.enable(vary='skew_r'); opt_r.solve()
|
334
|
+
|
335
|
+
# phase, beta and alpha alone
|
336
|
+
opt_r.disable(target=True); opt_r.disable(vary=True)
|
337
|
+
opt_r.enable(vary='normal_r')
|
338
|
+
opt_r.enable(target='mu_ip'); opt_r.solve()
|
339
|
+
opt_r.enable(target='bet_ip'); opt_r.solve()
|
340
|
+
opt_r.enable(target='alf_ip'); opt_r.solve()
|
341
|
+
|
342
|
+
# All together
|
343
|
+
opt_r.enable(target=True)
|
344
|
+
opt_r.enable(vary=True)
|
345
|
+
opt_r.solve()
|
346
|
+
|
347
|
+
line.to_json(fname + '_with_sol_corrected.json')
|
348
|
+
|
349
|
+
tw_sol_on_corrected = line.twiss(method='4d')
|
350
|
+
|
351
|
+
assert_allclose = np.testing.assert_allclose
|
352
|
+
|
353
|
+
# Check that tilt is present
|
354
|
+
assert_allclose(tw_sol_off['kin_xprime', 'ip.1'], np.tan(0.015), atol=1e-14, rtol=0)
|
355
|
+
|
356
|
+
# Check that solenoid introduces coupling
|
357
|
+
assert tw_sol_on.c_minus > 1e-4
|
358
|
+
|
359
|
+
# Check correction
|
360
|
+
tw_chk = tw_sol_on_corrected
|
361
|
+
|
362
|
+
assert_allclose(tw_chk['x', 'ip.1'], 0, atol=1e-8, rtol=0)
|
363
|
+
assert_allclose(tw_chk['y', 'ip.1'], 0, atol=1e-10, rtol=0)
|
364
|
+
assert_allclose(tw_chk['kin_xprime', 'ip.1'], tw_sol_off['kin_xprime', 'ip.1'], atol=1e-9, rtol=0)
|
365
|
+
assert_allclose(tw_chk['kin_yprime', 'ip.1'], 0, atol=1e-8, rtol=0)
|
366
|
+
assert_allclose(tw_chk['x', 'pqc2re.1'], 0, atol=5e-8, rtol=0)
|
367
|
+
assert_allclose(tw_chk['y', 'pqc2re.1'], 0, atol=5e-8, rtol=0)
|
368
|
+
assert_allclose(tw_chk['kin_xprime', 'pqc2re.1'], 0, atol=1e-8, rtol=0)
|
369
|
+
assert_allclose(tw_chk['kin_yprime', 'pqc2re.1'], 0, atol=1e-8, rtol=0)
|
370
|
+
assert_allclose(tw_chk['x', 'pqc2le.4'], 0, atol=5e-8, rtol=0)
|
371
|
+
assert_allclose(tw_chk['y', 'pqc2le.4'], 0, atol=5e-8, rtol=0)
|
372
|
+
assert_allclose(tw_chk['kin_xprime', 'pqc2le.4'], 0, atol=1e-8, rtol=0)
|
373
|
+
assert_allclose(tw_chk['kin_yprime', 'pqc2le.4'], 0, atol=1e-8, rtol=0)
|
374
|
+
|
375
|
+
assert_allclose(tw_chk['betx', 'ip.1'], tw_sol_off['betx', 'ip.1'], atol=0, rtol=5e-5)
|
376
|
+
assert_allclose(tw_chk['bety', 'ip.1'], tw_sol_off['bety', 'ip.1'], atol=0, rtol=5e-5)
|
377
|
+
assert_allclose(tw_chk['alfx', 'ip.1'], tw_sol_off['alfx', 'ip.1'], atol=1e-5, rtol=0)
|
378
|
+
assert_allclose(tw_chk['alfy', 'ip.1'], tw_sol_off['alfy', 'ip.1'], atol=1e-5, rtol=0)
|
379
|
+
assert_allclose(tw_chk['mux', 'ip.1'], tw_sol_off['mux', 'ip.1'], atol=2e-6, rtol=0)
|
380
|
+
assert_allclose(tw_chk['muy', 'ip.1'], tw_sol_off['muy', 'ip.1'], atol=2e-6, rtol=0)
|
381
|
+
|
382
|
+
assert_allclose(tw_chk['betx', 'pqc2re.1'], tw_sol_off['betx', 'pqc2re.1'], atol=0, rtol=5e-5)
|
383
|
+
assert_allclose(tw_chk['bety', 'pqc2re.1'], tw_sol_off['bety', 'pqc2re.1'], atol=0, rtol=5e-5)
|
384
|
+
assert_allclose(tw_chk['alfx', 'pqc2re.1'], tw_sol_off['alfx', 'pqc2re.1'], atol=1e-5, rtol=5e-5)
|
385
|
+
assert_allclose(tw_chk['alfy', 'pqc2re.1'], tw_sol_off['alfy', 'pqc2re.1'], atol=1e-5, rtol=5e-5)
|
386
|
+
assert_allclose(tw_chk['mux', 'pqc2re.1'], tw_sol_off['mux', 'pqc2re.1'], atol=2e-6, rtol=5e-5)
|
387
|
+
assert_allclose(tw_chk['muy', 'pqc2re.1'], tw_sol_off['muy', 'pqc2re.1'], atol=2e-6, rtol=5e-5)
|
388
|
+
|
389
|
+
assert_allclose(tw_chk['betx', 'pqc2le.4'], tw_sol_off['betx', 'pqc2le.4'], atol=0, rtol=5e-5)
|
390
|
+
assert_allclose(tw_chk['bety', 'pqc2le.4'], tw_sol_off['bety', 'pqc2le.4'], atol=0, rtol=5e-5)
|
391
|
+
assert_allclose(tw_chk['alfx', 'pqc2le.4'], tw_sol_off['alfx', 'pqc2le.4'], atol=1e-5, rtol=5e-5)
|
392
|
+
assert_allclose(tw_chk['alfy', 'pqc2le.4'], tw_sol_off['alfy', 'pqc2le.4'], atol=1e-5, rtol=5e-5)
|
393
|
+
assert_allclose(tw_chk['mux', 'pqc2le.4'], tw_sol_off['mux', 'pqc2le.4'], atol=2e-6, rtol=5e-5)
|
394
|
+
assert_allclose(tw_chk['muy', 'pqc2le.4'], tw_sol_off['muy', 'pqc2le.4'], atol=2e-6, rtol=5e-5)
|
395
|
+
|
396
|
+
assert tw_chk.c_minus < 1e-6
|
397
|
+
assert_allclose(tw_chk['betx2', 'ip.1'] / tw_chk['betx', 'ip.1'], 0, atol=1e-10)
|
398
|
+
assert_allclose(tw_chk['bety1', 'ip.1'] / tw_chk['bety', 'ip.1'], 0, atol=1e-10)
|
399
|
+
assert_allclose(tw_chk['betx2', 'pqc2re.1'] / tw_chk['betx', 'pqc2re.1'], 0, atol=1e-10)
|
400
|
+
assert_allclose(tw_chk['bety1', 'pqc2re.1'] / tw_chk['bety', 'pqc2re.1'], 0, atol=1e-10)
|
401
|
+
assert_allclose(tw_chk['betx2', 'pqc2le.4'] / tw_chk['betx', 'pqc2le.4'], 0, atol=1e-10)
|
402
|
+
assert_allclose(tw_chk['bety1', 'pqc2le.4'] / tw_chk['bety', 'pqc2le.4'], 0, atol=1e-10)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
def test_hvkick():
|
2
|
+
import xtrack as xt
|
3
|
+
from cpymad.madx import Madx
|
4
|
+
|
5
|
+
# Load a very simple sequence from MAD-X
|
6
|
+
mad = Madx()
|
7
|
+
mad.input("""
|
8
|
+
seq: sequence, l=4;
|
9
|
+
b1: sbend, at=0.5, angle=0.2, l=1;
|
10
|
+
b2: sbend, at=2.5, angle=0.3, k0=0.15, l=1;
|
11
|
+
m1: multipole, at=3, knl={0.1};
|
12
|
+
k1: kicker, at=3, hkick=0.3, vkick=0.4;
|
13
|
+
endsequence;
|
14
|
+
beam;
|
15
|
+
use,sequence=seq;
|
16
|
+
""")
|
17
|
+
|
18
|
+
line = xt.Line.from_madx_sequence(mad.sequence.seq)
|
19
|
+
line.build_tracker()
|
20
|
+
|
21
|
+
print('The line as imported from MAD-X:')
|
22
|
+
line.get_table().show()
|
23
|
+
|
24
|
+
# Shift and tilt selected elements
|
25
|
+
line['b1'].rot_s_rad = 0.8
|
26
|
+
line['b2'].rot_s_rad = -0.8
|
27
|
+
|
28
|
+
tt = line.get_table(attr=True)
|
29
|
+
tt.cols['s', 'element_type', 'angle_rad', 'rot_s_rad', 'k0l', 'k0sl', 'hkick', 'vkick']
|
30
|
+
|
31
|
+
assert tt['hkick','k1']==0.3
|
32
|
+
assert tt['vkick','k1']==0.4
|
33
|
+
assert tt['hkick','m1']==0
|
34
|
+
assert tt['vkick','m1']==0
|
35
|
+
assert tt['hkick','b1']==0
|
36
|
+
assert tt['vkick','b1']==0
|
37
|
+
assert tt['hkick','b2']==0.15
|
38
|
+
assert tt['vkick','b2']==0
|
39
|
+
|