xtrack 0.90.0__tar.gz → 0.90.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xtrack-0.90.0/xtrack.egg-info → xtrack-0.90.1}/PKG-INFO +1 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_collimation.py +137 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_environment.py +83 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_misalign.py +52 -39
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_particles.py +41 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_survey.py +0 -3
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_tilt_shifts.py +2 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_twiss.py +54 -0
- xtrack-0.90.1/xtrack/_version.py +1 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/base_element.py +14 -12
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures_src/limitellipse.h +3 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures_src/limitpolygon.h +4 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures_src/limitracetrack.h +4 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures_src/limitrect.h +4 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures_src/limitrectellipse.h +4 -2
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements.py +55 -2
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/misalignment.h +5 -4
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_misalignments.h +91 -43
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/environment.py +68 -2
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/general.py +26 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/line.py +35 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/loss_location_refinement/loss_location_refinement.py +20 -6
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/__init__.py +2 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/particles.py +61 -15
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/tracker_data.py +9 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/twiss.py +16 -3
- {xtrack-0.90.0 → xtrack-0.90.1/xtrack.egg-info}/PKG-INFO +1 -1
- xtrack-0.90.0/xtrack/_version.py +0 -1
- {xtrack-0.90.0 → xtrack-0.90.1}/LICENSE +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/MANIFEST.in +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/README.md +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/base_classes.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/elements.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/line.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/particles.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/pyproject.toml +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/setup.cfg +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/setup.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_acceleration.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_aperture_table.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_apertures.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_attr_replicas_and_slices.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_bucket_with_ref_energy_change.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_coasting.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_coupling_edwards_teng.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_electron_cooler.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_element_characterization_functions.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_elements.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_elements_thick.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_fcc_ee_solenoid_correction.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_footprint.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_full_rings.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_h6_sps_beamline.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_hvkick.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_ions.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_legacy_multiline_to_env.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_lhc_env.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_line.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_load.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_load_vars.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_lumi.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_mad_writer.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_madloader.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_madnginterface.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_magnet.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_nested.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_multi_bunch_gauss.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_multiline.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_multisetter.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_multispecies.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_native_madloader.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_optimize_for_tracking.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_particles_basics.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_particles_pdg.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_pipeline.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_prebuild_kernels.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_quadrupole_fringe_ptc.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_quadrupole_wedge.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_radial_steering.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_radiation.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_radiation_equilibrium_emittances_thick.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_radiation_integrals.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_random_gen.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_rbend_rbarc.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_rbend_straight_body.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_rf_track.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_rotation_signs.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_seeds.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_slice_and_insert_with_replicas.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_slice_elements.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_slicing.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_solenoid_bz_map_vs_boris_legacy.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_spin.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_sps_thick.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_tapering.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_thick_kickers_rf_crab.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_tracker.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_trajectory_correcton.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_vs_madx.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/tests/test_xmask_orbit_correction.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/aperture_meas.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/crab_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/default_magnet_config.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_exact.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_exact_slice.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_crab_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_multipole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_rbend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/drift_slice_uniform_solenoid.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/electroncooler.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/legacy_solenoid.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/magnet.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/magnet_drift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/magnet_edge.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/magnet_kick.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/marker.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/multipoleedge.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/rbend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/slnd.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/temprf.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_crab_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_multipole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_rbend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thick_slice_uniform_solenoid.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_crab_cavity.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_multipole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_octupole_entry.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_octupole_exit.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_entry.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_exit.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_rbend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_rbend_entry.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_rbend_exit.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_sextupole_entry.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_sextupole_exit.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_uniform_solenoid_entry.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/thin_slice_uniform_solenoid_exit.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_drift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_legacy_solenoid.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_legacy_solenoid_multipolar_components.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_legacy_solenoid_radiation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet.template.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet_configure.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet_drift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet_edge.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet_kick.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_magnet_radiation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_rf.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_rf.template.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_xyshift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/variable_solenoid.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/slice_base.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/slice_elements_drift.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/slice_elements_edge.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/slice_elements_thick.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/beam_elements/slice_elements_thin.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/footprint.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/functions.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/headers/checks.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/headers/constants.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/headers/track.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/internal_record.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/json.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/load.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/lumi.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/mad_loader.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/mad_parser/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/mad_parser/loader.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/mad_parser/madx.lark +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/mad_parser/parse.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/mad_writer.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/madng_interface.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/match.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/multiline.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/multiline_legacy/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/multiline_legacy/multiline_legacy.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/multiline_legacy/shared_knobs.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/constants.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/masses.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/pdg.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/random/random_src/uniform_accurate.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/slicing.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/survey.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/svgutils/__init__.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/svgutils/parser.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/svgutils/path.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/svgutils/svgutils.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/synctime.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/tapering.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/targets.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/track_flags.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/tracker.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/trajectory_correction.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack/twissplot.py +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack.egg-info/SOURCES.txt +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.90.0 → xtrack-0.90.1}/xtrack.egg-info/top_level.txt +0 -0
|
@@ -411,7 +411,6 @@ def test_losslocationrefinement_skip_refinement_for_collimators():
|
|
|
411
411
|
#################
|
|
412
412
|
|
|
413
413
|
line.build_tracker()
|
|
414
|
-
line.config.XTRACK_GLOBAL_XY_LIMIT = 1e3
|
|
415
414
|
|
|
416
415
|
##########################
|
|
417
416
|
# Build particles object #
|
|
@@ -442,3 +441,140 @@ def test_losslocationrefinement_skip_refinement_for_collimators():
|
|
|
442
441
|
loss_loc_refinement.refine_loss_location(particles)
|
|
443
442
|
|
|
444
443
|
assert np.all(part_before.s == particles.s)
|
|
444
|
+
|
|
445
|
+
def test_memory_dealloc_repeated_refinements():
|
|
446
|
+
|
|
447
|
+
def _occupied_size(buffer):
|
|
448
|
+
return buffer.capacity - buffer.get_free()
|
|
449
|
+
|
|
450
|
+
n_part=10000
|
|
451
|
+
shift_x = 0.3e-2
|
|
452
|
+
shift_y = 0.5e-2
|
|
453
|
+
sandwitch_aper = True
|
|
454
|
+
|
|
455
|
+
ctx = xo.context_default
|
|
456
|
+
buf = ctx.new_buffer()
|
|
457
|
+
|
|
458
|
+
logger = logging.getLogger('xtrack')
|
|
459
|
+
logger.setLevel(logging.DEBUG)
|
|
460
|
+
|
|
461
|
+
# Define aper_0
|
|
462
|
+
aper_0 = xt.LimitEllipse(_buffer=buf, a=2e-2, b=2e-2)
|
|
463
|
+
shift_aper_0 = (shift_x, shift_y)
|
|
464
|
+
rot_deg_aper_0 = 10.
|
|
465
|
+
|
|
466
|
+
# Define aper_1
|
|
467
|
+
aper_1 = xt.LimitEllipse(_buffer=buf, a=1e-2, b=1e-2)
|
|
468
|
+
shift_aper_1 = (shift_x, shift_y)
|
|
469
|
+
rot_deg_aper_1 = 10.
|
|
470
|
+
|
|
471
|
+
# aper_0_sandwitch
|
|
472
|
+
if sandwitch_aper:
|
|
473
|
+
line_aper_0 = xt.Line(
|
|
474
|
+
elements=[xt.XYShift(_buffer=buf, dx=shift_aper_0[0], dy=shift_aper_0[1]),
|
|
475
|
+
xt.SRotation(_buffer=buf, angle=rot_deg_aper_0),
|
|
476
|
+
aper_0,
|
|
477
|
+
xt.Multipole(_buffer=buf, knl=[0.00]),
|
|
478
|
+
xt.SRotation(_buffer=buf, angle=-rot_deg_aper_0),
|
|
479
|
+
xt.XYShift(_buffer=buf, dx=-shift_aper_0[0], dy=-shift_aper_0[1])])
|
|
480
|
+
line_aper_0.build_tracker(_buffer=buf)
|
|
481
|
+
# aper_1_sandwitch
|
|
482
|
+
line_aper_1 = xt.Line(
|
|
483
|
+
elements=[xt.XYShift(_buffer=buf, dx=shift_aper_1[0], dy=shift_aper_1[1]),
|
|
484
|
+
xt.SRotation(_buffer=buf, angle=rot_deg_aper_1),
|
|
485
|
+
aper_1,
|
|
486
|
+
xt.Multipole(_buffer=buf, knl=[0.00]),
|
|
487
|
+
xt.SRotation(_buffer=buf, angle=-rot_deg_aper_1),
|
|
488
|
+
xt.XYShift(_buffer=buf, dx=-shift_aper_1[0], dy=-shift_aper_1[1])])
|
|
489
|
+
else:
|
|
490
|
+
aper_0.shift_x = shift_aper_0[0]
|
|
491
|
+
aper_0.shift_y = shift_aper_0[1]
|
|
492
|
+
aper_0.rot_s_rad = np.deg2rad(rot_deg_aper_0)
|
|
493
|
+
line_aper_0 = xt.Line(
|
|
494
|
+
elements=[aper_0, xt.Multipole(_buffer=buf, knl=[0.0])])
|
|
495
|
+
line_aper_0.build_tracker(_buffer=buf)
|
|
496
|
+
aper_1.shift_x = shift_aper_1[0]
|
|
497
|
+
aper_1.shift_y = shift_aper_1[1]
|
|
498
|
+
aper_1.rot_s_rad = np.deg2rad(rot_deg_aper_1)
|
|
499
|
+
line_aper_1 = xt.Line(
|
|
500
|
+
elements=[aper_1, xt.Multipole(_buffer=buf, knl=[0.00])])
|
|
501
|
+
|
|
502
|
+
line_aper_1.build_tracker(_buffer=buf)
|
|
503
|
+
|
|
504
|
+
# Build example line
|
|
505
|
+
line=xt.Line(
|
|
506
|
+
elements = ((xt.Drift(_buffer=buf, length=0.5),)
|
|
507
|
+
+ line_aper_0.elements
|
|
508
|
+
+ (xt.Drift(_buffer=buf, length=1),
|
|
509
|
+
xt.Multipole(_buffer=buf, knl=[0.]),
|
|
510
|
+
xt.Quadrupole(_buffer=buf, length=1),
|
|
511
|
+
xt.Cavity(_buffer=buf, voltage=3e6, frequency=400e6),
|
|
512
|
+
xt.ParticlesMonitor(_buffer=buf,
|
|
513
|
+
start_at_turn=0, stop_at_turn=10, num_particles=3),
|
|
514
|
+
xt.Drift(_buffer=buf, length=1.),
|
|
515
|
+
xt.Marker())
|
|
516
|
+
+ line_aper_1.elements))
|
|
517
|
+
line.build_tracker(_buffer=buf)
|
|
518
|
+
|
|
519
|
+
# Test on full line
|
|
520
|
+
r = np.linspace(0, 0.018, n_part)
|
|
521
|
+
theta = np.linspace(0, 8*np.pi, n_part)
|
|
522
|
+
particles0 = xp.Particles(_context=ctx,
|
|
523
|
+
p0c=6500e9,
|
|
524
|
+
x=r*np.cos(theta)+shift_x,
|
|
525
|
+
y=r*np.sin(theta)+shift_y)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
print('occupied size before refinement', _occupied_size(buf))
|
|
530
|
+
|
|
531
|
+
loss_loc_refinement = xt.LossLocationRefinement(line,
|
|
532
|
+
n_theta = 360,
|
|
533
|
+
r_max = 0.5, # m
|
|
534
|
+
dr = 50e-6,
|
|
535
|
+
ds = 0.1,
|
|
536
|
+
save_refine_lines=False,
|
|
537
|
+
allowed_backtrack_types=[
|
|
538
|
+
xt.Multipole,
|
|
539
|
+
xt.Cavity
|
|
540
|
+
])
|
|
541
|
+
print('occupied size after init refinement', _occupied_size(buf))
|
|
542
|
+
|
|
543
|
+
n_repetitions = 20
|
|
544
|
+
|
|
545
|
+
import time
|
|
546
|
+
for i_iter in range(n_repetitions):
|
|
547
|
+
|
|
548
|
+
particles = particles0.copy()
|
|
549
|
+
|
|
550
|
+
line.track(particles)
|
|
551
|
+
|
|
552
|
+
t0 = time.time()
|
|
553
|
+
|
|
554
|
+
loss_loc_refinement.refine_loss_location(particles)
|
|
555
|
+
print('occupied size after refinement', _occupied_size(buf))
|
|
556
|
+
|
|
557
|
+
if i_iter==0:
|
|
558
|
+
occupied_size_first_iter = _occupied_size(buf)
|
|
559
|
+
else:
|
|
560
|
+
assert _occupied_size(buf) == occupied_size_first_iter, \
|
|
561
|
+
'Buffer size increased after refinement! Memory leak?'
|
|
562
|
+
|
|
563
|
+
t1 = time.time()
|
|
564
|
+
print(f'Took\t{(t1-t0)*1e3:.2f} ms')
|
|
565
|
+
|
|
566
|
+
# Automatic checks
|
|
567
|
+
mask_lost = particles.state == 0
|
|
568
|
+
r_calc = np.sqrt((particles.x-shift_x)**2 + (particles.y-shift_y)**2)
|
|
569
|
+
assert np.all(r_calc[~mask_lost]<1e-2)
|
|
570
|
+
assert np.all(r_calc[mask_lost]>1e-2)
|
|
571
|
+
i_aper_1 = line.elements.index(aper_1)
|
|
572
|
+
assert np.all(particles.at_element[mask_lost]==i_aper_1)
|
|
573
|
+
assert np.all(particles.at_element[~mask_lost]==0)
|
|
574
|
+
s0 = line.get_s_elements()[line.elements.index(aper_0)]
|
|
575
|
+
s1 = line.get_s_elements()[line.elements.index(aper_1)]
|
|
576
|
+
r0 = np.sqrt(aper_0.a_squ)
|
|
577
|
+
r1 = np.sqrt(aper_1.a_squ)
|
|
578
|
+
s_expected = s0 + (r_calc-r0)/(r1 - r0)*(s1 - s0)
|
|
579
|
+
# TODO This threshold is a bit large
|
|
580
|
+
xo.assert_allclose(particles.s[mask_lost], s_expected[mask_lost], atol=0.11)
|
|
@@ -3343,4 +3343,86 @@ def test_particle_ref_as_object():
|
|
|
3343
3343
|
assert ll2.env.particle_ref is None
|
|
3344
3344
|
assert ll2.particle_ref.__class__.__name__ == 'LineParticleRef'
|
|
3345
3345
|
assert isinstance(ll2._particle_ref, xt.Particles)
|
|
3346
|
-
assert ll2._particle_ref is not ll._particle_ref
|
|
3346
|
+
assert ll2._particle_ref is not ll._particle_ref
|
|
3347
|
+
|
|
3348
|
+
def test_line_set_particle_ref():
|
|
3349
|
+
|
|
3350
|
+
line = xt.Line()
|
|
3351
|
+
line.set_particle_ref('electron', beta0=0.9)
|
|
3352
|
+
|
|
3353
|
+
xo.assert_allclose(line.particle_ref.q0 , -1, rtol=0, atol=1e-14)
|
|
3354
|
+
xo.assert_allclose(line.particle_ref.mass0 , xt.ELECTRON_MASS_EV)
|
|
3355
|
+
xo.assert_allclose(line.particle_ref.beta0 , 0.9, rtol=0, atol=1e-14)
|
|
3356
|
+
|
|
3357
|
+
env = xt.Environment()
|
|
3358
|
+
env['my_beta0'] = 0.1
|
|
3359
|
+
env.new_particle('my_part', 'proton', beta0='my_beta0')
|
|
3360
|
+
|
|
3361
|
+
line = env.new_line()
|
|
3362
|
+
line.set_particle_ref('my_part')
|
|
3363
|
+
line['my_beta0'] = 0.6
|
|
3364
|
+
|
|
3365
|
+
xo.assert_allclose(line.particle_ref.q0 , 1, rtol=0, atol=1e-14)
|
|
3366
|
+
xo.assert_allclose(line.particle_ref.mass0 , xt.PROTON_MASS_EV)
|
|
3367
|
+
xo.assert_allclose(line.particle_ref.beta0 , 0.6, rtol=0, atol=1e-14)
|
|
3368
|
+
|
|
3369
|
+
p_ref = xt.Particles('Pb208', p0c=7e12/82)
|
|
3370
|
+
line = xt.Line()
|
|
3371
|
+
line.set_particle_ref(p_ref)
|
|
3372
|
+
|
|
3373
|
+
xo.assert_allclose(line.particle_ref.q0 , 82, rtol=0, atol=1e-14)
|
|
3374
|
+
xo.assert_allclose(line.particle_ref.mass0, xt.particles.masses.Pb208_MASS_EV)
|
|
3375
|
+
xo.assert_allclose(line.particle_ref.p0c , 7e12/82, rtol=0, atol=1e-14)
|
|
3376
|
+
|
|
3377
|
+
|
|
3378
|
+
def test_env_set_particle_ref():
|
|
3379
|
+
|
|
3380
|
+
env = xt.Environment()
|
|
3381
|
+
env.set_particle_ref('electron', beta0=0.9)
|
|
3382
|
+
|
|
3383
|
+
xo.assert_allclose(env.particle_ref.q0 , -1, rtol=0, atol=1e-14)
|
|
3384
|
+
xo.assert_allclose(env.particle_ref.mass0 , xt.ELECTRON_MASS_EV)
|
|
3385
|
+
xo.assert_allclose(env.particle_ref.beta0 , 0.9, rtol=0, atol=1e-14)
|
|
3386
|
+
|
|
3387
|
+
env.new_line(name='line1', components=[env.new('d1', 'Drift', length=1)])
|
|
3388
|
+
env.line1.set_particle_ref('electron', beta0=0.9)
|
|
3389
|
+
|
|
3390
|
+
xo.assert_allclose(env.line1.particle_ref.q0 , -1, rtol=0, atol=1e-14)
|
|
3391
|
+
xo.assert_allclose(env.line1.particle_ref.mass0 , xt.ELECTRON_MASS_EV)
|
|
3392
|
+
xo.assert_allclose(env.line1.particle_ref.beta0 , 0.9, rtol=0, atol=1e-14)
|
|
3393
|
+
|
|
3394
|
+
env.set_particle_ref('proton', beta0=0.8)
|
|
3395
|
+
xo.assert_allclose(env.particle_ref.q0 , 1, rtol=0, atol=1e-14)
|
|
3396
|
+
xo.assert_allclose(env.particle_ref.mass0 , xt.PROTON_MASS_EV)
|
|
3397
|
+
xo.assert_allclose(env.particle_ref.beta0 , 0.8, rtol=0, atol=1e-14)
|
|
3398
|
+
xo.assert_allclose(env.line1.particle_ref.q0 , 1, rtol=0, atol=1e-14)
|
|
3399
|
+
xo.assert_allclose(env.line1.particle_ref.mass0 , xt.PROTON_MASS_EV)
|
|
3400
|
+
xo.assert_allclose(env.line1.particle_ref.beta0 , 0.8, rtol=0, atol=1e-14)
|
|
3401
|
+
|
|
3402
|
+
env['my_beta0'] = 0.1
|
|
3403
|
+
env.new_particle('my_part', 'proton', beta0='my_beta0')
|
|
3404
|
+
env.set_particle_ref('my_part')
|
|
3405
|
+
|
|
3406
|
+
env['my_beta0'] = 0.6
|
|
3407
|
+
xo.assert_allclose(env.line1.particle_ref.q0 , 1, rtol=0, atol=1e-14)
|
|
3408
|
+
xo.assert_allclose(env.line1.particle_ref.mass0 , xt.PROTON_MASS_EV)
|
|
3409
|
+
xo.assert_allclose(env.line1.particle_ref.beta0 , 0.6, rtol=0, atol=1e-14)
|
|
3410
|
+
|
|
3411
|
+
p_ref = xt.Particles('Pb208', p0c=7e12/82)
|
|
3412
|
+
env.set_particle_ref(p_ref)
|
|
3413
|
+
|
|
3414
|
+
xo.assert_allclose(env.particle_ref.q0 , 82, rtol=0, atol=1e-14)
|
|
3415
|
+
xo.assert_allclose(env.particle_ref.mass0, xt.particles.masses.Pb208_MASS_EV)
|
|
3416
|
+
xo.assert_allclose(env.particle_ref.p0c , 7e12/82, rtol=0, atol=1e-14)
|
|
3417
|
+
xo.assert_allclose(env.line1.particle_ref.q0 , 82, rtol=0, atol=1e-14)
|
|
3418
|
+
xo.assert_allclose(env.line1.particle_ref.mass0, xt.particles.masses.Pb208_MASS_EV)
|
|
3419
|
+
xo.assert_allclose(env.line1.particle_ref.p0c , 7e12/82, rtol=0, atol=1e-14)
|
|
3420
|
+
|
|
3421
|
+
env.set_particle_ref('positron', beta0=0.7, lines=None)
|
|
3422
|
+
xo.assert_allclose(env.particle_ref.q0 , 1, rtol=0, atol=1e-14)
|
|
3423
|
+
xo.assert_allclose(env.particle_ref.mass0 , xt.ELECTRON_MASS_EV)
|
|
3424
|
+
xo.assert_allclose(env.particle_ref.beta0 , 0.7, rtol=0, atol=1e-14)
|
|
3425
|
+
# line unchanged
|
|
3426
|
+
xo.assert_allclose(env.line1.particle_ref.q0 , 82, rtol=0, atol=1e-14)
|
|
3427
|
+
xo.assert_allclose(env.line1.particle_ref.mass0, xt.particles.masses.Pb208_MASS_EV)
|
|
3428
|
+
xo.assert_allclose(env.line1.particle_ref.p0c , 7e12/82, rtol=0, atol=1e-14)
|
|
@@ -116,9 +116,11 @@ def test_misalign_drift(angle, tilt, test_context):
|
|
|
116
116
|
model='rot-kick-rot',
|
|
117
117
|
_context=test_context,
|
|
118
118
|
)
|
|
119
|
+
element.track(p_expected)
|
|
120
|
+
element.rot_s_rad = 0 # Put in the misalignment element
|
|
119
121
|
else:
|
|
120
122
|
element = xt.DriftExact(length=length, _context=test_context)
|
|
121
|
-
|
|
123
|
+
element.track(p_expected)
|
|
122
124
|
|
|
123
125
|
p_misaligned_entry = p0.copy()
|
|
124
126
|
mis_entry = xt.Misalignment(
|
|
@@ -154,39 +156,42 @@ def test_misalign_drift(angle, tilt, test_context):
|
|
|
154
156
|
xo.assert_allclose(p_expected.s, p_aligned_exit.s, atol=1e-14, rtol=1e-9)
|
|
155
157
|
xo.assert_allclose(p_expected.zeta, p_aligned_exit.zeta, atol=1e-14, rtol=1e-9)
|
|
156
158
|
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
159
|
+
# I comment out the following as it is inconsistent with the current implementation
|
|
160
|
+
# (including the tilt in the misalignment), need to adapt:
|
|
161
|
+
|
|
162
|
+
# # Check that the intermediate points (entry and exit in the misaligned frame)
|
|
163
|
+
# # still lie on the straight line
|
|
164
|
+
# p0.move(_context=xo.ContextCpu())
|
|
165
|
+
# p_misaligned_entry.move(_context=xo.ContextCpu())
|
|
166
|
+
# p_misaligned_exit.move(_context=xo.ContextCpu())
|
|
167
|
+
# for idx, (x, px, y, py, delta) in enumerate(zip(p0.x, p0.px, p0.y, p0.py, p0.delta)):
|
|
168
|
+
# pz = np.sqrt((1 + delta) ** 2 - px ** 2 - py ** 2)
|
|
169
|
+
# xp = px / pz # = dpx / ds
|
|
170
|
+
# yp = py / pz # = dpy / ds
|
|
171
|
+
# dp_ds = np.array([xp, yp, 1]) # = dp / ds
|
|
172
|
+
|
|
173
|
+
# coords_at_start = np.array([x, y, 0])
|
|
174
|
+
|
|
175
|
+
# part_length = anchor
|
|
176
|
+
# part_angle = anchor / length * angle
|
|
177
|
+
# to_entry = (
|
|
178
|
+
# curvature_matrix(part_length, part_angle, tilt)
|
|
179
|
+
# @ translate_matrix(dx, dy, ds)
|
|
180
|
+
# @ theta_matrix(theta)
|
|
181
|
+
# @ phi_matrix(phi)
|
|
182
|
+
# @ psi_matrix(psi)
|
|
183
|
+
# @ np.linalg.inv(curvature_matrix(part_length, part_angle, tilt))
|
|
184
|
+
# )
|
|
185
|
+
# coords_misaligned_entry = particle_pos_in_frame(p_misaligned_entry, idx, to_entry)
|
|
186
|
+
# calculated_dp_ds_misaligned_entry = coords_misaligned_entry - coords_at_start
|
|
187
|
+
# cross_misaligned_entry = np.cross(dp_ds, calculated_dp_ds_misaligned_entry)
|
|
188
|
+
# xo.assert_allclose(cross_misaligned_entry, 0, atol=1e-13, rtol=1e-9)
|
|
189
|
+
|
|
190
|
+
# to_exit = to_entry @ curvature_matrix(length, angle, tilt)
|
|
191
|
+
# coords_misaligned_exit = particle_pos_in_frame(p_misaligned_exit, idx, to_exit)
|
|
192
|
+
# calculated_dp_ds_misaligned_exit = coords_misaligned_exit - coords_at_start
|
|
193
|
+
# cross_misaligned_exit = np.cross(dp_ds, calculated_dp_ds_misaligned_exit)
|
|
194
|
+
# xo.assert_allclose(cross_misaligned_exit, 0, atol=1e-13, rtol=1e-9)
|
|
190
195
|
|
|
191
196
|
|
|
192
197
|
@pytest.mark.parametrize('angle', [0, 0.3], ids=['straight', 'curved'])
|
|
@@ -206,9 +211,9 @@ def test_misalign_vs_madng(angle, tilt):
|
|
|
206
211
|
psi = 0.5 # rad
|
|
207
212
|
|
|
208
213
|
if angle:
|
|
209
|
-
element = xt.Bend(length=length, angle=angle, model='rot-kick-rot', k0=k0
|
|
214
|
+
element = xt.Bend(length=length, angle=angle, model='rot-kick-rot', k0=k0)#, rot_s_rad=tilt)
|
|
210
215
|
else:
|
|
211
|
-
element = xt.Solenoid(length=length, ks=ks
|
|
216
|
+
element = xt.Solenoid(length=length, ks=ks)#, rot_s_rad=tilt)
|
|
212
217
|
|
|
213
218
|
# Track in Xsuite
|
|
214
219
|
p0 = xt.Particles(x=0.2, y=-0.6, px=-0.01, py=0.02, zeta=0.5, delta=0.9)
|
|
@@ -345,7 +350,6 @@ def test_misalign_dedicated_vs_beam_element(test_context, element_type):
|
|
|
345
350
|
angle=angle,
|
|
346
351
|
model='rot-kick-rot',
|
|
347
352
|
k0=0.09,
|
|
348
|
-
rot_s_rad=tilt,
|
|
349
353
|
)
|
|
350
354
|
elif element_type == 'Quadrupole':
|
|
351
355
|
angle = 0
|
|
@@ -353,7 +357,6 @@ def test_misalign_dedicated_vs_beam_element(test_context, element_type):
|
|
|
353
357
|
element = xt.Quadrupole(
|
|
354
358
|
length=length,
|
|
355
359
|
k1=0.09,
|
|
356
|
-
rot_s_rad=tilt,
|
|
357
360
|
)
|
|
358
361
|
elif element_type == 'Multipole':
|
|
359
362
|
angle = 0
|
|
@@ -362,7 +365,6 @@ def test_misalign_dedicated_vs_beam_element(test_context, element_type):
|
|
|
362
365
|
length=5,
|
|
363
366
|
knl=[0.04, 0.09],
|
|
364
367
|
ksl=[0.02, 0.01],
|
|
365
|
-
rot_s_rad=tilt,
|
|
366
368
|
)
|
|
367
369
|
else:
|
|
368
370
|
raise ValueError(f"Test not implemented for {element_type}")
|
|
@@ -398,6 +400,7 @@ def test_misalign_dedicated_vs_beam_element(test_context, element_type):
|
|
|
398
400
|
transformed_element.rot_x_rad = phi
|
|
399
401
|
transformed_element.rot_y_rad = theta
|
|
400
402
|
transformed_element.rot_s_rad_no_frame = psi
|
|
403
|
+
transformed_element.rot_s_rad = tilt
|
|
401
404
|
transformed_element.rot_shift_anchor = anchor
|
|
402
405
|
|
|
403
406
|
line_test = xt.Line(elements=[transformed_element])
|
|
@@ -412,6 +415,16 @@ def test_misalign_dedicated_vs_beam_element(test_context, element_type):
|
|
|
412
415
|
xo.assert_allclose(p_ref.zeta, p_test.zeta, atol=1e-15, rtol=1e-15)
|
|
413
416
|
xo.assert_allclose(p_ref.s, p_test.s, atol=1e-15, rtol=1e-15)
|
|
414
417
|
|
|
418
|
+
# Check backtrak
|
|
419
|
+
line_test.track(p_test, backtrack=True)
|
|
420
|
+
xo.assert_allclose(p_test.x, p0.x, atol=1e-14, rtol=1e-14)
|
|
421
|
+
xo.assert_allclose(p_test.px, p0.px, atol=1e-14, rtol=1e-14)
|
|
422
|
+
xo.assert_allclose(p_test.y, p0.y, atol=1e-14, rtol=1e-14)
|
|
423
|
+
xo.assert_allclose(p_test.py, p0.py, atol=1e-14, rtol=1e-14)
|
|
424
|
+
xo.assert_allclose(p_test.delta, p0.delta, atol=1e-14, rtol=1e-14)
|
|
425
|
+
xo.assert_allclose(p_test.zeta, p0.zeta, atol=1e-14, rtol=1e-14)
|
|
426
|
+
xo.assert_allclose(p_test.s, p0.s, atol=1e-14, rtol=1e-14)
|
|
427
|
+
|
|
415
428
|
def test_errors_on_slices():
|
|
416
429
|
|
|
417
430
|
env = xt.Environment()
|
|
@@ -190,3 +190,44 @@ def test_particles_energy_coordinates():
|
|
|
190
190
|
xo.assert_allclose(delta_small, ptau_small/beta0, rtol=0, atol=1e-8)
|
|
191
191
|
xo.assert_allclose(delta_small, pzeta_small, rtol=0, atol=1e-8)
|
|
192
192
|
xo.assert_allclose(beta_small, beta0 + (1 - beta0**2) * ptau_small, rtol=0, atol=1e-8)
|
|
193
|
+
|
|
194
|
+
def test_energy0_setter():
|
|
195
|
+
|
|
196
|
+
p = xt.Particles('electron', beta0=[0.6, 0.7, 0.8])
|
|
197
|
+
xo.assert_allclose(p.q0, -1, rtol=0, atol=1e-15)
|
|
198
|
+
xo.assert_allclose(p.mass0, xt.ELECTRON_MASS_EV, rtol=0, atol=1e-15)
|
|
199
|
+
|
|
200
|
+
beta0_expected = np.array([0.6, 0.7, 0.8])
|
|
201
|
+
gamma0_expected = 1 / np.sqrt(1 - beta0_expected**2)
|
|
202
|
+
energy0_expected = p.mass0 * gamma0_expected
|
|
203
|
+
kin_energy0_expected = energy0_expected - p.mass0
|
|
204
|
+
p0c_expected = p.mass0 * gamma0_expected * beta0_expected
|
|
205
|
+
xo.assert_allclose(p.beta0, beta0_expected, rtol=1e-14, atol=1e-14)
|
|
206
|
+
xo.assert_allclose(p.gamma0, gamma0_expected, rtol=1e-14, atol=1e-14)
|
|
207
|
+
xo.assert_allclose(p.energy0, energy0_expected, rtol=1e-14, atol=1e-14)
|
|
208
|
+
xo.assert_allclose(p.kinetic_energy0, kin_energy0_expected, rtol=1e-14, atol=1e-14)
|
|
209
|
+
xo.assert_allclose(p.p0c, p0c_expected, rtol=1e-14, atol=1e-14)
|
|
210
|
+
|
|
211
|
+
p.energy0[:1] = p.energy0[1]
|
|
212
|
+
beta0_expected = np.array([0.7, 0.7, 0.8])
|
|
213
|
+
gamma0_expected = 1 / np.sqrt(1 - beta0_expected**2)
|
|
214
|
+
energy0_expected = p.mass0 * gamma0_expected
|
|
215
|
+
kin_energy0_expected = energy0_expected - p.mass0
|
|
216
|
+
p0c_expected = p.mass0 * gamma0_expected * beta0_expected
|
|
217
|
+
xo.assert_allclose(p.beta0, beta0_expected, rtol=1e-14, atol=1e-14)
|
|
218
|
+
xo.assert_allclose(p.gamma0, gamma0_expected, rtol=1e-14, atol=1e-14)
|
|
219
|
+
xo.assert_allclose(p.energy0, energy0_expected, rtol=1e-14, atol=1e-14)
|
|
220
|
+
xo.assert_allclose(p.kinetic_energy0, kin_energy0_expected, rtol=1e-14, atol=1e-14)
|
|
221
|
+
xo.assert_allclose(p.p0c, p0c_expected, rtol=1e-14, atol=1e-14)
|
|
222
|
+
|
|
223
|
+
p.kinetic_energy0[2:] = p.kinetic_energy0[1]
|
|
224
|
+
beta0_expected = np.array([0.7, 0.7, 0.7])
|
|
225
|
+
gamma0_expected = 1 / np.sqrt(1 - beta0_expected**2)
|
|
226
|
+
energy0_expected = p.mass0 * gamma0_expected
|
|
227
|
+
kin_energy0_expected = energy0_expected - p.mass0
|
|
228
|
+
p0c_expected = p.mass0 * gamma0_expected * beta0_expected
|
|
229
|
+
xo.assert_allclose(p.beta0, beta0_expected, rtol=1e-14, atol=1e-14)
|
|
230
|
+
xo.assert_allclose(p.gamma0, gamma0_expected, rtol=1e-14, atol=1e-14)
|
|
231
|
+
xo.assert_allclose(p.energy0, energy0_expected, rtol=1e-14, atol=1e-14)
|
|
232
|
+
xo.assert_allclose(p.kinetic_energy0, kin_energy0_expected, rtol=1e-14, atol=1e-14)
|
|
233
|
+
xo.assert_allclose(p.p0c, p0c_expected, rtol=1e-14, atol=1e-14)
|
|
@@ -149,7 +149,6 @@ def test_survey_with_ref_transformations():
|
|
|
149
149
|
|
|
150
150
|
])
|
|
151
151
|
|
|
152
|
-
line.config.XTRACK_GLOBAL_XY_LIMIT = None
|
|
153
152
|
line.configure_drift_model('exact')
|
|
154
153
|
tw = line.twiss4d(_continue_if_lost=True, betx=1, bety=1, x=1e-3, y=2e-3)
|
|
155
154
|
|
|
@@ -288,7 +287,6 @@ def test_survey_with_h_and_v_bends():
|
|
|
288
287
|
|
|
289
288
|
])
|
|
290
289
|
|
|
291
|
-
line.config.XTRACK_GLOBAL_XY_LIMIT = None
|
|
292
290
|
line.configure_drift_model('exact')
|
|
293
291
|
tw = line.twiss4d(_continue_if_lost=True, betx=1, bety=1, x=1e-3, y=2e-3)
|
|
294
292
|
|
|
@@ -462,7 +460,6 @@ def test_survey_against_madx():
|
|
|
462
460
|
sv_mad = xt.Table(mad.table.survey)
|
|
463
461
|
tw_ptc = xt.Table(mad.table.ptc_twiss)
|
|
464
462
|
|
|
465
|
-
line.config.XTRACK_GLOBAL_XY_LIMIT = None
|
|
466
463
|
line.configure_drift_model('exact')
|
|
467
464
|
|
|
468
465
|
sv = line.survey()
|
|
@@ -44,7 +44,8 @@ def test_test_tilt_shifts_vs_sandwich(test_context, slice_mode, element_type):
|
|
|
44
44
|
xt.XYShift(dx=-shift_x, dy=-shift_y),
|
|
45
45
|
xt.DriftExact(length=-shift_s)
|
|
46
46
|
])
|
|
47
|
-
line_ref.
|
|
47
|
+
line_ref.build_tracker()
|
|
48
|
+
line_ref.tracker.track_flags.XS_FLAG_IGNORE_GLOBAL_APERTURE = True
|
|
48
49
|
|
|
49
50
|
if slice_mode is not None:
|
|
50
51
|
line_test.slice_thick_elements(
|
|
@@ -2005,3 +2005,57 @@ def test_twiss_collective_end_is_len():
|
|
|
2005
2005
|
t2 = line2.twiss4d(betx=1,bety=1,include_collective=True)
|
|
2006
2006
|
|
|
2007
2007
|
xo.assert_allclose(t.betx, t2.betx, atol=1e-12, rtol=0)
|
|
2008
|
+
|
|
2009
|
+
def test_twiss_disable_apertures():
|
|
2010
|
+
|
|
2011
|
+
line = xt.Line(elements=[xt.Drift(length=1.0)])
|
|
2012
|
+
line.particle_ref = xt.Particles(energy0=10e9, mass0=xt.PROTON_MASS_EV)
|
|
2013
|
+
|
|
2014
|
+
# check global aperture
|
|
2015
|
+
tw = line.twiss(betx=1, bety=1, x=2.)
|
|
2016
|
+
xo.assert_allclose(tw.x[-1], 2.)
|
|
2017
|
+
with pytest.raises(AssertionError):
|
|
2018
|
+
line.twiss(betx=1, bety=1, x=2., disable_apertures=False)
|
|
2019
|
+
|
|
2020
|
+
# check limit rect
|
|
2021
|
+
line = xt.Line(elements=[xt.Drift(length=1.0), xt.LimitRect(min_x=0.1)])
|
|
2022
|
+
line.particle_ref = xt.Particles(energy0=10e9, mass0=xt.PROTON_MASS_EV)
|
|
2023
|
+
tw = line.twiss(betx=1, bety=1, x=0)
|
|
2024
|
+
xo.assert_allclose(tw.x[-1], 0.)
|
|
2025
|
+
with pytest.raises(AssertionError):
|
|
2026
|
+
line.twiss(betx=1, bety=1, x=0, disable_apertures=False)
|
|
2027
|
+
|
|
2028
|
+
# check limit racetrack
|
|
2029
|
+
line = xt.Line(elements=[xt.Drift(length=1.0), xt.LimitRacetrack(min_x=0.1)])
|
|
2030
|
+
line.particle_ref = xt.Particles(energy0=10e9, mass0=xt.PROTON_MASS_EV)
|
|
2031
|
+
tw = line.twiss(betx=1, bety=1, x=0)
|
|
2032
|
+
xo.assert_allclose(tw.x[-1], 0.)
|
|
2033
|
+
with pytest.raises(AssertionError):
|
|
2034
|
+
line.twiss(betx=1, bety=1, x=0, disable_apertures=False)
|
|
2035
|
+
|
|
2036
|
+
# check limit ellipse
|
|
2037
|
+
line = xt.Line(elements=[xt.Drift(length=1.0), xt.LimitEllipse(a=0.01, b=0.01)])
|
|
2038
|
+
line.particle_ref = xt.Particles(energy0=10e9, mass0=xt.PROTON_MASS_EV)
|
|
2039
|
+
tw = line.twiss(betx=1, bety=1, x=0.02)
|
|
2040
|
+
xo.assert_allclose(tw.x[-1], 0.02)
|
|
2041
|
+
with pytest.raises(AssertionError):
|
|
2042
|
+
line.twiss(betx=1, bety=1, x=0.02, disable_apertures=False)
|
|
2043
|
+
|
|
2044
|
+
# Check limit polygon
|
|
2045
|
+
line = xt.Line(elements=[xt.Drift(length=1.0), xt.LimitPolygon(
|
|
2046
|
+
x_vertices=[0.1, 0.1, -0.1, -0.1],
|
|
2047
|
+
y_vertices=[0.1, -0.1, -0.1, 0.1])])
|
|
2048
|
+
line.particle_ref = xt.Particles(energy0=10e9, mass0=xt.PROTON_MASS_EV)
|
|
2049
|
+
tw = line.twiss(betx=1, bety=1, x=0.2, y=0)
|
|
2050
|
+
xo.assert_allclose(tw.x[-1], 0.2)
|
|
2051
|
+
with pytest.raises(AssertionError):
|
|
2052
|
+
line.twiss(betx=1, bety=1, x=0.2, y=0, disable_apertures=False)
|
|
2053
|
+
|
|
2054
|
+
# Check rectellipse
|
|
2055
|
+
line = xt.Line(elements=[xt.Drift(length=1.0), xt.LimitRectEllipse(
|
|
2056
|
+
a=0.1, b=0.1)])
|
|
2057
|
+
line.particle_ref = xt.Particles(energy0=10e9, mass0=xt.PROTON_MASS_EV)
|
|
2058
|
+
tw = line.twiss(betx=1, bety=1, x=0.2, y=0)
|
|
2059
|
+
xo.assert_allclose(tw.x[-1], 0.2)
|
|
2060
|
+
with pytest.raises(AssertionError):
|
|
2061
|
+
line.twiss(betx=1, bety=1, x=0.2, y=0, disable_apertures=False)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.90.1'
|
|
@@ -110,12 +110,12 @@ def _generate_track_local_particle_with_transformations(
|
|
|
110
110
|
element_shape = 'curved'
|
|
111
111
|
misalign_arguments = 'shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, angle, rot_s_rad'
|
|
112
112
|
get_angle = f'double const angle = {element_name}Data_get{add_to_call}_angle(el)'
|
|
113
|
-
get_rot_s_rad = 'double const rot_s_rad = atan2(_sin_rot_s, _cos_rot_s)'
|
|
114
113
|
else:
|
|
115
114
|
element_shape = 'straight'
|
|
116
|
-
misalign_arguments = 'shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length'
|
|
115
|
+
misalign_arguments = 'shift_x, shift_y, shift_s, rot_y_rad, rot_x_rad, rot_s_rad_no_frame, anchor, length, rot_s_rad'
|
|
117
116
|
get_angle = ''
|
|
118
117
|
get_rot_s_rad = ''
|
|
118
|
+
get_rot_s_rad = 'double const rot_s_rad = atan2(_sin_rot_s, _cos_rot_s)'
|
|
119
119
|
|
|
120
120
|
if 'isthick' in xofields:
|
|
121
121
|
get_length = (
|
|
@@ -143,6 +143,7 @@ def _generate_track_local_particle_with_transformations(
|
|
|
143
143
|
f' {get_length};\n'
|
|
144
144
|
f' {get_angle};\n'
|
|
145
145
|
f' double const anchor = {element_name}Data_get{add_to_call}_rot_shift_anchor(el);\n'
|
|
146
|
+
f' int8_t const backtrack = LocalParticle_check_track_flag(part0, XS_FLAG_BACKTRACK);\n'
|
|
146
147
|
'\n')
|
|
147
148
|
|
|
148
149
|
if rot_and_shift_from_parent:
|
|
@@ -164,11 +165,11 @@ def _generate_track_local_particle_with_transformations(
|
|
|
164
165
|
)
|
|
165
166
|
|
|
166
167
|
source += (
|
|
167
|
-
|
|
168
|
-
'
|
|
169
|
-
'
|
|
170
|
-
'
|
|
171
|
-
'
|
|
168
|
+
' if (!backtrack) {\n'
|
|
169
|
+
f' track_misalignment_entry_{element_shape}(part0, {misalign_arguments}, backtrack);'
|
|
170
|
+
' } else {\n'
|
|
171
|
+
f' track_misalignment_exit_{element_shape}(part0, {misalign_arguments}, backtrack);\n'
|
|
172
|
+
' }\n'
|
|
172
173
|
'\n'
|
|
173
174
|
' /* Spin tracking is disabled by the synrad compile flag */\n'
|
|
174
175
|
' #ifndef XTRACK_MULTIPOLE_NO_SYNRAD\n'
|
|
@@ -200,6 +201,7 @@ def _generate_track_local_particle_with_transformations(
|
|
|
200
201
|
f' {get_length};\n'
|
|
201
202
|
f' {get_angle};\n'
|
|
202
203
|
f' double const anchor = {element_name}Data_get{add_to_call}_rot_shift_anchor(el);\n'
|
|
204
|
+
f' int8_t const backtrack = LocalParticle_check_track_flag(part0, XS_FLAG_BACKTRACK);\n'
|
|
203
205
|
'\n'
|
|
204
206
|
' /* Spin tracking is disabled by the synrad compile flag */\n'
|
|
205
207
|
' #ifndef XTRACK_MULTIPOLE_NO_SYNRAD\n'
|
|
@@ -216,11 +218,11 @@ def _generate_track_local_particle_with_transformations(
|
|
|
216
218
|
' //end_per_particle_block\n'
|
|
217
219
|
' #endif\n'
|
|
218
220
|
'\n'
|
|
219
|
-
'
|
|
220
|
-
'
|
|
221
|
-
'
|
|
222
|
-
'
|
|
223
|
-
|
|
221
|
+
' if (!backtrack) {\n'
|
|
222
|
+
f' track_misalignment_exit_{element_shape}(part0, {misalign_arguments}, backtrack);'
|
|
223
|
+
' } else {\n'
|
|
224
|
+
f' track_misalignment_entry_{element_shape}(part0, {misalign_arguments}, backtrack);\n'
|
|
225
|
+
' }\n'
|
|
224
226
|
'}\n'
|
|
225
227
|
)
|
|
226
228
|
else:
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
GPUFUN
|
|
13
13
|
void LimitEllipse_track_local_particle(LimitEllipseData el, LocalParticle* part0){
|
|
14
14
|
|
|
15
|
+
if(LocalParticle_check_track_flag(part0, XS_FLAG_IGNORE_LOCAL_APERTURE)){
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
double const a_squ = LimitEllipseData_get_a_squ(el);
|
|
17
20
|
double const b_squ = LimitEllipseData_get_b_squ(el);
|
|
@@ -16,6 +16,10 @@ GPUFUN
|
|
|
16
16
|
void LimitPolygon_track_local_particle(LimitPolygonData el,
|
|
17
17
|
LocalParticle* part0){
|
|
18
18
|
|
|
19
|
+
if(LocalParticle_check_track_flag(part0, XS_FLAG_IGNORE_LOCAL_APERTURE)){
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
int64_t N_edg = LimitPolygonData_len_x_vertices(el);
|
|
20
24
|
|
|
21
25
|
START_PER_PARTICLE_BLOCK(part0, part);
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
GPUFUN
|
|
13
13
|
void LimitRacetrack_track_local_particle(LimitRacetrackData el, LocalParticle* part0){
|
|
14
14
|
|
|
15
|
+
if(LocalParticle_check_track_flag(part0, XS_FLAG_IGNORE_LOCAL_APERTURE)){
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
double const min_x = LimitRacetrackData_get_min_x(el);
|
|
16
20
|
double const max_x = LimitRacetrackData_get_max_x(el);
|
|
17
21
|
double const min_y = LimitRacetrackData_get_min_y(el);
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
GPUFUN
|
|
10
10
|
void LimitRect_track_local_particle(LimitRectData el, LocalParticle* part0){
|
|
11
11
|
|
|
12
|
+
if(LocalParticle_check_track_flag(part0, XS_FLAG_IGNORE_LOCAL_APERTURE)){
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
double const min_x = LimitRectData_get_min_x(el);
|
|
13
17
|
double const max_x = LimitRectData_get_max_x(el);
|
|
14
18
|
double const min_y = LimitRectData_get_min_y(el);
|