xtrack 0.57.0__tar.gz → 0.57.2__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.57.0 → xtrack-0.57.2}/PKG-INFO +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_element_characterization_functions.py +7 -7
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_fcc_ee_solenoid_correction.py +7 -12
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_line.py +27 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_radiation.py +1 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_tracker.py +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/__init__.py +1 -1
- xtrack-0.57.2/xtrack/_version.py +1 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/base_element.py +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements.py +6 -6
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/slice_elements_thick.py +5 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/line.py +80 -17
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/loss_location_refinement/loss_location_refinement.py +3 -3
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/beam_position_monitor.py +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/beam_profile_monitor.py +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/beam_size_monitor.py +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/last_turns_monitor.py +1 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/particles_monitor.py +2 -2
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/particles/particles.py +41 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/prebuilt_kernels/kernel_definitions.py +1 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/tracker.py +8 -3
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/twiss.py +86 -9
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack.egg-info/PKG-INFO +1 -1
- xtrack-0.57.0/xtrack/_version.py +0 -1
- {xtrack-0.57.0 → xtrack-0.57.2}/LICENSE +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/MANIFEST.in +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/README.md +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/base_classes.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/elements.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/line.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/particles.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/pyproject.toml +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/setup.cfg +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/setup.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_acceleration.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_apertures.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_attr_replicas_and_slices.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_coasting.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_collimation.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_elements.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_elements_thick.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_footprint.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_full_rings.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_ions.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_lumi.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_mad_writer.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_madloader.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_match_nested.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_monitor.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_multiline.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_multisetter.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_multispecies.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_orbit_correction.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_particles_api.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_pipeline.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_prebuild_kernels.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_radial_steering.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_random_gen.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_rf_track.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_slice_and_insert_with_replicas.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_slice_elements.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_slicing.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_sps_thick.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_survey.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_tapering.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_tilt_shifts.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_twiss.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_var_cache.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/tests/test_vs_madx.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/fringe.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/fringe_track.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/wedge_track.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/beam_elements/slice_elements.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/footprint.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/general.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/headers/checks.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/headers/constants.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/internal_record.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/lumi.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/mad_loader.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/mad_writer.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/match.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/multiline/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/multiline/multiline.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/multiline/shared_knobs.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/particles/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/particles/constants.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/prebuild_kernels.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/prebuilt_kernels/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/__init__.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/slicing.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/survey.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/synctime.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/tapering.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/targets.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/tracker_data.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack/twissplot.py +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack.egg-info/SOURCES.txt +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.57.0 → xtrack-0.57.2}/xtrack.egg-info/top_level.txt +0 -0
@@ -41,7 +41,7 @@ def test_has_backtrack(test_context):
|
|
41
41
|
line.build_tracker(_context=test_context)
|
42
42
|
|
43
43
|
_has_backtrack = xt.line._has_backtrack
|
44
|
-
|
44
|
+
_allow_loss_refinement = xt.line._allow_loss_refinement
|
45
45
|
|
46
46
|
assert _has_backtrack(line['e0'], line)
|
47
47
|
assert _has_backtrack(line['e1'], line)
|
@@ -50,12 +50,12 @@ def test_has_backtrack(test_context):
|
|
50
50
|
assert _has_backtrack(line['a1'], line)
|
51
51
|
assert _has_backtrack(line['a2'], line)
|
52
52
|
|
53
|
-
assert not
|
54
|
-
assert not
|
55
|
-
assert not
|
56
|
-
assert
|
57
|
-
assert
|
58
|
-
assert
|
53
|
+
assert not _allow_loss_refinement(line['e0'], line)
|
54
|
+
assert not _allow_loss_refinement(line['e1'], line)
|
55
|
+
assert not _allow_loss_refinement(line['e2'], line)
|
56
|
+
assert _allow_loss_refinement(line['a0'], line)
|
57
|
+
assert _allow_loss_refinement(line['a1'], line)
|
58
|
+
assert _allow_loss_refinement(line['a2'], line)
|
59
59
|
|
60
60
|
def test_is_drift_behaves_like_drift():
|
61
61
|
|
@@ -351,7 +351,7 @@ def test_fcc_ee_solenoid_correction():
|
|
351
351
|
assert_allclose = np.testing.assert_allclose
|
352
352
|
|
353
353
|
# Check that tilt is present
|
354
|
-
assert_allclose(tw_sol_off['
|
354
|
+
assert_allclose(tw_sol_off['kin_xprime', 'ip.1'], np.tan(0.015), atol=1e-14, rtol=0)
|
355
355
|
|
356
356
|
# Check that solenoid introduces coupling
|
357
357
|
assert tw_sol_on.c_minus > 1e-4
|
@@ -361,21 +361,16 @@ def test_fcc_ee_solenoid_correction():
|
|
361
361
|
|
362
362
|
assert_allclose(tw_chk['x', 'ip.1'], 0, atol=1e-8, rtol=0)
|
363
363
|
assert_allclose(tw_chk['y', 'ip.1'], 0, atol=1e-10, rtol=0)
|
364
|
-
assert_allclose(tw_chk['
|
365
|
-
assert_allclose(tw_chk['
|
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
366
|
assert_allclose(tw_chk['x', 'pqc2re.1'], 0, atol=5e-8, rtol=0)
|
367
367
|
assert_allclose(tw_chk['y', 'pqc2re.1'], 0, atol=5e-8, rtol=0)
|
368
|
-
assert_allclose(tw_chk['
|
369
|
-
assert_allclose(tw_chk['
|
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
370
|
assert_allclose(tw_chk['x', 'pqc2le.4'], 0, atol=5e-8, rtol=0)
|
371
371
|
assert_allclose(tw_chk['y', 'pqc2le.4'], 0, atol=5e-8, rtol=0)
|
372
|
-
assert_allclose(tw_chk['
|
373
|
-
assert_allclose(tw_chk['
|
374
|
-
|
375
|
-
assert tw_chk['ax', 'pqc2le.4'] == 0
|
376
|
-
assert tw_chk['ay', 'pqc2le.4'] == 0
|
377
|
-
assert tw_chk['ax', 'pqc2re.1'] == 0
|
378
|
-
assert tw_chk['ay', 'pqc2re.1'] == 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)
|
379
374
|
|
380
375
|
assert_allclose(tw_chk['betx', 'ip.1'], tw_sol_off['betx', 'ip.1'], atol=0, rtol=5e-5)
|
381
376
|
assert_allclose(tw_chk['bety', 'ip.1'], tw_sol_off['bety', 'ip.1'], atol=0, rtol=5e-5)
|
@@ -1006,4 +1006,30 @@ def test_insert_thick_element_reuse_marker_name():
|
|
1006
1006
|
|
1007
1007
|
assert np.all(tt.name == ['d1..0', 'm1', 'd2..1', '_end_point'])
|
1008
1008
|
assert np.all(tt.parent_name == ['d1', None, 'd2', None])
|
1009
|
-
assert_allclose(tt.s, [0. , 0.5, 1.5, 2. ], rtol=0, atol=1e-14)
|
1009
|
+
assert_allclose(tt.s, [0. , 0.5, 1.5, 2. ], rtol=0, atol=1e-14)
|
1010
|
+
|
1011
|
+
def test_multiple_thick_elements():
|
1012
|
+
line = xt.Line(
|
1013
|
+
elements=[xt.Drift(length=1.0) for i in range(10)]
|
1014
|
+
)
|
1015
|
+
|
1016
|
+
s_insert = np.array([2.5, 5.5, 7])
|
1017
|
+
l_insert = np.array([1.0, 1.0, 1.0])
|
1018
|
+
ele_insert = [xt.Sextupole(length=l) for l in l_insert]
|
1019
|
+
|
1020
|
+
line._insert_thick_elements_at_s(
|
1021
|
+
element_names=[f'insertion_{i}' for i in range(len(s_insert))],
|
1022
|
+
elements=ele_insert,
|
1023
|
+
at_s=s_insert
|
1024
|
+
)
|
1025
|
+
|
1026
|
+
tt = line.get_table()
|
1027
|
+
|
1028
|
+
assert np.all(tt.name == ['e0', 'e1', 'e2..0', 'insertion_0', 'e3..1', 'e4', 'e5..0',
|
1029
|
+
'insertion_1', 'e6..1', 'insertion_2', 'e8', 'e9', '_end_point'])
|
1030
|
+
xo.assert_allclose(tt.s, [ 0. , 1. , 2. , 2.5, 3.5, 4. , 5. ,
|
1031
|
+
5.5, 6.5, 7. , 8. , 9. , 10. ])
|
1032
|
+
|
1033
|
+
assert np.all(tt.element_type == ['Drift', 'Drift', 'DriftSlice', 'Sextupole', 'DriftSlice', 'Drift',
|
1034
|
+
'DriftSlice', 'Sextupole', 'DriftSlice', 'Sextupole', 'Drift',
|
1035
|
+
'Drift', ''])
|
@@ -162,6 +162,7 @@ def test_ring_with_radiation(test_context):
|
|
162
162
|
mad.input(f'''
|
163
163
|
select, flag=MAKETHIN, SLICE=4, thick=false;
|
164
164
|
select, flag=MAKETHIN, pattern=wig, slice=1;
|
165
|
+
select, flag=makethin, class=rfcavity, slice=1;
|
165
166
|
MAKETHIN, SEQUENCE=ring, MAKEDIPEDGE=true;
|
166
167
|
use, sequence=RING;
|
167
168
|
''')
|
@@ -709,7 +709,7 @@ def test_track_log_and_merit_function(pimms_mad, test_context):
|
|
709
709
|
fit = np.polyfit(np.arange(num_turns), line.log_last_track['kqfa'], 1, full=True)
|
710
710
|
(slope, _), residual, _, _, _ = fit
|
711
711
|
assert slope > 0
|
712
|
-
assert residual < 1e-
|
712
|
+
assert residual < 1e-28
|
713
713
|
assert np.isclose(line.log_last_track['kqfa'][0], kqfa_before, atol=1e-14, rtol=0)
|
714
714
|
assert np.isclose(line.log_last_track['kqfa'][-1], line.vv['kqfa'], atol=1e-14, rtol=0)
|
715
715
|
|
@@ -37,7 +37,7 @@ from .multisetter import MultiSetter
|
|
37
37
|
from .footprint import Footprint, LinearRescale
|
38
38
|
|
39
39
|
# Flags and test functions
|
40
|
-
from .line import _is_drift, _behaves_like_drift, _is_aperture, _is_thick,
|
40
|
+
from .line import _is_drift, _behaves_like_drift, _is_aperture, _is_thick, _allow_loss_refinement
|
41
41
|
from .line import _lines_equal, _apertures_equal
|
42
42
|
|
43
43
|
from .slicing import Strategy, Uniform, Teapot
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.57.2'
|
@@ -431,7 +431,7 @@ class BeamElement(xo.HybridClass, metaclass=MetaBeamElement):
|
|
431
431
|
behaves_like_drift = False
|
432
432
|
allow_track = True
|
433
433
|
has_backtrack = False
|
434
|
-
|
434
|
+
allow_loss_refinement = False
|
435
435
|
allow_rot_and_shift = True
|
436
436
|
skip_in_loss_location_refinement = False
|
437
437
|
needs_rng = False
|
@@ -45,7 +45,7 @@ class Marker(BeamElement):
|
|
45
45
|
'_dummy': xo.Int64}
|
46
46
|
|
47
47
|
behaves_like_drift = True
|
48
|
-
|
48
|
+
allow_loss_refinement = True
|
49
49
|
has_backtrack = True
|
50
50
|
allow_rot_and_shift = False
|
51
51
|
|
@@ -72,7 +72,7 @@ class Drift(BeamElement):
|
|
72
72
|
isthick = True
|
73
73
|
behaves_like_drift = True
|
74
74
|
has_backtrack = True
|
75
|
-
|
75
|
+
allow_loss_refinement = True
|
76
76
|
allow_rot_and_shift = False
|
77
77
|
|
78
78
|
_extra_c_sources = [
|
@@ -138,7 +138,7 @@ class XYShift(BeamElement):
|
|
138
138
|
'dy': xo.Float64,
|
139
139
|
}
|
140
140
|
|
141
|
-
|
141
|
+
allow_loss_refinement = True
|
142
142
|
has_backtrack = True
|
143
143
|
allow_rot_and_shift = False
|
144
144
|
|
@@ -279,7 +279,7 @@ class SRotation(BeamElement):
|
|
279
279
|
'sin_z': xo.Float64,
|
280
280
|
}
|
281
281
|
|
282
|
-
|
282
|
+
allow_loss_refinement = True
|
283
283
|
has_backtrack = True
|
284
284
|
allow_rot_and_shift = False
|
285
285
|
|
@@ -348,7 +348,7 @@ class XRotation(BeamElement):
|
|
348
348
|
'tan_angle': xo.Float64,
|
349
349
|
}
|
350
350
|
|
351
|
-
|
351
|
+
allow_loss_refinement = True
|
352
352
|
has_backtrack = True
|
353
353
|
allow_rot_and_shift = False
|
354
354
|
|
@@ -431,7 +431,7 @@ class YRotation(BeamElement):
|
|
431
431
|
'''
|
432
432
|
|
433
433
|
has_backtrack = True
|
434
|
-
|
434
|
+
allow_loss_refinement = True
|
435
435
|
allow_rot_and_shift = False
|
436
436
|
|
437
437
|
_xofields={
|
@@ -203,6 +203,7 @@ class DriftSliceBend(BeamElement):
|
|
203
203
|
rot_and_shift_from_parent = False
|
204
204
|
_skip_in_to_dict = ['_parent']
|
205
205
|
has_backtrack = True
|
206
|
+
allow_loss_refinement = True
|
206
207
|
_force_moveable = True
|
207
208
|
isthick = True
|
208
209
|
_inherit_strengths = False
|
@@ -239,6 +240,7 @@ class DriftSliceQuadrupole(BeamElement):
|
|
239
240
|
rot_and_shift_from_parent = False
|
240
241
|
_skip_in_to_dict = ['_parent']
|
241
242
|
has_backtrack = True
|
243
|
+
allow_loss_refinement = True
|
242
244
|
_force_moveable = True
|
243
245
|
isthick = True
|
244
246
|
_inherit_strengths = False
|
@@ -276,6 +278,7 @@ class DriftSliceSextupole(BeamElement):
|
|
276
278
|
rot_and_shift_from_parent = False
|
277
279
|
_skip_in_to_dict = ['_parent']
|
278
280
|
has_backtrack = True
|
281
|
+
allow_loss_refinement = True
|
279
282
|
_force_moveable = True
|
280
283
|
isthick = True
|
281
284
|
_inherit_strengths = False
|
@@ -313,6 +316,7 @@ class DriftSliceOctupole(BeamElement):
|
|
313
316
|
rot_and_shift_from_parent = False
|
314
317
|
_skip_in_to_dict = ['_parent']
|
315
318
|
has_backtrack = True
|
319
|
+
allow_loss_refinement = True
|
316
320
|
_force_moveable = True
|
317
321
|
isthick = True
|
318
322
|
_inherit_strengths = False
|
@@ -349,6 +353,7 @@ class DriftSlice(BeamElement):
|
|
349
353
|
rot_and_shift_from_parent = False
|
350
354
|
_skip_in_to_dict = ['_parent']
|
351
355
|
has_backtrack = True
|
356
|
+
allow_loss_refinement = True
|
352
357
|
_force_moveable = True
|
353
358
|
isthick = True
|
354
359
|
_inherit_strengths = False
|
@@ -1855,7 +1855,7 @@ class Line:
|
|
1855
1855
|
def _elements_intersecting_s(
|
1856
1856
|
self,
|
1857
1857
|
s: List[float],
|
1858
|
-
|
1858
|
+
s_tol=1e-6,
|
1859
1859
|
) -> Dict[str, List[float]]:
|
1860
1860
|
"""Given a list of s positions, return a list of elements 'cut' by s.
|
1861
1861
|
|
@@ -1863,9 +1863,9 @@ class Line:
|
|
1863
1863
|
---------
|
1864
1864
|
s
|
1865
1865
|
A list of s positions.
|
1866
|
-
|
1866
|
+
s_tol
|
1867
1867
|
Tolerance used when checking if s falls inside an element, or
|
1868
|
-
at its edge. Defaults to 1e-
|
1868
|
+
at its edge. Defaults to 1e-6.
|
1869
1869
|
|
1870
1870
|
Returns
|
1871
1871
|
-------
|
@@ -1890,12 +1890,12 @@ class Line:
|
|
1890
1890
|
start, name = next(all_s_iter)
|
1891
1891
|
continue
|
1892
1892
|
|
1893
|
-
if np.isclose(current_s, start, atol=
|
1893
|
+
if np.isclose(current_s, start, atol=s_tol, rtol=0):
|
1894
1894
|
current_s = next(current_s_iter)
|
1895
1895
|
continue
|
1896
1896
|
|
1897
1897
|
end = start + _length(element, self)
|
1898
|
-
if np.isclose(current_s, end, atol=
|
1898
|
+
if np.isclose(current_s, end, atol=s_tol, rtol=0):
|
1899
1899
|
current_s = next(current_s_iter)
|
1900
1900
|
continue
|
1901
1901
|
|
@@ -1916,9 +1916,9 @@ class Line:
|
|
1916
1916
|
|
1917
1917
|
return cuts_for_element
|
1918
1918
|
|
1919
|
-
def cut_at_s(self, s: List[float]):
|
1919
|
+
def cut_at_s(self, s: List[float], s_tol=1e-6):
|
1920
1920
|
"""Slice the line so that positions in s never fall inside an element."""
|
1921
|
-
cuts_for_element = self._elements_intersecting_s(s)
|
1921
|
+
cuts_for_element = self._elements_intersecting_s(s, s_tol=s_tol)
|
1922
1922
|
strategies = [Strategy(None)] # catch-all, ignore unaffected elements
|
1923
1923
|
|
1924
1924
|
for name, cuts in cuts_for_element.items():
|
@@ -2005,11 +2005,12 @@ class Line:
|
|
2005
2005
|
|
2006
2006
|
s_vect_upstream = np.array(self.get_s_position(mode='upstream'))
|
2007
2007
|
if _is_thick(element, self) and _length(element, self) > 0:
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2008
|
+
i_first_removal = np.where(np.abs(s_vect_upstream - s_start_ele) < s_tol)[0][-1]
|
2009
|
+
i_last_removal = np.where(np.abs(s_vect_upstream - s_end_ele) < s_tol)[0][0] - 1
|
2010
|
+
xo.assert_allclose(s_vect_upstream[i_last_removal + 1]
|
2011
|
+
- s_vect_upstream[i_first_removal],
|
2012
|
+
_length(element, self), atol=2 * s_tol, rtol=0)
|
2013
|
+
self.element_names[i_first_removal:i_last_removal + 1] = [name]
|
2013
2014
|
else:
|
2014
2015
|
i_closest = np.argmin(np.abs(s_vect_upstream - at_s))
|
2015
2016
|
assert np.abs(s_vect_upstream[i_closest] - at_s) < s_tol
|
@@ -2891,7 +2892,7 @@ class Line:
|
|
2891
2892
|
ee = self.element_dict[name]
|
2892
2893
|
if isinstance(ee, xt.Replica):
|
2893
2894
|
ee = ee.resolve(self)
|
2894
|
-
if
|
2895
|
+
if _allow_loss_refinement(ee, self) and not name in needs_aperture:
|
2895
2896
|
dont_need_aperture[name] = True
|
2896
2897
|
if name.endswith('_entry') or name.endswith('_exit'):
|
2897
2898
|
dont_need_aperture[name] = True
|
@@ -3615,7 +3616,7 @@ class Line:
|
|
3615
3616
|
)
|
3616
3617
|
return cache
|
3617
3618
|
|
3618
|
-
def _insert_thin_elements_at_s(self, elements_to_insert):
|
3619
|
+
def _insert_thin_elements_at_s(self, elements_to_insert, s_tol=0.5e-6):
|
3619
3620
|
|
3620
3621
|
'''
|
3621
3622
|
Example:
|
@@ -3629,7 +3630,6 @@ class Line:
|
|
3629
3630
|
'''
|
3630
3631
|
|
3631
3632
|
self._frozen_check()
|
3632
|
-
s_tol = 0.5e-6
|
3633
3633
|
|
3634
3634
|
s_cuts = [ee[0] for ee in elements_to_insert]
|
3635
3635
|
s_cuts = np.sort(s_cuts)
|
@@ -3673,6 +3673,69 @@ class Line:
|
|
3673
3673
|
if insert_at is not None:
|
3674
3674
|
insert_at += 1
|
3675
3675
|
|
3676
|
+
def _insert_thick_elements_at_s(self, element_names, elements,
|
3677
|
+
at_s, s_tol=1e-6):
|
3678
|
+
|
3679
|
+
assert isinstance(element_names, (list, tuple))
|
3680
|
+
assert isinstance(elements, (list, tuple))
|
3681
|
+
assert isinstance(at_s, (list, tuple, np.ndarray))
|
3682
|
+
assert len(element_names) == len(elements) == len(at_s)
|
3683
|
+
|
3684
|
+
self._frozen_check()
|
3685
|
+
|
3686
|
+
s_insert = np.array(at_s)
|
3687
|
+
l_insert = np.array([_length(ee, None) for ee in elements])
|
3688
|
+
ele_insert = list(elements).copy()
|
3689
|
+
name_insert = list(element_names).copy()
|
3690
|
+
|
3691
|
+
end_insert = np.array(s_insert) + np.array(l_insert)
|
3692
|
+
|
3693
|
+
self.cut_at_s(list(s_insert) + list(end_insert))
|
3694
|
+
|
3695
|
+
i_sorted = np.argsort(s_insert)
|
3696
|
+
s_insert_sorted = s_insert[i_sorted]
|
3697
|
+
ele_insert_sorted = [ele_insert[i] for i in i_sorted]
|
3698
|
+
name_insert_sorted = [name_insert[i] for i in i_sorted]
|
3699
|
+
end_insert_sorted = end_insert[i_sorted]
|
3700
|
+
|
3701
|
+
assert np.all(s_insert_sorted[:-1] < end_insert_sorted[1:]), (
|
3702
|
+
'Overlapping insertions')
|
3703
|
+
|
3704
|
+
old_element_names = self.element_names
|
3705
|
+
|
3706
|
+
s_tol = 1e-6
|
3707
|
+
|
3708
|
+
s_vect_upstream = np.array(self.get_s_position(mode='upstream'))
|
3709
|
+
|
3710
|
+
i_replace = np.zeros(len(s_vect_upstream), dtype=int)
|
3711
|
+
mask_remove = np.zeros(len(s_vect_upstream), dtype=bool)
|
3712
|
+
|
3713
|
+
i_replace[:] = -1
|
3714
|
+
|
3715
|
+
for ii in range(len(s_insert_sorted)):
|
3716
|
+
ss_start = s_insert_sorted[ii]
|
3717
|
+
ss_end = end_insert_sorted[ii]
|
3718
|
+
|
3719
|
+
i_first_removal = np.where(np.abs(s_vect_upstream - ss_start) < s_tol)[0][-1]
|
3720
|
+
i_last_removal = np.where(np.abs(s_vect_upstream - ss_end) < s_tol)[0][0] - 1
|
3721
|
+
|
3722
|
+
i_replace[i_first_removal] = ii
|
3723
|
+
mask_remove[i_first_removal+1:i_last_removal+1] = True
|
3724
|
+
|
3725
|
+
new_element_names = []
|
3726
|
+
for ii, nn in enumerate(old_element_names):
|
3727
|
+
if mask_remove[ii]:
|
3728
|
+
continue
|
3729
|
+
if i_replace[ii] != -1:
|
3730
|
+
new_element_names.append(name_insert_sorted[i_replace[ii]])
|
3731
|
+
else:
|
3732
|
+
new_element_names.append(nn)
|
3733
|
+
|
3734
|
+
for new_nn, new_ee in zip(name_insert_sorted, ele_insert_sorted):
|
3735
|
+
self.element_dict[new_nn] = new_ee
|
3736
|
+
|
3737
|
+
self.element_names = new_element_names
|
3738
|
+
|
3676
3739
|
@property
|
3677
3740
|
def _line_before_slicing(self):
|
3678
3741
|
if self._element_names_before_slicing is None:
|
@@ -3871,10 +3934,10 @@ def _is_collective(element, line):
|
|
3871
3934
|
return iscoll
|
3872
3935
|
|
3873
3936
|
# whether backtrack in loss location refinement is allowed
|
3874
|
-
def
|
3937
|
+
def _allow_loss_refinement(element, line):
|
3875
3938
|
if isinstance(element, xt.Replica):
|
3876
3939
|
element = element.resolve(line)
|
3877
|
-
return hasattr(element, '
|
3940
|
+
return hasattr(element, 'allow_loss_refinement') and element.allow_loss_refinement
|
3878
3941
|
|
3879
3942
|
# whether element has backtrack capability
|
3880
3943
|
def _has_backtrack(element, line):
|
@@ -10,7 +10,7 @@ import xobjects as xo
|
|
10
10
|
import xtrack as xt
|
11
11
|
|
12
12
|
from ..beam_elements import LimitPolygon, XYShift, SRotation, Drift, Marker
|
13
|
-
from ..line import (Line, _is_thick, _behaves_like_drift,
|
13
|
+
from ..line import (Line, _is_thick, _behaves_like_drift, _allow_loss_refinement,
|
14
14
|
_has_backtrack, _is_aperture)
|
15
15
|
|
16
16
|
from ..general import _print
|
@@ -52,7 +52,7 @@ class LossLocationRefinement:
|
|
52
52
|
If True, the lines used to refine the loss location are saved.
|
53
53
|
allowed_backtrack_types : list
|
54
54
|
List of element types through which the backtracking is allowed.
|
55
|
-
Elements exposing the attribute `
|
55
|
+
Elements exposing the attribute `allow_loss_refinement` are automatically
|
56
56
|
added to the list.
|
57
57
|
|
58
58
|
'''
|
@@ -261,7 +261,7 @@ def refine_loss_location_single_aperture(particles, i_aper_1, i_end_thin_0,
|
|
261
261
|
can_backtrack = True
|
262
262
|
if not _has_backtrack(ee, line):
|
263
263
|
can_backtrack = False
|
264
|
-
elif not
|
264
|
+
elif not _allow_loss_refinement(ee, line):
|
265
265
|
can_backtrack = False
|
266
266
|
|
267
267
|
# Check for override
|
@@ -42,7 +42,7 @@ class LastTurnsMonitor(BeamElement):
|
|
42
42
|
}
|
43
43
|
|
44
44
|
behaves_like_drift = True
|
45
|
-
|
45
|
+
allow_loss_refinement = True
|
46
46
|
|
47
47
|
# TODO: find a way to dynamically change what properties are being saved by this monitor
|
48
48
|
properties = [field.name for field in LastTurnsData._fields if field.name != 'lost_at_offset']
|
@@ -162,7 +162,7 @@ class ParticlesMonitor(BeamElement):
|
|
162
162
|
|
163
163
|
behaves_like_drift = True
|
164
164
|
has_backtrack = True
|
165
|
-
|
165
|
+
allow_loss_refinement = True
|
166
166
|
_ParticlesClass = xt.Particles
|
167
167
|
|
168
168
|
|
@@ -176,7 +176,7 @@ per_particle_vars = xt.Particles.per_particle_vars
|
|
176
176
|
for tt, nn in per_particle_vars:
|
177
177
|
setattr(ParticlesMonitor, nn, _FieldOfMonitor(name=nn))
|
178
178
|
|
179
|
-
for nn in ['pzeta']:
|
179
|
+
for nn in ['pzeta', 'kin_px', 'kin_py', 'kin_ps', 'kin_xprime', 'kin_yprime']:
|
180
180
|
setattr(ParticlesMonitor, nn, _FieldOfMonitor(name=nn))
|
181
181
|
|
182
182
|
|
@@ -1300,6 +1300,47 @@ class Particles(xo.HybridClass):
|
|
1300
1300
|
pzeta, mode='readonly',
|
1301
1301
|
container=self)
|
1302
1302
|
|
1303
|
+
@property
|
1304
|
+
def kin_px(self):
|
1305
|
+
out = self.px - self.ax
|
1306
|
+
return self._buffer.context.linked_array_type.from_array(
|
1307
|
+
out,
|
1308
|
+
mode='readonly',
|
1309
|
+
container=self)
|
1310
|
+
|
1311
|
+
@property
|
1312
|
+
def kin_py(self):
|
1313
|
+
out = self.py - self.ay
|
1314
|
+
return self._buffer.context.linked_array_type.from_array(
|
1315
|
+
out,
|
1316
|
+
mode='readonly',
|
1317
|
+
container=self)
|
1318
|
+
|
1319
|
+
@property
|
1320
|
+
def kin_ps(self):
|
1321
|
+
sqrt = self._context.nplike_lib.sqrt
|
1322
|
+
out = sqrt((1 + self.delta) ** 2 - self.kin_px ** 2 - self.kin_py ** 2)
|
1323
|
+
return self._buffer.context.linked_array_type.from_array(
|
1324
|
+
out,
|
1325
|
+
mode='readonly',
|
1326
|
+
container=self)
|
1327
|
+
|
1328
|
+
@property
|
1329
|
+
def kin_xprime(self):
|
1330
|
+
out = self.kin_px / self.kin_ps
|
1331
|
+
return self._buffer.context.linked_array_type.from_array(
|
1332
|
+
out,
|
1333
|
+
mode='readonly',
|
1334
|
+
container=self)
|
1335
|
+
|
1336
|
+
@property
|
1337
|
+
def kin_yprime(self):
|
1338
|
+
out = self.kin_py / self.kin_ps
|
1339
|
+
return self._buffer.context.linked_array_type.from_array(
|
1340
|
+
out,
|
1341
|
+
mode='readonly',
|
1342
|
+
container=self)
|
1343
|
+
|
1303
1344
|
def add_to_energy(self, delta_energy):
|
1304
1345
|
"""
|
1305
1346
|
Add `delta_energy` to the `energy` of the particles object. `delta`,
|
@@ -143,9 +143,8 @@ class Tracker:
|
|
143
143
|
if not _prebuilding_kernels:
|
144
144
|
self._get_twiss_mask_markers() # to cache it
|
145
145
|
|
146
|
-
self._init_io_buffer(io_buffer)
|
147
|
-
|
148
146
|
self.line = line
|
147
|
+
self._init_io_buffer(io_buffer)
|
149
148
|
self.line.tracker = self
|
150
149
|
|
151
150
|
if compile:
|
@@ -153,7 +152,13 @@ class Tracker:
|
|
153
152
|
|
154
153
|
def _init_io_buffer(self, io_buffer=None):
|
155
154
|
if io_buffer is None:
|
156
|
-
|
155
|
+
io_bufs = [ee.io_buffer for ee in self.line.elements if hasattr(ee, 'io_buffer')]
|
156
|
+
if len(io_bufs) == 0:
|
157
|
+
io_buffer = new_io_buffer(_context=self._context)
|
158
|
+
elif len(np.unique([id(buf) for buf in io_bufs])) > 1:
|
159
|
+
raise ValueError("Different io buffers found in elements!")
|
160
|
+
else:
|
161
|
+
io_buffer = io_bufs[0]
|
157
162
|
self.io_buffer = io_buffer
|
158
163
|
|
159
164
|
def _split_parts_for_collective_mode(self, line, _buffer):
|