xtrack 0.89.0__tar.gz → 0.89.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.89.0/xtrack.egg-info → xtrack-0.89.2}/PKG-INFO +1 -1
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_madnginterface.py +38 -1
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_tapering.py +2 -2
- xtrack-0.89.2/xtrack/_version.py +1 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/base_element.py +3 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/dipoleedge.h +9 -10
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/linesegmentmap.h +9 -2
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet.h +2 -2
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet.template.h +4 -4
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_rf.h +17 -9
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_rf.template.h +17 -9
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/headers/synrad_spectrum.h +16 -16
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/line.py +9 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/mad_writer.py +30 -1
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/particles.py +9 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/tapering.py +2 -3
- xtrack-0.89.2/xtrack/track_flags.py +70 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/tracker.py +16 -4
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/twiss.py +108 -69
- {xtrack-0.89.0 → xtrack-0.89.2/xtrack.egg-info}/PKG-INFO +1 -1
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack.egg-info/SOURCES.txt +1 -1
- xtrack-0.89.0/tests/test_periodic_symmetric_twiss_and_match.py +0 -163
- xtrack-0.89.0/xtrack/_version.py +0 -1
- {xtrack-0.89.0 → xtrack-0.89.2}/LICENSE +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/MANIFEST.in +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/README.md +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/base_classes.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/elements.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/line.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/particles.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/pyproject.toml +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/setup.cfg +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/setup.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_acceleration.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_aperture_table.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_apertures.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_attr_replicas_and_slices.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_bucket_with_ref_energy_change.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_coasting.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_collimation.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_coupling_edwards_teng.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_electron_cooler.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_element_characterization_functions.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_elements.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_elements_thick.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_environment.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_fcc_ee_solenoid_correction.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_footprint.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_full_rings.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_h6_sps_beamline.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_hvkick.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_ions.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_legacy_multiline_to_env.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_lhc_env.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_line.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_load.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_load_vars.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_lumi.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_mad_writer.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_madloader.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_magnet.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_nested.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_misalign.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_multi_bunch_gauss.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_multiline.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_multisetter.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_multispecies.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_native_madloader.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_optimize_for_tracking.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_particles.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_particles_basics.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_particles_pdg.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_pipeline.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_prebuild_kernels.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_quadrupole_fringe_ptc.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_quadrupole_wedge.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_radial_steering.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_radiation.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_radiation_equilibrium_emittances_thick.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_radiation_integrals.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_random_gen.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_rbend_rbarc.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_rbend_straight_body.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_rf_track.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_rotation_signs.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_seeds.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_slice_and_insert_with_replicas.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_slice_elements.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_slicing.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_solenoid_bz_map_vs_boris_legacy.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_spin.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_sps_thick.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_survey.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_thick_kickers_rf_crab.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_tilt_shifts.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_tracker.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_trajectory_correcton.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_twiss.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_vs_madx.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/tests/test_xmask_orbit_correction.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/aperture_meas.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/crab_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/default_magnet_config.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_exact.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_exact_slice.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_crab_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_multipole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_rbend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/drift_slice_uniform_solenoid.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/electroncooler.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/legacy_solenoid.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/magnet.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/magnet_drift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/magnet_edge.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/magnet_kick.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/marker.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/misalignment.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/multipoleedge.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/rbend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/slnd.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/temprf.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_crab_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_multipole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_rbend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thick_slice_uniform_solenoid.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_crab_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_multipole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_octupole_entry.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_octupole_exit.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_entry.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_exit.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_rbend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_rbend_entry.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_rbend_exit.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_sextupole_entry.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_sextupole_exit.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_uniform_solenoid_entry.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/thin_slice_uniform_solenoid_exit.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_cavity.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_drift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_legacy_solenoid.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_legacy_solenoid_multipolar_components.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_legacy_solenoid_radiation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet_configure.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet_drift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet_edge.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet_kick.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_magnet_radiation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_misalignments.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_xyshift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/variable_solenoid.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/slice_base.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/slice_elements_drift.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/slice_elements_edge.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/slice_elements_thick.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/beam_elements/slice_elements_thin.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/environment.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/footprint.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/general.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/headers/checks.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/headers/constants.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/headers/track.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/internal_record.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/json.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/load.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/lumi.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/mad_loader.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/mad_parser/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/mad_parser/loader.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/mad_parser/madx.lark +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/mad_parser/parse.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/madng_interface.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/match.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/multiline.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/multiline_legacy/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/multiline_legacy/multiline_legacy.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/multiline_legacy/shared_knobs.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/constants.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/masses.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/pdg.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/random/random_src/uniform_accurate.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/slicing.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/survey.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/svgutils/__init__.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/svgutils/parser.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/svgutils/path.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/svgutils/svgutils.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/synctime.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/targets.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/tracker_data.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/trajectory_correction.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack/twissplot.py +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.89.0 → xtrack-0.89.2}/xtrack.egg-info/top_level.txt +0 -0
|
@@ -126,4 +126,41 @@ def test_madng_survey():
|
|
|
126
126
|
xo.assert_allclose(survey.angle, xsurvey.angle, atol=1e-5, rtol=0)
|
|
127
127
|
xo.assert_allclose(survey.tilt, xsurvey.rot_s_rad, atol=1e-5, rtol=0)
|
|
128
128
|
# Length doesn't work because of multipoles.
|
|
129
|
-
#xo.assert_allclose(survey.length, xsurvey.length, atol=1e-5, rtol=0)
|
|
129
|
+
#xo.assert_allclose(survey.length, xsurvey.length, atol=1e-5, rtol=0)
|
|
130
|
+
|
|
131
|
+
def test_madng_conversion_drift_slice():
|
|
132
|
+
|
|
133
|
+
env = xt.Environment()
|
|
134
|
+
env.particle_ref = xt.Particles(p0c=1e9)
|
|
135
|
+
|
|
136
|
+
line = env.new_line(length=10, components=[
|
|
137
|
+
env.new('q1', xt.Quadrupole, length=1, k1=0.3, at=4),
|
|
138
|
+
env.new('q2', xt.Quadrupole, length=1, k1=-0.3, at=6)
|
|
139
|
+
])
|
|
140
|
+
|
|
141
|
+
line.insert('m', xt.Marker(), at=2)
|
|
142
|
+
|
|
143
|
+
tt = line.get_table()
|
|
144
|
+
# is:
|
|
145
|
+
# Table: 8 rows, 11 cols
|
|
146
|
+
# name s element_type isthick isreplica parent_name ...
|
|
147
|
+
# drift_1..0 0 DriftSlice True False drift_1
|
|
148
|
+
# m 2 Marker False False None
|
|
149
|
+
# drift_1..1 2 DriftSlice True False drift_1
|
|
150
|
+
# q1 3.5 Quadrupole True False None
|
|
151
|
+
# drift_2 4.5 Drift True False None
|
|
152
|
+
# q2 5.5 Quadrupole True False None
|
|
153
|
+
# drift_3 6.5 Drift True False None
|
|
154
|
+
# _end_point 10 False False None
|
|
155
|
+
|
|
156
|
+
assert np.all(tt.name == [
|
|
157
|
+
'drift_1..0', 'm', 'drift_1..1', 'q1', 'drift_2', 'q2', 'drift_3', '_end_point'])
|
|
158
|
+
xo.assert_allclose(tt.s, [0, 2, 2, 3.5, 4.5, 5.5, 6.5, 10], atol=1e-10)
|
|
159
|
+
assert np.all(tt.element_type == [
|
|
160
|
+
'DriftSlice', 'Marker', 'DriftSlice', 'Quadrupole', 'Drift', 'Quadrupole', 'Drift', ''])
|
|
161
|
+
|
|
162
|
+
tw = line.twiss4d()
|
|
163
|
+
tw_ng = line.madng_twiss(normal_form=False)
|
|
164
|
+
|
|
165
|
+
xo.assert_allclose(tw_ng.beta11_ng, tw.betx, rtol=1e-8)
|
|
166
|
+
xo.assert_allclose(tw_ng.beta22_ng, tw.bety, rtol=1e-8)
|
|
@@ -29,7 +29,7 @@ def test_tapering_and_twiss_with_radiation():
|
|
|
29
29
|
|
|
30
30
|
# Initial twiss (no radiation)
|
|
31
31
|
line.configure_radiation(model=None)
|
|
32
|
-
tw_no_rad = line.twiss(method='4d'
|
|
32
|
+
tw_no_rad = line.twiss(method='4d')
|
|
33
33
|
|
|
34
34
|
assert tw_no_rad.radiation_method == None
|
|
35
35
|
|
|
@@ -145,7 +145,7 @@ def test_tapering_zero_mean():
|
|
|
145
145
|
line.particle_ref.p0c = 4e9 # eV
|
|
146
146
|
|
|
147
147
|
line.configure_radiation(model=None)
|
|
148
|
-
tw_no_rad = line.twiss(method='4d'
|
|
148
|
+
tw_no_rad = line.twiss(method='4d')
|
|
149
149
|
|
|
150
150
|
###############################################
|
|
151
151
|
# Enable radiation and compensate energy loss #
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.89.2'
|
|
@@ -15,6 +15,7 @@ from xobjects.hybrid_class import _build_xofields_dict
|
|
|
15
15
|
from .general import _pkg_root
|
|
16
16
|
from .internal_record import RecordIdentifier, RecordIndex, generate_get_record
|
|
17
17
|
from .particles import Particles
|
|
18
|
+
from .track_flags import c_header_flag_mapping
|
|
18
19
|
|
|
19
20
|
start_per_part_block = """
|
|
20
21
|
{
|
|
@@ -280,6 +281,7 @@ def _generate_per_particle_kernel_from_local_particle_function(
|
|
|
280
281
|
for (int64_t batch_id = 0; batch_id < num_threads; batch_id++) { //only_for_context cpu_openmp
|
|
281
282
|
LocalParticle lpart;
|
|
282
283
|
lpart.io_buffer = io_buffer;
|
|
284
|
+
lpart.track_flags = 0;
|
|
283
285
|
int64_t part_id = batch_id * chunk_size; //only_for_context cpu_openmp
|
|
284
286
|
int64_t end_id = (batch_id + 1) * chunk_size; //only_for_context cpu_openmp
|
|
285
287
|
if (end_id > num_particles_to_track) end_id = num_particles_to_track; //only_for_context cpu_openmp
|
|
@@ -452,6 +454,7 @@ class MetaBeamElement(xo.MetaHybridClass):
|
|
|
452
454
|
_pkg_root.joinpath('headers','particle_states.h'),
|
|
453
455
|
_pkg_root.joinpath('beam_elements', 'elements_src', 'track_srotation.h'),
|
|
454
456
|
_pkg_root.joinpath('beam_elements', 'elements_src', 'track_drift.h'),
|
|
457
|
+
c_header_flag_mapping
|
|
455
458
|
]
|
|
456
459
|
kernels = {}
|
|
457
460
|
|
|
@@ -18,22 +18,21 @@ void DipoleEdge_track_local_particle(DipoleEdgeData el, LocalParticle* part0){
|
|
|
18
18
|
|
|
19
19
|
int64_t const model = DipoleEdgeData_get_model(el);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
#endif
|
|
21
|
+
double delta_taper = 0.0;
|
|
22
|
+
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
23
|
+
if (!LocalParticle_check_track_flag(part0, XS_FLAG_SR_TAPER)){
|
|
24
|
+
delta_taper = DipoleEdgeData_get_delta_taper(el);
|
|
25
|
+
}
|
|
27
26
|
#endif
|
|
28
27
|
|
|
29
28
|
if (model == 0){
|
|
30
29
|
double r21 = DipoleEdgeData_get_r21(el);
|
|
31
30
|
double r43 = DipoleEdgeData_get_r43(el);
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
if (!LocalParticle_check_track_flag(part0, XS_FLAG_SR_TAPER)){
|
|
34
33
|
r21 = r21 * (1 + delta_taper);
|
|
35
34
|
r43 = r43 * (1 + delta_taper);
|
|
36
|
-
|
|
35
|
+
}
|
|
37
36
|
|
|
38
37
|
#ifdef XSUITE_BACKTRACK
|
|
39
38
|
r21 = -r21;
|
|
@@ -41,11 +40,11 @@ void DipoleEdge_track_local_particle(DipoleEdgeData el, LocalParticle* part0){
|
|
|
41
40
|
#endif
|
|
42
41
|
|
|
43
42
|
START_PER_PARTICLE_BLOCK(part0, part);
|
|
44
|
-
|
|
43
|
+
if (LocalParticle_check_track_flag(part0, XS_FLAG_SR_TAPER)){
|
|
45
44
|
double const delta_taper = LocalParticle_get_delta(part);
|
|
46
45
|
r21 = r21 * (1 + delta_taper);
|
|
47
46
|
r43 = r43 * (1 + delta_taper);
|
|
48
|
-
|
|
47
|
+
}
|
|
49
48
|
|
|
50
49
|
DipoleEdgeLinear_single_particle(part, r21, r43);
|
|
51
50
|
END_PER_PARTICLE_BLOCK;
|
|
@@ -204,6 +204,8 @@ void longitudinal_motion(LocalParticle *part0,
|
|
|
204
204
|
double const bucket_length = LineSegmentMapData_get_bucket_length(el)*LocalParticle_get_beta0(part0)*C_LIGHT;
|
|
205
205
|
double const sin_s = sin(2 * PI * qs);
|
|
206
206
|
double const cos_s = cos(2 * PI * qs);
|
|
207
|
+
uint8_t kill_energy_kick = LocalParticle_check_track_flag(
|
|
208
|
+
part0, XS_FLAG_KILL_CAVITY_KICK);
|
|
207
209
|
START_PER_PARTICLE_BLOCK(part0, part);
|
|
208
210
|
// We set cos_s = 999 if long map is to be skipped
|
|
209
211
|
double shift = 0.0;
|
|
@@ -215,7 +217,9 @@ void longitudinal_motion(LocalParticle *part0,
|
|
|
215
217
|
double const new_pzeta = sin_s * LocalParticle_get_zeta(part) / bets + cos_s * LocalParticle_get_pzeta(part);
|
|
216
218
|
|
|
217
219
|
LocalParticle_set_zeta(part, new_zeta+shift);
|
|
218
|
-
|
|
220
|
+
if (!kill_energy_kick){
|
|
221
|
+
LocalParticle_update_pzeta(part, new_pzeta);
|
|
222
|
+
}
|
|
219
223
|
END_PER_PARTICLE_BLOCK;
|
|
220
224
|
}
|
|
221
225
|
else if (mode_flag==2){ // non-linear motion
|
|
@@ -325,6 +329,8 @@ GPUFUN
|
|
|
325
329
|
void correlated_radiation_damping(LocalParticle *part0,
|
|
326
330
|
LineSegmentMapData el){
|
|
327
331
|
|
|
332
|
+
uint8_t kill_energy_kick = LocalParticle_check_track_flag(
|
|
333
|
+
part0, XS_FLAG_KILL_CAVITY_KICK);
|
|
328
334
|
START_PER_PARTICLE_BLOCK(part0, part);
|
|
329
335
|
double in[6];
|
|
330
336
|
in[0] = LocalParticle_get_x(part);
|
|
@@ -345,7 +351,8 @@ void correlated_radiation_damping(LocalParticle *part0,
|
|
|
345
351
|
LocalParticle_set_y(part, out[2]);
|
|
346
352
|
LocalParticle_set_py(part, out[3]);
|
|
347
353
|
LocalParticle_set_zeta(part, out[4]);
|
|
348
|
-
|
|
354
|
+
if (!kill_energy_kick){
|
|
355
|
+
LocalParticle_update_pzeta(part,out[5]);}
|
|
349
356
|
END_PER_PARTICLE_BLOCK;
|
|
350
357
|
}
|
|
351
358
|
|
|
@@ -400,12 +400,12 @@ void track_magnet_particles(
|
|
|
400
400
|
#endif
|
|
401
401
|
|
|
402
402
|
// Tapering
|
|
403
|
-
|
|
403
|
+
if (LocalParticle_check_track_flag(part0, XS_FLAG_SR_TAPER)){
|
|
404
404
|
part0->ipart = 0;
|
|
405
405
|
delta_taper = LocalParticle_get_delta(part0); // I can use part0 because
|
|
406
406
|
// there is only one particle
|
|
407
407
|
// when doing the tapering
|
|
408
|
-
|
|
408
|
+
}
|
|
409
409
|
|
|
410
410
|
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
411
411
|
if (radiation_flag){
|
|
@@ -319,12 +319,12 @@ void track_magnet_particles(
|
|
|
319
319
|
#endif
|
|
320
320
|
|
|
321
321
|
// Tapering
|
|
322
|
-
|
|
322
|
+
if (LocalParticle_check_track_flag(part0, XS_FLAG_SR_TAPER)){
|
|
323
323
|
part0->ipart = 0;
|
|
324
324
|
delta_taper = LocalParticle_get_delta(part0); // I can use part0 because
|
|
325
325
|
// there is only one particle
|
|
326
326
|
// when doing the tapering
|
|
327
|
-
|
|
327
|
+
}
|
|
328
328
|
|
|
329
329
|
#ifndef XTRACK_MULTIPOLE_NO_SYNRAD
|
|
330
330
|
if (radiation_flag){
|
|
@@ -348,7 +348,7 @@ void track_magnet_particles(
|
|
|
348
348
|
if (rbend_model == 2){
|
|
349
349
|
// straight body --> curvature in the edges
|
|
350
350
|
START_PER_PARTICLE_BLOCK(part0, part);
|
|
351
|
-
YRotation_single_particle(part, sin_rbha, cos_rbha, sin_rbha/cos_rbha);
|
|
351
|
+
YRotation_single_particle(part, -sin_rbha, cos_rbha, -sin_rbha/cos_rbha);
|
|
352
352
|
LocalParticle_add_to_x(part, -dx_rb);
|
|
353
353
|
END_PER_PARTICLE_BLOCK;
|
|
354
354
|
}
|
|
@@ -500,7 +500,7 @@ void track_magnet_particles(
|
|
|
500
500
|
// straight body --> curvature in the edges
|
|
501
501
|
START_PER_PARTICLE_BLOCK(part0, part);
|
|
502
502
|
LocalParticle_add_to_x(part, dx_rb); // shift by half sagitta
|
|
503
|
-
YRotation_single_particle(part, sin_rbha, cos_rbha, sin_rbha/cos_rbha);
|
|
503
|
+
YRotation_single_particle(part, -sin_rbha, cos_rbha, -sin_rbha/cos_rbha);
|
|
504
504
|
END_PER_PARTICLE_BLOCK;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
@@ -28,7 +28,8 @@ void track_rf_kick_single_particle(
|
|
|
28
28
|
GPUGLMEM const double* knl,
|
|
29
29
|
GPUGLMEM const double* ksl,
|
|
30
30
|
GPUGLMEM const double* pn,
|
|
31
|
-
GPUGLMEM const double* ps
|
|
31
|
+
GPUGLMEM const double* ps,
|
|
32
|
+
const uint8_t kill_energy_kick
|
|
32
33
|
){
|
|
33
34
|
|
|
34
35
|
double phase0 = 0;
|
|
@@ -140,11 +141,13 @@ void track_rf_kick_single_particle(
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
if (!kill_energy_kick) {
|
|
145
|
+
#ifdef XTRACK_CAVITY_PRESERVE_ANGLE
|
|
146
|
+
LocalParticle_add_to_energy(part, energy_kick + rfmultipole_energy_kick, 0);
|
|
147
|
+
#else
|
|
148
|
+
LocalParticle_add_to_energy(part, energy_kick + rfmultipole_energy_kick, 1);
|
|
149
|
+
#endif
|
|
150
|
+
}
|
|
148
151
|
|
|
149
152
|
}
|
|
150
153
|
|
|
@@ -167,7 +170,8 @@ void track_rf_body_single_particle(
|
|
|
167
170
|
GPUGLMEM const double* ps,
|
|
168
171
|
const int64_t num_kicks,
|
|
169
172
|
const int8_t drift_model,
|
|
170
|
-
const int8_t integrator
|
|
173
|
+
const int8_t integrator,
|
|
174
|
+
const uint8_t kill_energy_kick
|
|
171
175
|
) {
|
|
172
176
|
|
|
173
177
|
#define RF_KICK(part, kick_weight) \
|
|
@@ -175,7 +179,8 @@ void track_rf_body_single_particle(
|
|
|
175
179
|
part, voltage * (kick_weight), frequency, lag,\
|
|
176
180
|
transverse_voltage * (kick_weight), transverse_lag,\
|
|
177
181
|
absolute_time, order, \
|
|
178
|
-
factor_knl_ksl * (kick_weight), knl, ksl, pn, ps
|
|
182
|
+
factor_knl_ksl * (kick_weight), knl, ksl, pn, ps,\
|
|
183
|
+
kill_energy_kick\
|
|
179
184
|
)
|
|
180
185
|
|
|
181
186
|
#define RF_DRIFT(part, dlength) \
|
|
@@ -318,6 +323,8 @@ void track_rf_particles(
|
|
|
318
323
|
) {
|
|
319
324
|
|
|
320
325
|
double factor_knl_ksl = 1.0;
|
|
326
|
+
uint8_t kill_energy_kick = LocalParticle_check_track_flag(
|
|
327
|
+
part0, XS_FLAG_KILL_CAVITY_KICK);
|
|
321
328
|
|
|
322
329
|
// Backtracking
|
|
323
330
|
#ifdef XSUITE_BACKTRACK
|
|
@@ -397,7 +404,8 @@ void track_rf_particles(
|
|
|
397
404
|
ps,
|
|
398
405
|
num_kicks,
|
|
399
406
|
drift_model,
|
|
400
|
-
integrator
|
|
407
|
+
integrator,
|
|
408
|
+
kill_energy_kick
|
|
401
409
|
);
|
|
402
410
|
END_PER_PARTICLE_BLOCK;
|
|
403
411
|
|
|
@@ -28,7 +28,8 @@ void track_rf_kick_single_particle(
|
|
|
28
28
|
GPUGLMEM const double* knl,
|
|
29
29
|
GPUGLMEM const double* ksl,
|
|
30
30
|
GPUGLMEM const double* pn,
|
|
31
|
-
GPUGLMEM const double* ps
|
|
31
|
+
GPUGLMEM const double* ps,
|
|
32
|
+
const uint8_t kill_energy_kick
|
|
32
33
|
){
|
|
33
34
|
|
|
34
35
|
double phase0 = 0;
|
|
@@ -140,11 +141,13 @@ void track_rf_kick_single_particle(
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
if (!kill_energy_kick) {
|
|
145
|
+
#ifdef XTRACK_CAVITY_PRESERVE_ANGLE
|
|
146
|
+
LocalParticle_add_to_energy(part, energy_kick + rfmultipole_energy_kick, 0);
|
|
147
|
+
#else
|
|
148
|
+
LocalParticle_add_to_energy(part, energy_kick + rfmultipole_energy_kick, 1);
|
|
149
|
+
#endif
|
|
150
|
+
}
|
|
148
151
|
|
|
149
152
|
}
|
|
150
153
|
|
|
@@ -167,7 +170,8 @@ void track_rf_body_single_particle(
|
|
|
167
170
|
GPUGLMEM const double* ps,
|
|
168
171
|
const int64_t num_kicks,
|
|
169
172
|
const int8_t drift_model,
|
|
170
|
-
const int8_t integrator
|
|
173
|
+
const int8_t integrator,
|
|
174
|
+
const uint8_t kill_energy_kick
|
|
171
175
|
) {
|
|
172
176
|
|
|
173
177
|
#define RF_KICK(part, kick_weight) \
|
|
@@ -175,7 +179,8 @@ void track_rf_body_single_particle(
|
|
|
175
179
|
part, voltage * (kick_weight), frequency, lag,\
|
|
176
180
|
transverse_voltage * (kick_weight), transverse_lag,\
|
|
177
181
|
absolute_time, order, \
|
|
178
|
-
factor_knl_ksl * (kick_weight), knl, ksl, pn, ps
|
|
182
|
+
factor_knl_ksl * (kick_weight), knl, ksl, pn, ps,\
|
|
183
|
+
kill_energy_kick\
|
|
179
184
|
)
|
|
180
185
|
|
|
181
186
|
#define RF_DRIFT(part, dlength) \
|
|
@@ -237,6 +242,8 @@ void track_rf_particles(
|
|
|
237
242
|
) {
|
|
238
243
|
|
|
239
244
|
double factor_knl_ksl = 1.0;
|
|
245
|
+
uint8_t kill_energy_kick = LocalParticle_check_track_flag(
|
|
246
|
+
part0, XS_FLAG_KILL_CAVITY_KICK);
|
|
240
247
|
|
|
241
248
|
// Backtracking
|
|
242
249
|
#ifdef XSUITE_BACKTRACK
|
|
@@ -316,7 +323,8 @@ void track_rf_particles(
|
|
|
316
323
|
ps,
|
|
317
324
|
num_kicks,
|
|
318
325
|
drift_model,
|
|
319
|
-
integrator
|
|
326
|
+
integrator,
|
|
327
|
+
kill_energy_kick
|
|
320
328
|
);
|
|
321
329
|
END_PER_PARTICLE_BLOCK;
|
|
322
330
|
|
|
@@ -46,33 +46,33 @@ void synrad_average_kick(LocalParticle* part, double B_T, double lpath,
|
|
|
46
46
|
}
|
|
47
47
|
#endif
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
if (LocalParticle_check_track_flag(part, XS_FLAG_SR_KICK_SAME_AS_FIRST)){
|
|
50
|
+
if (part -> ipart == 0){
|
|
51
|
+
*dp_record = LocalParticle_get_delta(part);
|
|
52
|
+
*dpx_record = LocalParticle_get_px(part);
|
|
53
|
+
*dpy_record = LocalParticle_get_py(part);
|
|
54
|
+
}
|
|
55
|
+
else{
|
|
56
|
+
f_t = 1.0;
|
|
57
|
+
}
|
|
57
58
|
}
|
|
58
|
-
#endif
|
|
59
59
|
|
|
60
60
|
LocalParticle_update_delta(part, (delta+1) * f_t - 1);
|
|
61
61
|
LocalParticle_scale_px(part, f_t);
|
|
62
62
|
LocalParticle_scale_py(part, f_t);
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
if (LocalParticle_check_track_flag(part, XS_FLAG_SR_KICK_SAME_AS_FIRST)){
|
|
65
|
+
if (part -> ipart == 0){
|
|
66
|
+
*dp_record = LocalParticle_get_delta(part) - *dp_record;
|
|
67
|
+
*dpx_record = LocalParticle_get_px(part) - *dpx_record;
|
|
68
|
+
*dpy_record = LocalParticle_get_py(part) - *dpy_record;
|
|
69
|
+
}
|
|
70
70
|
else{
|
|
71
71
|
LocalParticle_update_delta(part, LocalParticle_get_delta(part) + *dp_record);
|
|
72
72
|
LocalParticle_add_to_px(part, *dpx_record);
|
|
73
73
|
LocalParticle_add_to_py(part, *dpy_record);
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
GPUFUN
|
|
@@ -5513,6 +5513,15 @@ def _preserve_config(ln_or_trk):
|
|
|
5513
5513
|
ln_or_trk.config.clear()
|
|
5514
5514
|
ln_or_trk.config.update(config)
|
|
5515
5515
|
|
|
5516
|
+
@contextmanager
|
|
5517
|
+
def _preserve_track_flags(line):
|
|
5518
|
+
old_flags = line.tracker.track_flags.flags.copy()
|
|
5519
|
+
try:
|
|
5520
|
+
yield
|
|
5521
|
+
finally:
|
|
5522
|
+
line.tracker.track_flags.flags.clear()
|
|
5523
|
+
line.tracker.track_flags.flags.update(old_flags)
|
|
5524
|
+
|
|
5516
5525
|
|
|
5517
5526
|
@contextmanager
|
|
5518
5527
|
def freeze_longitudinal(ln_or_trk):
|
|
@@ -232,6 +232,34 @@ def drift_to_mad_str(name, line, mad_type=MadType.MADX, substituted_vars=None):
|
|
|
232
232
|
tokens = _handle_tokens_madng(tokens, substituted_vars)
|
|
233
233
|
return ', '.join(tokens)
|
|
234
234
|
|
|
235
|
+
def drift_slice_to_mad_str(name, line, mad_type=MadType.MADX, substituted_vars=None):
|
|
236
|
+
"""
|
|
237
|
+
Convert a drift element to a MADX/MAD-NG string representation.
|
|
238
|
+
|
|
239
|
+
Parameters:
|
|
240
|
+
- name: Name of the drift element.
|
|
241
|
+
- line: The line containing the element.
|
|
242
|
+
- mad_type: Type of MAD (MADX or MADNG).
|
|
243
|
+
- substituted_vars: List of substituted variables for MADNG.
|
|
244
|
+
|
|
245
|
+
Returns:
|
|
246
|
+
- A string representation of the drift in MADX/MAD-NG format.
|
|
247
|
+
"""
|
|
248
|
+
|
|
249
|
+
drift_slice = _get_eref(line, name)
|
|
250
|
+
tokens = []
|
|
251
|
+
tokens.append('drift')
|
|
252
|
+
if mad_type == MadType.MADNG:
|
|
253
|
+
tokens.append(f"'{name.replace(':', '__')}'") # replace ':' with '__' for MADNG
|
|
254
|
+
|
|
255
|
+
tokens.append(mad_assignment('l', (float(drift_slice._parent.length._value)
|
|
256
|
+
* float(drift_slice.weight._value)),
|
|
257
|
+
mad_type, substituted_vars=substituted_vars))
|
|
258
|
+
|
|
259
|
+
if mad_type == MadType.MADNG:
|
|
260
|
+
tokens = _handle_tokens_madng(tokens, substituted_vars)
|
|
261
|
+
return ', '.join(tokens)
|
|
262
|
+
|
|
235
263
|
def multipole_to_mad_str(name, line, mad_type=MadType.MADX, substituted_vars=None):
|
|
236
264
|
""" Convert a multipole element to a MADX/MAD-NG string representation.
|
|
237
265
|
|
|
@@ -562,7 +590,8 @@ xsuite_to_mad_converters = {
|
|
|
562
590
|
xt.UniformSolenoid: solenoid_to_mad_str,
|
|
563
591
|
xt.SRotation: srotation_to_mad_str,
|
|
564
592
|
xt.RFMultipole: rfmultipole_to_mad_str,
|
|
565
|
-
xt.CrabCavity: crabcavity_to_mad_str
|
|
593
|
+
xt.CrabCavity: crabcavity_to_mad_str,
|
|
594
|
+
xt.DriftSlice: drift_slice_to_mad_str
|
|
566
595
|
}
|
|
567
596
|
|
|
568
597
|
def to_madx_sequence(line, name='seq', mode='sequence'):
|
|
@@ -1429,6 +1429,7 @@ class Particles(xo.HybridClass):
|
|
|
1429
1429
|
|
|
1430
1430
|
src_lines.append(' int64_t ipart;')
|
|
1431
1431
|
src_lines.append(' int64_t endpart;')
|
|
1432
|
+
src_lines.append(' uint64_t track_flags;')
|
|
1432
1433
|
src_lines.append(' /*gpuglmem*/ int8_t* io_buffer;')
|
|
1433
1434
|
src_lines.append('} LocalParticle;')
|
|
1434
1435
|
src_typedef = '\n'.join(src_lines)
|
|
@@ -1443,6 +1444,14 @@ class Particles(xo.HybridClass):
|
|
|
1443
1444
|
|
|
1444
1445
|
''')
|
|
1445
1446
|
|
|
1447
|
+
# Get track flag
|
|
1448
|
+
src_lines.append('''
|
|
1449
|
+
/*gpufun*/
|
|
1450
|
+
uint64_t LocalParticle_check_track_flag(LocalParticle* part, uint8_t index){
|
|
1451
|
+
return (part->track_flags >> index) & 1;
|
|
1452
|
+
}
|
|
1453
|
+
''')
|
|
1454
|
+
|
|
1446
1455
|
# Particles_to_LocalParticle
|
|
1447
1456
|
src_lines.append('''
|
|
1448
1457
|
/*gpufun*/
|
|
@@ -72,9 +72,8 @@ def compensate_radiation_energy_loss(line, delta0='zero_mean', rtol_eneloss=1e-1
|
|
|
72
72
|
f_setter.set_values(np.zeros_like(f_setter.get_values()))
|
|
73
73
|
|
|
74
74
|
if verbose: _print("Share energy loss among cavities (repeat until energy loss is zero)")
|
|
75
|
-
with xt.line.
|
|
76
|
-
line.
|
|
77
|
-
line.config.XTRACK_DIPOLEEDGE_TAPER = True
|
|
75
|
+
with xt.line._preserve_track_flags(line):
|
|
76
|
+
line.tracker.track_flags.XS_FLAG_SR_TAPER = True
|
|
78
77
|
|
|
79
78
|
if delta0 == 'zero_mean':
|
|
80
79
|
num_rounds = 2
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
flag_mapping = {
|
|
4
|
+
'XS_FLAG_BACKTRACK': 0,
|
|
5
|
+
'XS_FLAG_KILL_CAVITY_KICK': 2,
|
|
6
|
+
'XS_FLAG_IGNORE_GLOBAL_APERTURE': 3,
|
|
7
|
+
'XS_FLAG_IGNORE_LOCAL_APERTURE': 4,
|
|
8
|
+
'XS_FLAG_SR_TAPER': 5,
|
|
9
|
+
'XS_FLAG_SR_KICK_SAME_AS_FIRST': 6
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
flag_defaults = {
|
|
13
|
+
'XS_FLAG_BACKTRACK': False,
|
|
14
|
+
'XS_FLAG_KILL_CAVITY_KICK': False,
|
|
15
|
+
'XS_FLAG_IGNORE_GLOBAL_APERTURE': False,
|
|
16
|
+
'XS_FLAG_IGNORE_LOCAL_APERTURE': False,
|
|
17
|
+
'XS_FLAG_SR_TAPER': False,
|
|
18
|
+
'XS_FLAG_SR_KICK_SAME_AS_FIRST': False
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
c_header_flag_mapping = """
|
|
22
|
+
#ifndef XSTUITE_TRACK_FLAGS_H
|
|
23
|
+
#define XSTUITE_TRACK_FLAGS_H
|
|
24
|
+
"""
|
|
25
|
+
for flag_name, bit_pos in flag_mapping.items():
|
|
26
|
+
c_header_flag_mapping += f"#define {flag_name} ({bit_pos})\n"
|
|
27
|
+
c_header_flag_mapping += """
|
|
28
|
+
#endif // XSTUITE_TRACK_FLAGS_H
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
class TrackFlags:
|
|
32
|
+
|
|
33
|
+
c_header_flag_mapping = c_header_flag_mapping
|
|
34
|
+
|
|
35
|
+
def __init__(self, **kwargs):
|
|
36
|
+
object.__setattr__(self, 'flags', flag_defaults.copy())
|
|
37
|
+
for key, value in kwargs.items():
|
|
38
|
+
setattr(self, key, value)
|
|
39
|
+
|
|
40
|
+
def get_flags_register(self):
|
|
41
|
+
|
|
42
|
+
reg = 0
|
|
43
|
+
for flag_name, bit_pos in flag_mapping.items():
|
|
44
|
+
assert bit_pos >= 0
|
|
45
|
+
assert bit_pos < 64
|
|
46
|
+
if self.flags.get(flag_name, False):
|
|
47
|
+
reg |= (1 << bit_pos)
|
|
48
|
+
return np.uint64(reg)
|
|
49
|
+
|
|
50
|
+
def __getattr__(self, name):
|
|
51
|
+
if name == 'flags':
|
|
52
|
+
return object.__getattribute__(self, 'flags')
|
|
53
|
+
if name in self.flags:
|
|
54
|
+
return self.flags[name]
|
|
55
|
+
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
|
|
56
|
+
|
|
57
|
+
def __setattr__(self, name, value):
|
|
58
|
+
if name == 'flags': # for unpickling
|
|
59
|
+
object.__setattr__(self, 'flags', value)
|
|
60
|
+
return
|
|
61
|
+
if name not in self.flags:
|
|
62
|
+
raise KeyError(f"Unknown flag '{name}'")
|
|
63
|
+
self.flags[name] = value
|
|
64
|
+
|
|
65
|
+
def __repr__(self):
|
|
66
|
+
return f"TrackFlags({self.flags})"
|
|
67
|
+
|
|
68
|
+
def print_flag_register(self):
|
|
69
|
+
reg = self.get_flags_register()
|
|
70
|
+
print(f"Flag register (binary): {bin(reg)[2:].zfill(64)}")
|