xtrack 0.69.2__tar.gz → 0.69.4__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.69.2/xtrack.egg-info → xtrack-0.69.4}/PKG-INFO +1 -1
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_environment.py +71 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_survey.py +9 -4
- xtrack-0.69.4/xtrack/_version.py +1 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/environment.py +179 -75
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/line.py +126 -18
- {xtrack-0.69.2 → xtrack-0.69.4/xtrack.egg-info}/PKG-INFO +1 -1
- xtrack-0.69.2/xtrack/_version.py +0 -1
- {xtrack-0.69.2 → xtrack-0.69.4}/LICENSE +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/MANIFEST.in +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/README.md +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/base_classes.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/elements.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/line.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/particles.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/pyproject.toml +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/setup.cfg +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/setup.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_acceleration.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_apertures.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_attr_replicas_and_slices.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_coasting.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_collimation.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_element_characterization_functions.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_elements.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_elements_thick.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_fcc_ee_solenoid_correction.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_footprint.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_full_rings.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_hvkick.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_ions.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_line.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_lumi.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_mad_writer.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_madloader.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_nested.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_multiline.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_multisetter.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_multispecies.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_particles_api.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_periodic_symmetric_twiss_and_match.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_pipeline.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_prebuild_kernels.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_radial_steering.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_radiation.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_random_gen.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_rf_track.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_rotation_signs.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_seeds.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_slice_and_insert_with_replicas.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_slice_elements.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_slicing.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_sps_thick.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_tapering.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_tilt_shifts.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_tracker.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_trajectory_correcton.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_twiss.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_vs_madx.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/tests/test_xmask_orbit_correction.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/base_element.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thick_slice_solenoid.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_multipolar_components.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_solenoid.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/slice_elements.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/beam_elements/slice_elements_thick.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/footprint.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/general.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/headers/checks.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/headers/constants.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/internal_record.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/json_utils.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/lumi.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/mad_loader.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/mad_writer.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/match.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/multiline/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/multiline/multiline.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/multiline/shared_knobs.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/particles/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/particles/constants.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/particles/particles.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/__init__.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/random/random_src/uniform_accurate.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/slicing.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/survey.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/synctime.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/tapering.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/targets.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/tracker.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/tracker_data.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/trajectory_correction.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/twiss.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack/twissplot.py +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack.egg-info/SOURCES.txt +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.69.2 → xtrack-0.69.4}/xtrack.egg-info/top_level.txt +0 -0
@@ -1782,3 +1782,74 @@ def test_select_in_multiline():
|
|
1782
1782
|
== "((-vars['acbch7.r1b1']) + vars['aaa'])")
|
1783
1783
|
assert line_sel.get('mcbch.7r1.b1').knl[0] == 1e-6
|
1784
1784
|
assert line.get('mcbch.7r1.b1').knl[0] == 1e-6
|
1785
|
+
|
1786
|
+
@pytest.mark.parametrize('container_type', ['env', 'line'])
|
1787
|
+
def test_inpection_methods(container_type):
|
1788
|
+
|
1789
|
+
env = xt.Environment()
|
1790
|
+
|
1791
|
+
env.vars({
|
1792
|
+
'k.1': 1.,
|
1793
|
+
'a': 2.,
|
1794
|
+
'b': '2 * a + k.1',
|
1795
|
+
})
|
1796
|
+
|
1797
|
+
line = env.new_line([
|
1798
|
+
env.new('bb', xt.Bend, k0='2 * b', length=3+env.vars['a'] + env.vars['b'],
|
1799
|
+
h=5., ksl=[0, '3*b']),
|
1800
|
+
])
|
1801
|
+
|
1802
|
+
ee = {'env': env, 'line': line}[container_type]
|
1803
|
+
|
1804
|
+
# Line/Env methods (get, set, eval, get_expr, new_expr, info)
|
1805
|
+
assert ee.get('b') == 2 * 2 + 1
|
1806
|
+
assert ee.get('bb') is env.element_dict['bb']
|
1807
|
+
|
1808
|
+
assert str(ee.get_expr('b')) == "((2.0 * vars['a']) + vars['k.1'])"
|
1809
|
+
|
1810
|
+
assert ee.eval('3*a - sqrt(k.1)') == 5
|
1811
|
+
|
1812
|
+
ne = ee.new_expr('sqrt(3*a + 3)')
|
1813
|
+
assert xd.refs.is_ref(ne)
|
1814
|
+
assert str(ne) == "f.sqrt(((3.0 * vars['a']) + 3.0))"
|
1815
|
+
|
1816
|
+
ee.info('bb') # Check that it works
|
1817
|
+
ee.info('b')
|
1818
|
+
ee.info('a')
|
1819
|
+
|
1820
|
+
ee.set('c', '6*a')
|
1821
|
+
assert ee.get('c') == 6 * 2
|
1822
|
+
|
1823
|
+
# Line/Env containers (env[...], env.ref[...]
|
1824
|
+
assert ee['b'] == 2 * 2 + 1
|
1825
|
+
assert type(ee['bb']).__name__ == 'View'
|
1826
|
+
assert ee['bb'].__class__.__name__ == 'Bend'
|
1827
|
+
|
1828
|
+
# Vars methods (get, set, eval, get_expr, new_expr, info, get_table)
|
1829
|
+
assert ee.vars.get('b') == 2 * 2 + 1
|
1830
|
+
|
1831
|
+
assert str(ee.vars.get_expr('b')) == "((2.0 * vars['a']) + vars['k.1'])"
|
1832
|
+
|
1833
|
+
assert ee.vars.eval('3*a - sqrt(k.1)') == 5
|
1834
|
+
|
1835
|
+
ne = ee.vars.new_expr('sqrt(3*a + 3)')
|
1836
|
+
assert xd.refs.is_ref(ne)
|
1837
|
+
assert str(ne) == "f.sqrt(((3.0 * vars['a']) + 3.0))"
|
1838
|
+
|
1839
|
+
ee.vars.info('b')
|
1840
|
+
ee.vars.info('a')
|
1841
|
+
|
1842
|
+
ee.vars.set('d', '7*a')
|
1843
|
+
assert ee.vars.get('d') == 7 * 2
|
1844
|
+
|
1845
|
+
assert xd.refs.is_ref(ee.vars['b'])
|
1846
|
+
|
1847
|
+
# View methods get_expr, get_value, get_info, get_table (for now)
|
1848
|
+
assert xd.refs.is_ref(ee['bb'].get_expr('k0'))
|
1849
|
+
assert str(ee['bb'].get_expr('k0')) == "(2.0 * vars['b'])"
|
1850
|
+
assert ee['bb'].get_expr('k0')._value == 2 * (2 * 2 + 1)
|
1851
|
+
assert ee['bb'].get_value('k0') == 2 * (2 * 2 + 1)
|
1852
|
+
|
1853
|
+
tt = ee['bb'].get_table()
|
1854
|
+
assert tt['value', 'k0'] == 2 * (2 * 2 + 1)
|
1855
|
+
assert tt['expr', 'k0'] == "(2.0 * vars['b'])"
|
@@ -12,6 +12,11 @@ tilted = True
|
|
12
12
|
orientation = 'acw'
|
13
13
|
transform_to_actual_elements = True
|
14
14
|
|
15
|
+
if hasattr(np, 'trapezoid'): # numpy >= 2.0
|
16
|
+
trapz = np.trapezoid
|
17
|
+
else:
|
18
|
+
trapz = np.trapz
|
19
|
+
|
15
20
|
@for_all_test_contexts
|
16
21
|
@pytest.mark.parametrize(
|
17
22
|
'slice_mode',
|
@@ -103,17 +108,17 @@ def test_survey_slicing(test_context, slice_mode, tilted, orientation,
|
|
103
108
|
|
104
109
|
if not tilted and orientation == 'acw':
|
105
110
|
assert_allclose(np.abs(sv.Y), 0, rtol=0, atol=1e-14)
|
106
|
-
assert_allclose(
|
111
|
+
assert_allclose(trapz(sv.X, sv.Z), -4.818 , rtol=0, # anti-clockwise
|
107
112
|
atol=(2e-3 if slice_mode is not None else 0.5))
|
108
113
|
elif not tilted and orientation == 'cw':
|
109
114
|
assert_allclose(np.abs(sv.Y), 0, rtol=0, atol=1e-14)
|
110
|
-
assert_allclose(
|
115
|
+
assert_allclose(trapz(sv.X, sv.Z), 4.818 , rtol=0, # clockwise
|
111
116
|
atol=(2e-3 if slice_mode is not None else 0.5))
|
112
117
|
elif tilted and orientation == 'acw':
|
113
118
|
assert_allclose(np.abs(sv.X), 0, rtol=0, atol=1e-14)
|
114
|
-
assert_allclose(
|
119
|
+
assert_allclose(trapz(sv.Y, sv.Z), -4.818 , rtol=0, # anti-clockwise
|
115
120
|
atol=(2e-3 if slice_mode is not None else 0.5))
|
116
121
|
elif tilted and orientation == 'cw':
|
117
122
|
assert_allclose(np.abs(sv.X), 0, rtol=0, atol=1e-14)
|
118
|
-
assert_allclose(
|
123
|
+
assert_allclose(trapz(sv.Y, sv.Z), 4.818 , rtol=0, # clockwise
|
119
124
|
atol=(2e-3 if slice_mode is not None else 0.5))
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.69.4'
|
@@ -40,58 +40,39 @@ class Environment:
|
|
40
40
|
self._drift_counter = 0
|
41
41
|
self.ref = EnvRef(self)
|
42
42
|
|
43
|
-
def
|
44
|
-
out = xt.Line()
|
45
|
-
out.particle_ref = self.particle_ref
|
46
|
-
out.env = self
|
47
|
-
out._element_dict = self.element_dict # Avoid copying
|
48
|
-
if components is None:
|
49
|
-
components = []
|
50
|
-
|
51
|
-
for ii, nn in enumerate(components):
|
52
|
-
if (isinstance(nn, Place) and isinstance(nn.name, str)
|
53
|
-
and nn.name in self.lines):
|
54
|
-
nn.name = self.lines[nn.name]
|
55
|
-
if isinstance(nn, str) and nn in self.lines:
|
56
|
-
components[ii] = self.lines[nn]
|
57
|
-
|
58
|
-
flattened_components = _flatten_components(components)
|
59
|
-
out.element_names = handle_s_places(flattened_components, self)
|
60
|
-
out._var_management = self._var_management
|
61
|
-
out._name = name
|
62
|
-
out.builder = Builder(env=self, components=components)
|
63
|
-
|
64
|
-
# Temporary solution to keep consistency in multiline
|
65
|
-
if hasattr(self, '_in_multiline') and self._in_multiline is not None:
|
66
|
-
out._var_management = None
|
67
|
-
out._in_multiline = self._in_multiline
|
68
|
-
out._name_in_multiline = self._name_in_multiline
|
69
|
-
|
70
|
-
self._lines_weakrefs.add(out) # Weak references
|
71
|
-
if name is not None:
|
72
|
-
self.lines[name] = out
|
73
|
-
|
74
|
-
return out
|
75
|
-
|
76
|
-
def new_builder(self, components=None, name=None):
|
77
|
-
return Builder(env=self, components=components, name=name)
|
78
|
-
|
79
|
-
def _ensure_tracker_consistency(self, buffer):
|
80
|
-
for ln in self._lines_weakrefs:
|
81
|
-
if ln._has_valid_tracker() and ln._buffer is not buffer:
|
82
|
-
ln.discard_tracker()
|
83
|
-
|
84
|
-
def _get_a_drift_name(self):
|
85
|
-
self._drift_counter += 1
|
86
|
-
nn = f'drift_{self._drift_counter}'
|
87
|
-
if nn not in self.element_dict:
|
88
|
-
return nn
|
89
|
-
else:
|
90
|
-
return self._get_a_drift_name()
|
91
|
-
|
92
|
-
def new(self, name, cls, mode=None, at=None, from_=None, extra=None,
|
43
|
+
def new(self, name, parent, mode=None, at=None, from_=None, extra=None,
|
93
44
|
mirror=False, **kwargs):
|
94
45
|
|
46
|
+
'''
|
47
|
+
Create a new element or line.
|
48
|
+
|
49
|
+
Parameters
|
50
|
+
----------
|
51
|
+
name : str
|
52
|
+
Name of the new element or line
|
53
|
+
parent : str or class
|
54
|
+
Parent class or name of the parent element
|
55
|
+
mode : str, optional
|
56
|
+
- clone: clone the parent element or line.
|
57
|
+
The parent element or line is copied, together with the associated
|
58
|
+
expressions.
|
59
|
+
- replica: replicate the parent elements or lines are made.
|
60
|
+
at : float or str, optional
|
61
|
+
Position of the created object.
|
62
|
+
from_: str, optional
|
63
|
+
Name of the element from which the position is calculated (its center
|
64
|
+
is used as reference).
|
65
|
+
mirror : bool, optional
|
66
|
+
Can only be used when cloning lines. If True, the order of the elements
|
67
|
+
is reversed.
|
68
|
+
|
69
|
+
Returns
|
70
|
+
-------
|
71
|
+
str or Place
|
72
|
+
Name of the created element or line or a Place object if at or from_ is
|
73
|
+
provided.
|
74
|
+
'''
|
75
|
+
|
95
76
|
if from_ is not None or at is not None:
|
96
77
|
all_kwargs = locals()
|
97
78
|
all_kwargs.pop('self')
|
@@ -105,60 +86,60 @@ class Environment:
|
|
105
86
|
_ALLOWED_ELEMENT_TYPES_DICT = xt.line._ALLOWED_ELEMENT_TYPES_DICT
|
106
87
|
_STR_ALLOWED_ELEMENT_TYPES_IN_NEW = xt.line._STR_ALLOWED_ELEMENT_TYPES_IN_NEW
|
107
88
|
|
108
|
-
if
|
109
|
-
|
89
|
+
if parent in self.lines:
|
90
|
+
parent = self.lines[parent]
|
110
91
|
|
111
|
-
if isinstance(
|
92
|
+
if isinstance(parent, xt.Line):
|
112
93
|
assert len(kwargs) == 0, 'No kwargs allowed when creating a line'
|
113
94
|
if mode == 'replica':
|
114
95
|
assert name is not None, 'Name must be provided when replicating a line'
|
115
|
-
return
|
96
|
+
return parent.replicate(name=name, mirror=mirror)
|
116
97
|
else:
|
117
98
|
assert mode in [None, 'clone'], f'Unknown mode {mode}'
|
118
99
|
assert name is not None, 'Name must be provided when cloning a line'
|
119
|
-
return
|
100
|
+
return parent.clone(name=name, mirror=mirror)
|
120
101
|
|
121
|
-
assert mirror is False, 'mirror=True only allowed when cloning
|
102
|
+
assert mirror is False, 'mirror=True only allowed when cloning lines.'
|
122
103
|
|
123
|
-
if
|
104
|
+
if parent is xt.Line or (parent=='Line' and (
|
124
105
|
'Line' not in self.lines and 'Line' not in self.element_dict)):
|
125
106
|
assert mode is None, 'Mode not allowed when cls is Line'
|
126
107
|
return self.new_line(name=name, **kwargs)
|
127
108
|
|
128
109
|
if mode == 'replica':
|
129
|
-
assert
|
130
|
-
kwargs['parent_name'] = xo.String(
|
131
|
-
|
110
|
+
assert parent in self.element_dict, f'Element {parent} not found, cannot replicate'
|
111
|
+
kwargs['parent_name'] = xo.String(parent)
|
112
|
+
parent = xt.Replica
|
132
113
|
elif mode == 'clone':
|
133
|
-
assert
|
114
|
+
assert parent in self.element_dict, f'Element {parent} not found, cannot clone'
|
134
115
|
else:
|
135
116
|
assert mode is None, f'Unknown mode {mode}'
|
136
117
|
|
137
118
|
_eval = self._xdeps_eval.eval
|
138
119
|
|
139
|
-
assert isinstance(
|
120
|
+
assert isinstance(parent, str) or parent in _ALLOWED_ELEMENT_TYPES_IN_NEW, (
|
140
121
|
'Only '
|
141
122
|
+ _STR_ALLOWED_ELEMENT_TYPES_IN_NEW
|
142
123
|
+ ' elements are allowed in `new` for now.')
|
143
124
|
|
144
125
|
needs_instantiation = True
|
145
|
-
if isinstance(
|
146
|
-
if
|
126
|
+
if isinstance(parent, str):
|
127
|
+
if parent in self.element_dict:
|
147
128
|
# Clone an existing element
|
148
|
-
self.element_dict[name] = xt.Replica(parent_name=
|
149
|
-
|
150
|
-
|
129
|
+
self.element_dict[name] = xt.Replica(parent_name=parent)
|
130
|
+
xt.Line.replace_replica(self, name)
|
131
|
+
parent = type(self.element_dict[name])
|
151
132
|
needs_instantiation = False
|
152
|
-
elif
|
153
|
-
|
133
|
+
elif parent in _ALLOWED_ELEMENT_TYPES_DICT:
|
134
|
+
parent = _ALLOWED_ELEMENT_TYPES_DICT[parent]
|
154
135
|
needs_instantiation = True
|
155
136
|
else:
|
156
|
-
raise ValueError(f'Element type {
|
137
|
+
raise ValueError(f'Element type {parent} not found')
|
157
138
|
|
158
|
-
ref_kwargs, value_kwargs = _parse_kwargs(
|
139
|
+
ref_kwargs, value_kwargs = _parse_kwargs(parent, kwargs, _eval)
|
159
140
|
|
160
141
|
if needs_instantiation: # Parent is a class and not another element
|
161
|
-
self.element_dict[name] =
|
142
|
+
self.element_dict[name] = parent(**value_kwargs)
|
162
143
|
|
163
144
|
_set_kwargs(name=name, ref_kwargs=ref_kwargs, value_kwargs=value_kwargs,
|
164
145
|
element_dict=self.element_dict, element_refs=self.element_refs)
|
@@ -169,9 +150,128 @@ class Environment:
|
|
169
150
|
|
170
151
|
return name
|
171
152
|
|
153
|
+
def new_line(self, components=None, name=None):
|
154
|
+
|
155
|
+
'''
|
156
|
+
Create a new line.
|
157
|
+
|
158
|
+
Parameters
|
159
|
+
----------
|
160
|
+
components : list, optional
|
161
|
+
List of components to be added to the line. It can include strings,
|
162
|
+
place objects, and lines.
|
163
|
+
name : str, optional
|
164
|
+
Name of the new line.
|
165
|
+
|
166
|
+
Returns
|
167
|
+
-------
|
168
|
+
line
|
169
|
+
The new line.
|
170
|
+
|
171
|
+
Examples
|
172
|
+
--------
|
173
|
+
.. code-block:: python
|
174
|
+
|
175
|
+
env = xt.Environment()
|
176
|
+
env['a'] = 3 # Define a variable
|
177
|
+
env.new('mq1', xt.Quadrupole, length=0.3, k1='a') # Create an element
|
178
|
+
env.new('mq2', xt.Quadrupole, length=0.3, k1='-a') # Create another element
|
179
|
+
|
180
|
+
ln = env.new_line(name='myline', components=[
|
181
|
+
'mq', # Add the element 'mq' at the start of the line
|
182
|
+
env.new('mymark', xt.Marker, at=10.0), # Create a marker at s=10
|
183
|
+
env.new('mq1_clone', 'mq1', k1='2a'), # Clone 'mq1' with a different k1
|
184
|
+
env.place('mq2', at=20.0, from='mymark'), # Place 'mq2' at s=20
|
185
|
+
])
|
186
|
+
'''
|
187
|
+
|
188
|
+
out = xt.Line()
|
189
|
+
out.particle_ref = self.particle_ref
|
190
|
+
out.env = self
|
191
|
+
out._element_dict = self.element_dict # Avoid copying
|
192
|
+
if components is None:
|
193
|
+
components = []
|
194
|
+
|
195
|
+
for ii, nn in enumerate(components):
|
196
|
+
if (isinstance(nn, Place) and isinstance(nn.name, str)
|
197
|
+
and nn.name in self.lines):
|
198
|
+
nn.name = self.lines[nn.name]
|
199
|
+
if isinstance(nn, str) and nn in self.lines:
|
200
|
+
components[ii] = self.lines[nn]
|
201
|
+
|
202
|
+
flattened_components = _flatten_components(components)
|
203
|
+
out.element_names = handle_s_places(flattened_components, self)
|
204
|
+
out._var_management = self._var_management
|
205
|
+
out._name = name
|
206
|
+
out.builder = Builder(env=self, components=components)
|
207
|
+
|
208
|
+
# Temporary solution to keep consistency in multiline
|
209
|
+
if hasattr(self, '_in_multiline') and self._in_multiline is not None:
|
210
|
+
out._var_management = None
|
211
|
+
out._in_multiline = self._in_multiline
|
212
|
+
out._name_in_multiline = self._name_in_multiline
|
213
|
+
|
214
|
+
self._lines_weakrefs.add(out) # Weak references
|
215
|
+
if name is not None:
|
216
|
+
self.lines[name] = out
|
217
|
+
|
218
|
+
return out
|
219
|
+
|
172
220
|
def place(self, name, at=None, from_=None, anchor=None, from_anchor=None):
|
221
|
+
'''
|
222
|
+
Create a place object.
|
223
|
+
|
224
|
+
Parameters
|
225
|
+
----------
|
226
|
+
name : str or Line
|
227
|
+
Name of the element or line to be placed.
|
228
|
+
at : float or str, optional
|
229
|
+
Position of the created object.
|
230
|
+
from_: str, optional
|
231
|
+
Name of the element from which the position is calculated (its center
|
232
|
+
is used as reference).
|
233
|
+
|
234
|
+
Returns
|
235
|
+
-------
|
236
|
+
Place
|
237
|
+
The new place object.
|
238
|
+
'''
|
239
|
+
|
173
240
|
return Place(name, at=at, from_=from_, anchor=anchor, from_anchor=from_anchor)
|
174
241
|
|
242
|
+
def new_builder(self, components=None, name=None):
|
243
|
+
'''
|
244
|
+
Create a new builder.
|
245
|
+
|
246
|
+
Parameters
|
247
|
+
----------
|
248
|
+
components : list, optional
|
249
|
+
List of components to be added to the builder. It can include strings,
|
250
|
+
place objects, and lines.
|
251
|
+
name : str, optional
|
252
|
+
Name of the line that will be built by the builder.
|
253
|
+
|
254
|
+
Returns
|
255
|
+
-------
|
256
|
+
Builder
|
257
|
+
The new builder.
|
258
|
+
'''
|
259
|
+
|
260
|
+
return Builder(env=self, components=components, name=name)
|
261
|
+
|
262
|
+
def _ensure_tracker_consistency(self, buffer):
|
263
|
+
for ln in self._lines_weakrefs:
|
264
|
+
if ln._has_valid_tracker() and ln._buffer is not buffer:
|
265
|
+
ln.discard_tracker()
|
266
|
+
|
267
|
+
def _get_a_drift_name(self):
|
268
|
+
self._drift_counter += 1
|
269
|
+
nn = f'drift_{self._drift_counter}'
|
270
|
+
if nn not in self.element_dict:
|
271
|
+
return nn
|
272
|
+
else:
|
273
|
+
return self._get_a_drift_name()
|
274
|
+
|
175
275
|
def __setitem__(self, key, value):
|
176
276
|
|
177
277
|
if isinstance(value, xt.Line):
|
@@ -194,10 +294,14 @@ Environment.element_refs = xt.Line.element_refs
|
|
194
294
|
Environment.vars = xt.Line.vars
|
195
295
|
Environment.varval = xt.Line.varval
|
196
296
|
Environment.vv = xt.Line.vv
|
197
|
-
Environment.replace_replica = xt.Line.replace_replica
|
198
297
|
Environment.__getitem__ = xt.Line.__getitem__
|
199
298
|
Environment.set = xt.Line.set
|
200
299
|
Environment.get = xt.Line.get
|
300
|
+
Environment.eval = xt.Line.eval
|
301
|
+
Environment.info = xt.Line.info
|
302
|
+
Environment.get_expr = xt.Line.get_expr
|
303
|
+
Environment.new_expr = xt.Line.new_expr
|
304
|
+
Environment.ref_manager = xt.Line.ref_manager
|
201
305
|
|
202
306
|
class Place:
|
203
307
|
|
@@ -295,7 +399,7 @@ def _resolve_s_positions(seq_all_places, env):
|
|
295
399
|
if seq_all_places[0].at is None and not seq_all_places[0]._before:
|
296
400
|
# In case we want to allow for the length to be an expression
|
297
401
|
s_center_dct[seq_all_places[0]] = aux_tt['length', seq_all_places[0].name] / 2
|
298
|
-
|
402
|
+
s_center_dct_names[seq_all_places[0].name] = s_center_dct[seq_all_places[0]]
|
299
403
|
n_resolved += 1
|
300
404
|
|
301
405
|
while n_resolved != n_resolved_prev:
|
@@ -356,7 +460,7 @@ def _resolve_s_positions(seq_all_places, env):
|
|
356
460
|
aux_s_center.append(ss)
|
357
461
|
aux_tt['s_center'] = np.concatenate([aux_s_center, [0]])
|
358
462
|
|
359
|
-
i_sorted = np.argsort(aux_s_center, stable
|
463
|
+
i_sorted = np.argsort(aux_s_center, kind='stable')
|
360
464
|
|
361
465
|
name_sorted = [str(aux_tt.name[ii]) for ii in i_sorted]
|
362
466
|
|
@@ -3405,12 +3405,16 @@ class Line:
|
|
3405
3405
|
|
3406
3406
|
def __add__(self, other):
|
3407
3407
|
self._env_if_needed
|
3408
|
-
assert isinstance(other, Line), 'Only Line can be added to Line'
|
3408
|
+
#assert isinstance(other, Line), 'Only Line can be added to Line'
|
3409
|
+
assert other.__class__.__name__=="Line", 'Only Line can be added to Line'
|
3409
3410
|
assert other.env is self.env, 'Lines must be in the same environment'
|
3410
3411
|
out = self.env.new_line(
|
3411
3412
|
components=list(self.element_names) + list(other.element_names))
|
3412
3413
|
return out
|
3413
3414
|
|
3415
|
+
def __sub__(self, other):
|
3416
|
+
return self + (-other)
|
3417
|
+
|
3414
3418
|
def replicate(self, name, mirror=False):
|
3415
3419
|
|
3416
3420
|
self._env_if_needed()
|
@@ -3505,6 +3509,27 @@ class Line:
|
|
3505
3509
|
return out
|
3506
3510
|
|
3507
3511
|
def set(self, name, *args, **kwargs):
|
3512
|
+
'''
|
3513
|
+
Set the values or expressions of variables or element properties.
|
3514
|
+
|
3515
|
+
Parameters
|
3516
|
+
----------
|
3517
|
+
name : str
|
3518
|
+
Name of the variable or element.
|
3519
|
+
value: float or str
|
3520
|
+
Value or expression of the variable to set. Can be provided only
|
3521
|
+
if the name is associated to a variable.
|
3522
|
+
**kwargs, float or str
|
3523
|
+
Attributes to set. Can be provided only if the name is associated
|
3524
|
+
to an element.
|
3525
|
+
|
3526
|
+
Examples
|
3527
|
+
--------
|
3528
|
+
>>> line.set('a', 0.1)
|
3529
|
+
>>> line.set('k1', '3*a')
|
3530
|
+
>>> line.set('quad', k1=0.1, k2='3*a')
|
3531
|
+
|
3532
|
+
'''
|
3508
3533
|
_eval = self._xdeps_eval.eval
|
3509
3534
|
|
3510
3535
|
if hasattr(self, 'lines') and name in self.lines:
|
@@ -3548,6 +3573,21 @@ class Line:
|
|
3548
3573
|
self.vars[name] = value
|
3549
3574
|
|
3550
3575
|
def get(self, key):
|
3576
|
+
'''
|
3577
|
+
Get an element or the value of a variable.
|
3578
|
+
|
3579
|
+
Parameters
|
3580
|
+
----------
|
3581
|
+
key : str
|
3582
|
+
Name of the element or variable.
|
3583
|
+
|
3584
|
+
Returns
|
3585
|
+
-------
|
3586
|
+
element : Element or float
|
3587
|
+
Element or value of the variable.
|
3588
|
+
|
3589
|
+
'''
|
3590
|
+
|
3551
3591
|
if key in self.element_dict:
|
3552
3592
|
return self.element_dict[key]
|
3553
3593
|
elif key in self.vars:
|
@@ -3555,6 +3595,80 @@ class Line:
|
|
3555
3595
|
else:
|
3556
3596
|
raise KeyError(f'Element or variable {key} not found')
|
3557
3597
|
|
3598
|
+
def info(self, key, limit=12):
|
3599
|
+
"""
|
3600
|
+
Get information about an element or a variable.
|
3601
|
+
"""
|
3602
|
+
|
3603
|
+
if key in self.element_dict:
|
3604
|
+
return self[key].get_info()
|
3605
|
+
elif key in self.vars:
|
3606
|
+
return self.vars.info(key, limit=limit)
|
3607
|
+
else:
|
3608
|
+
raise KeyError(f'Element or variable {key} not found')
|
3609
|
+
|
3610
|
+
# def get_value(self, key):
|
3611
|
+
# if key in self.element_dict:
|
3612
|
+
# return self.element_dict[key].get_value()
|
3613
|
+
# elif key in self.vars:
|
3614
|
+
# return self.vars.get_value(key)
|
3615
|
+
# else:
|
3616
|
+
# raise KeyError(f'Element or variable {key} not found')
|
3617
|
+
|
3618
|
+
@property
|
3619
|
+
def ref_manager(self):
|
3620
|
+
return self._xdeps_manager
|
3621
|
+
|
3622
|
+
def eval(self, expr):
|
3623
|
+
'''
|
3624
|
+
Get the value of an expression
|
3625
|
+
|
3626
|
+
Parameters
|
3627
|
+
----------
|
3628
|
+
expr : str
|
3629
|
+
Expression to evaluate.
|
3630
|
+
|
3631
|
+
Returns
|
3632
|
+
-------
|
3633
|
+
value : float
|
3634
|
+
Value of the expression.
|
3635
|
+
'''
|
3636
|
+
|
3637
|
+
return self.vars.eval(expr)
|
3638
|
+
|
3639
|
+
def new_expr(self, expr):
|
3640
|
+
'''
|
3641
|
+
Create a new expression
|
3642
|
+
|
3643
|
+
Parameters
|
3644
|
+
----------
|
3645
|
+
expr : str
|
3646
|
+
Expression to create.
|
3647
|
+
|
3648
|
+
Returns
|
3649
|
+
-------
|
3650
|
+
expr : Expression
|
3651
|
+
New expression.
|
3652
|
+
'''
|
3653
|
+
return self.vars.new_expr(expr)
|
3654
|
+
|
3655
|
+
def get_expr(self, var):
|
3656
|
+
'''
|
3657
|
+
Get expression associated to a variable
|
3658
|
+
|
3659
|
+
Parameters
|
3660
|
+
----------
|
3661
|
+
var: str
|
3662
|
+
Name of the variable
|
3663
|
+
|
3664
|
+
Returns
|
3665
|
+
-------
|
3666
|
+
expr : Expression
|
3667
|
+
Expression associated to the variable
|
3668
|
+
'''
|
3669
|
+
|
3670
|
+
return self.vars.get_expr(var)
|
3671
|
+
|
3558
3672
|
def _env_if_needed(self):
|
3559
3673
|
if not hasattr(self, 'env') or self.env is None:
|
3560
3674
|
self.env = xt.Environment(element_dict=self.element_dict,
|
@@ -4700,26 +4814,17 @@ class LineVars:
|
|
4700
4814
|
|
4701
4815
|
return xd.Table({'name': name, 'value': value, 'expr': expr})
|
4702
4816
|
|
4703
|
-
def
|
4704
|
-
|
4705
|
-
if isinstance(var,str):
|
4706
|
-
ref=self.line._xdeps_vref[var]
|
4707
|
-
elif is_expr(var):
|
4708
|
-
ref=var
|
4709
|
-
else:
|
4710
|
-
raise ValueError(f"`{var}` not valid, must be str or expr")
|
4711
|
-
expr=ref._expr
|
4712
|
-
if expr is None:
|
4713
|
-
raise NameError(f"`{var}` does not have any expression")
|
4714
|
-
return expr
|
4817
|
+
def new_expr(self, expr):
|
4818
|
+
return self.line._xdeps_eval.eval(expr)
|
4715
4819
|
|
4716
4820
|
def eval(self, expr):
|
4717
|
-
|
4718
|
-
return self.line._xdeps_eval.eval(expr)
|
4821
|
+
return self.new_expr(expr)._get_value()
|
4719
4822
|
|
4720
|
-
def
|
4721
|
-
|
4722
|
-
|
4823
|
+
def info(self, var, limit=10):
|
4824
|
+
return self[var]._info(limit=limit)
|
4825
|
+
|
4826
|
+
def get_expr(self, var):
|
4827
|
+
return self[var]._expr
|
4723
4828
|
|
4724
4829
|
def __contains__(self, key):
|
4725
4830
|
if self.line._xdeps_vref is None:
|
@@ -4844,6 +4949,9 @@ class LineVars:
|
|
4844
4949
|
else:
|
4845
4950
|
self[name] = value
|
4846
4951
|
|
4952
|
+
def get(self, name):
|
4953
|
+
return self[name]._value
|
4954
|
+
|
4847
4955
|
class ActionVars(Action):
|
4848
4956
|
|
4849
4957
|
def __init__(self, line):
|
xtrack-0.69.2/xtrack/_version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '0.69.2'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|