xtrack 0.85.0__tar.gz → 0.86.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xtrack-0.85.0/xtrack.egg-info → xtrack-0.86.0}/PKG-INFO +2 -1
- {xtrack-0.85.0 → xtrack-0.86.0}/pyproject.toml +1 -1
- {xtrack-0.85.0 → xtrack-0.86.0}/setup.py +3 -3
- xtrack-0.86.0/tests/test_load.py +153 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/__init__.py +1 -0
- xtrack-0.86.0/xtrack/_version.py +1 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/general.py +12 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/json.py +10 -1
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/line.py +38 -2
- xtrack-0.86.0/xtrack/load.py +54 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/mad_parser/loader.py +10 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/tapering.py +4 -0
- {xtrack-0.85.0 → xtrack-0.86.0/xtrack.egg-info}/PKG-INFO +2 -1
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack.egg-info/SOURCES.txt +2 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack.egg-info/requires.txt +1 -0
- xtrack-0.85.0/xtrack/_version.py +0 -1
- {xtrack-0.85.0 → xtrack-0.86.0}/LICENSE +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/MANIFEST.in +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/README.md +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/base_classes.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/elements.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/line.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/particles.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/setup.cfg +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_acceleration.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_amplitude_detuning.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_aperture_table.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_aperture_turn_ele_and_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_apertures.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_attr_replicas_and_slices.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_bucket_with_ref_energy_change.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_cavity_absolute_time.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_chromatic_functions_vs_madx.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_coasting.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_collective_tracker.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_collimation.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_electron_cooler.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_element_characterization_functions.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_element_internal_record.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_elements.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_elements_classflags.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_elements_thick.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_environment.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_fcc_ee_solenoid_correction.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_fcc_ee_solenoid_correction_new_optimize_api.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_footprint.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_freeze_longitudinal.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_full_rings.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_h6_sps_beamline.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_hvkick.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_ions.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_legacy_multiline_to_env.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_lhc_env.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_lhc_match_phase_15.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_line.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_lumi.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_mad_writer.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_madloader.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_madnginterface.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_magnet.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_and_track_from_element.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_coupling_knob.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_nested.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_optics_and_ip_knob.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_optics_and_ip_knob_new_optimize_api.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_orbit_bump.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_match_tune_chroma_cminus.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_multi_bunch_gauss.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_multiline.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_multisetter.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_multispecies.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_native_madloader.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_optimize_for_tracking.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_particles.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_particles_basics.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_particles_pdg.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_periodic_symmetric_twiss_and_match.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_pipeline.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_prebuild_kernels.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_ps_against_ptc.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_ps_multiturn_twiss.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_psb_chicane.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_pyht_interface.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_radial_steering.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_radiation.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_radiation_equilibrium_emittances.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_radiation_equilibrium_emittances_thick.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_radiation_integrals.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_random_gen.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_random_gen_exp.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_random_gen_gauss.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_random_gen_ruth.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_rbend_rbarc.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_rf_track.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_rotation_signs.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_second_order_taylor_map.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_seeds.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_slice_and_insert_with_replicas.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_slice_elements.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_slicing.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_solenoid_bz_map_vs_boris.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_solenoid_bz_map_vs_boris_legacy.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_spacecharge_in_ring.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_spin.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_sps_thick.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_survey.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_tapering.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_thick_lhc.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_tilt_shifts.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_tracker.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_trajectory_correcton.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_twiss.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_twiss_vs_madx_psb.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_vs_madx.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/tests/test_xmask_orbit_correction.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/boris_and_solenoid_map/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/boris_and_solenoid_map/boris.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/boris_and_solenoid_map/solenoid_field.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/aperture_meas.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/base_element.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/dipole_fringe.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift_slice.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift_slice_bend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift_slice_octupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift_slice_quadrupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift_slice_rbend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/drift_slice_sextupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/electroncooler.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/legacy_solenoid.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/magnet.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/magnet_drift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/magnet_edge.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/magnet_kick.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/marker.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/multipoleedge.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/octupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/rbend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/slnd.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_bend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_drift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_octupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_quadrupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_rbend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_sextupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thick_slice_uniform_solenoid.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_bend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_bend_entry.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_bend_exit.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_octupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_octupole_entry.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_octupole_exit.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_entry.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_quadrupole_exit.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_rbend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_rbend_entry.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_rbend_exit.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole_entry.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_sextupole_exit.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_uniform_solenoid_entry.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/thin_slice_uniform_solenoid_exit.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_bend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_cavity.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_dipole_edge_linear.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_dipole_edge_nonlinear.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_dipole_fringe.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_drift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_legacy_solenoid.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_legacy_solenoid_multipolar_components.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_legacy_solenoid_radiation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_magnet.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_magnet_drift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_magnet_edge.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_magnet_kick.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_magnet_radiation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_mult_fringe.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_multipole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_quadrupole.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_srotation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_wedge.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_xrotation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/variable_solenoid.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/magnets.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/rft_element.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/slice_elements.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/beam_elements/slice_elements_thick.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/environment.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/footprint.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/headers/checks.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/headers/constants.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/headers/track.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/internal_record.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/lumi.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/mad_loader.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/mad_parser/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/mad_parser/madx.lark +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/mad_parser/parse.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/mad_writer.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/madng_interface.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/match.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/multiline.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/multiline_legacy/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/multiline_legacy/multiline_legacy.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/multiline_legacy/shared_knobs.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/constants.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/masses.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/particles.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/pdg.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/rng_src/base_rng.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/particles/rng_src/particles_rng.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/random/random_src/uniform_accurate.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/slicing.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/survey.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/svgutils/__init__.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/svgutils/parser.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/svgutils/path.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/svgutils/svgutils.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/synctime.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/targets.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/tracker.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/tracker_data.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/trajectory_correction.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/twiss.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack/twissplot.py +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.85.0 → xtrack-0.86.0}/xtrack.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xtrack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.86.0
|
|
4
4
|
Summary: Tracking library for particle accelerators
|
|
5
5
|
Home-page: https://xsuite.readthedocs.io/
|
|
6
6
|
Download-URL: https://pypi.python.org/pypi/xtrack
|
|
@@ -23,6 +23,7 @@ Requires-Dist: PyHEADTAIL; extra == "tests"
|
|
|
23
23
|
Requires-Dist: pytest; extra == "tests"
|
|
24
24
|
Requires-Dist: pytest-mock; extra == "tests"
|
|
25
25
|
Requires-Dist: pymadng; extra == "tests"
|
|
26
|
+
Requires-Dist: requests-mock; extra == "tests"
|
|
26
27
|
Provides-Extra: notebooks
|
|
27
28
|
Requires-Dist: jupyter; extra == "notebooks"
|
|
28
29
|
Requires-Dist: ipympl; extra == "notebooks"
|
|
@@ -46,10 +46,10 @@ setup(
|
|
|
46
46
|
'tqdm',
|
|
47
47
|
'xobjects',
|
|
48
48
|
'xdeps'
|
|
49
|
-
|
|
49
|
+
],
|
|
50
50
|
extras_require={
|
|
51
51
|
'tests': ['cpymad', 'nafflib', 'PyHEADTAIL', 'pytest', 'pytest-mock',
|
|
52
|
-
'pymadng'],
|
|
52
|
+
'pymadng', 'requests-mock'],
|
|
53
53
|
'notebooks': ['jupyter', 'ipympl', 'xplt'],
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xtrack Package. #
|
|
3
|
+
# Copyright (c) CERN, 2025. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
import pytest
|
|
6
|
+
import xtrack as xt
|
|
7
|
+
import json
|
|
8
|
+
import textwrap
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.fixture
|
|
12
|
+
def madx_sequence():
|
|
13
|
+
return """
|
|
14
|
+
seq: sequence, l=1;
|
|
15
|
+
quad: quadrupole, l=1, k1=0.5, at=0.5;
|
|
16
|
+
endsequence;
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.fixture
|
|
21
|
+
def json_line():
|
|
22
|
+
dct = {
|
|
23
|
+
'elements': {
|
|
24
|
+
'quad': {
|
|
25
|
+
'__class__': 'Quadrupole',
|
|
26
|
+
'length': 1.0,
|
|
27
|
+
'k1': 0.5
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
'element_names': ['quad'],
|
|
31
|
+
}
|
|
32
|
+
return json.dumps(dct)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@pytest.fixture
|
|
36
|
+
def json_environment():
|
|
37
|
+
dct = {
|
|
38
|
+
'elements': {
|
|
39
|
+
'quad': {
|
|
40
|
+
'__class__': 'Quadrupole',
|
|
41
|
+
'length': 1.0,
|
|
42
|
+
'k1': 0.5,
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
'xsuite_data_type': 'Environment',
|
|
46
|
+
'lines': {
|
|
47
|
+
'seq': {
|
|
48
|
+
'element_names': ['quad'],
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return json.dumps(dct)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.fixture
|
|
56
|
+
def python_file():
|
|
57
|
+
source = """
|
|
58
|
+
import xtrack as xt
|
|
59
|
+
env = xt.get_environment()
|
|
60
|
+
quad = env.new('quad', 'Quadrupole', length=1.0, k1=0.5)
|
|
61
|
+
env.new_line(name='seq', components=[quad])
|
|
62
|
+
"""
|
|
63
|
+
return textwrap.dedent(source)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@pytest.mark.parametrize(
|
|
67
|
+
'input_fixture,format', [
|
|
68
|
+
('madx_sequence', 'madx'),
|
|
69
|
+
('json_line', 'json'),
|
|
70
|
+
('json_environment', 'json'),
|
|
71
|
+
]
|
|
72
|
+
)
|
|
73
|
+
def test_load_string(input_fixture, format, request):
|
|
74
|
+
input_data = request.getfixturevalue(input_fixture)
|
|
75
|
+
loaded_entity = xt.load(string=input_data, format=format) # noqa
|
|
76
|
+
|
|
77
|
+
quad = loaded_entity['quad']
|
|
78
|
+
assert quad.length == 1.0 and quad.k1 == 0.5
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@pytest.mark.parametrize(
|
|
82
|
+
'input_fixture,format,suffix', [
|
|
83
|
+
('madx_sequence', 'madx', 'madx'),
|
|
84
|
+
('json_line', 'json', 'json'),
|
|
85
|
+
('json_environment', 'json', 'json'),
|
|
86
|
+
('python_file', 'python', 'py'),
|
|
87
|
+
]
|
|
88
|
+
)
|
|
89
|
+
@pytest.mark.parametrize('with_format', [True, False])
|
|
90
|
+
def test_load_file(input_fixture, format, suffix, with_format, tmpdir, request):
|
|
91
|
+
input_data = request.getfixturevalue(input_fixture)
|
|
92
|
+
|
|
93
|
+
temp_file = tmpdir / f'test_input.{suffix}'
|
|
94
|
+
with open(temp_file, 'w') as f:
|
|
95
|
+
f.write(input_data)
|
|
96
|
+
|
|
97
|
+
kwargs = {'file': str(temp_file)}
|
|
98
|
+
if with_format:
|
|
99
|
+
kwargs['format'] = format
|
|
100
|
+
loaded_entity = xt.load(**kwargs)
|
|
101
|
+
|
|
102
|
+
quad = loaded_entity['quad']
|
|
103
|
+
assert quad.length == 1.0 and quad.k1 == 0.5
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@pytest.mark.parametrize(
|
|
107
|
+
'input_fixture,format,suffix', [
|
|
108
|
+
('madx_sequence', 'madx', 'madx'),
|
|
109
|
+
('json_line', 'json', 'json'),
|
|
110
|
+
('json_environment', 'json', 'json'),
|
|
111
|
+
]
|
|
112
|
+
)
|
|
113
|
+
@pytest.mark.parametrize('with_format', [True, False])
|
|
114
|
+
def test_load_http(input_fixture, format, suffix, with_format, tmpdir, request, requests_mock):
|
|
115
|
+
input_data = request.getfixturevalue(input_fixture)
|
|
116
|
+
|
|
117
|
+
url = f'http://example.com/test_input.{suffix}'
|
|
118
|
+
requests_mock.get(url, text=input_data)
|
|
119
|
+
|
|
120
|
+
kwargs = {'file': url}
|
|
121
|
+
if with_format:
|
|
122
|
+
kwargs['format'] = format
|
|
123
|
+
loaded_entity = xt.load(**kwargs)
|
|
124
|
+
|
|
125
|
+
quad = loaded_entity['quad']
|
|
126
|
+
assert quad.length == 1.0 and quad.k1 == 0.5
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def test_load_single_element():
|
|
130
|
+
string = json.dumps({
|
|
131
|
+
'__class__': 'Quadrupole',
|
|
132
|
+
'length': 1.0,
|
|
133
|
+
'k1': 0.5
|
|
134
|
+
})
|
|
135
|
+
quad = xt.load(string=string, format='json')
|
|
136
|
+
assert quad.length == 1.0 and quad.k1 == 0.5
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_load_invalid_input():
|
|
140
|
+
with pytest.raises(ValueError, match='either file or string'):
|
|
141
|
+
xt.load()
|
|
142
|
+
|
|
143
|
+
with pytest.raises(ValueError, match='either file or string'):
|
|
144
|
+
xt.load(file='test.madx', string='quad: quadrupole, l=1, k1=0.5;')
|
|
145
|
+
|
|
146
|
+
with pytest.raises(ValueError, match='Format must be specified'):
|
|
147
|
+
xt.load(string='{}')
|
|
148
|
+
|
|
149
|
+
with pytest.raises(ValueError, match='one of'):
|
|
150
|
+
xt.load(string='{}', format='invalid_format') # noqa
|
|
151
|
+
|
|
152
|
+
with pytest.raises(ValueError, match='Cannot determine class from json data'):
|
|
153
|
+
xt.load(string='{"length": 1.0, "k1": 0.5}', format='json')
|
|
@@ -46,6 +46,7 @@ from .loss_location_refinement import _skip_in_loss_location_refinement
|
|
|
46
46
|
from .trajectory_correction import TrajectoryCorrection
|
|
47
47
|
from .mad_parser.loader import load_madx_lattice
|
|
48
48
|
from . import json
|
|
49
|
+
from .load import load
|
|
49
50
|
|
|
50
51
|
from .multiline import Multiline
|
|
51
52
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.86.0'
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
from enum import Enum
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from xobjects.general import _print # noqa: F401
|
|
9
|
+
import requests
|
|
9
10
|
|
|
10
11
|
_pkg_root = Path(__file__).parent.absolute()
|
|
11
12
|
|
|
@@ -20,3 +21,14 @@ class _LOC:
|
|
|
20
21
|
|
|
21
22
|
START = _LOC('START')
|
|
22
23
|
END = _LOC('END')
|
|
24
|
+
|
|
25
|
+
def read_url(url, timeout=0.1):
|
|
26
|
+
"""
|
|
27
|
+
Read content from a URL.
|
|
28
|
+
"""
|
|
29
|
+
try:
|
|
30
|
+
response = requests.get(url, timeout=timeout)
|
|
31
|
+
response.raise_for_status() # Raise an error for bad responses
|
|
32
|
+
return response.text
|
|
33
|
+
except requests.exceptions.RequestException as e:
|
|
34
|
+
raise RuntimeError(f"Failed to read from URL {url}: {e}")
|
|
@@ -21,7 +21,16 @@ def dump(data, file, indent=1):
|
|
|
21
21
|
fh.close()
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def load(file):
|
|
24
|
+
def load(file=None, string=None):
|
|
25
|
+
|
|
26
|
+
if string is not None:
|
|
27
|
+
assert file is None, "Cannot specify both file and string"
|
|
28
|
+
data = json.loads(string)
|
|
29
|
+
return data
|
|
30
|
+
|
|
31
|
+
if file is None:
|
|
32
|
+
raise ValueError("Must specify either file or string")
|
|
33
|
+
|
|
25
34
|
if isinstance(file, io.IOBase):
|
|
26
35
|
fh, close = file, False
|
|
27
36
|
elif (isinstance(file, str) and file.endswith(".gz")) or (
|
|
@@ -5615,7 +5615,7 @@ class LineVars:
|
|
|
5615
5615
|
self.__dict__.update(state)
|
|
5616
5616
|
self.vars_to_update = WeakSet()
|
|
5617
5617
|
|
|
5618
|
-
def set_from_madx_file(self, filename):
|
|
5618
|
+
def set_from_madx_file(self, filename=None, string=None):
|
|
5619
5619
|
|
|
5620
5620
|
'''
|
|
5621
5621
|
Set variables veluas of expression from a MAD-X file.
|
|
@@ -5626,7 +5626,12 @@ class LineVars:
|
|
|
5626
5626
|
Path to the MAD-X file(s) to load.
|
|
5627
5627
|
'''
|
|
5628
5628
|
loader = xt.mad_parser.MadxLoader(env=self.line)
|
|
5629
|
-
|
|
5629
|
+
if filename is not None:
|
|
5630
|
+
assert string is None, 'Cannot specify both filename and string'
|
|
5631
|
+
loader.load_file(filename)
|
|
5632
|
+
elif string is not None:
|
|
5633
|
+
assert filename is None, 'Cannot specify both filename and string'
|
|
5634
|
+
loader.load_string(string)
|
|
5630
5635
|
|
|
5631
5636
|
def load_madx_optics_file(self, filename):
|
|
5632
5637
|
self.set_from_madx_file(filename)
|
|
@@ -5664,6 +5669,37 @@ class LineVars:
|
|
|
5664
5669
|
else:
|
|
5665
5670
|
self[kk] = kwargs[kk]
|
|
5666
5671
|
|
|
5672
|
+
def load(self, file=None, string=None, format=None, timeout=5.):
|
|
5673
|
+
|
|
5674
|
+
if format is None and file is not None:
|
|
5675
|
+
if file.endswith('.json'):
|
|
5676
|
+
format = 'json'
|
|
5677
|
+
elif file.endswith('.seq') or file.endswith('.madx') or file.endswith('.mad'):
|
|
5678
|
+
format = 'madx'
|
|
5679
|
+
|
|
5680
|
+
if file.startswith('http://') or file.startswith('https://'):
|
|
5681
|
+
assert string is None, 'Cannot specify both fname and string'
|
|
5682
|
+
string = xt.general.read_url(file, timeout=timeout)
|
|
5683
|
+
file = None
|
|
5684
|
+
|
|
5685
|
+
if file is not None:
|
|
5686
|
+
assert string is None, 'Cannot specify both fname and string'
|
|
5687
|
+
|
|
5688
|
+
if string is not None:
|
|
5689
|
+
assert file is None, 'Cannot specify both fname and string'
|
|
5690
|
+
assert format is not None, 'Must specify format when using string'
|
|
5691
|
+
|
|
5692
|
+
assert format in ['json', 'madx'], f'Unknown format {format}'
|
|
5693
|
+
|
|
5694
|
+
if format == 'json':
|
|
5695
|
+
ddd = xt.json.load(file=file, string=string)
|
|
5696
|
+
self.update(ddd)
|
|
5697
|
+
elif format == 'madx':
|
|
5698
|
+
return self.set_from_madx_file(filename=file, string=string)
|
|
5699
|
+
else:
|
|
5700
|
+
raise ValueError(f'Unknown format {format}')
|
|
5701
|
+
|
|
5702
|
+
|
|
5667
5703
|
def set(self, name, value):
|
|
5668
5704
|
if isinstance(value, str):
|
|
5669
5705
|
self[name] = self.line._xdeps_eval.eval(value)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# copyright ############################### #
|
|
2
|
+
# This file is part of the Xtrack Package. #
|
|
3
|
+
# Copyright (c) CERN, 2025. #
|
|
4
|
+
# ######################################### #
|
|
5
|
+
import xtrack as xt
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def load(
|
|
10
|
+
file=None,
|
|
11
|
+
string=None,
|
|
12
|
+
format: Literal['json', 'madx', 'python'] = None,
|
|
13
|
+
timeout=5.,
|
|
14
|
+
):
|
|
15
|
+
if (file is None) == (string is None):
|
|
16
|
+
raise ValueError('Must specify either file or string, but not both')
|
|
17
|
+
|
|
18
|
+
FORMATS = {'json', 'madx', 'python'}
|
|
19
|
+
if string and format not in FORMATS:
|
|
20
|
+
raise ValueError(f'Format must be specified to be one of {FORMATS} when '
|
|
21
|
+
f'using string input')
|
|
22
|
+
|
|
23
|
+
if format is None and file is not None:
|
|
24
|
+
if file.endswith('.json'):
|
|
25
|
+
format = 'json'
|
|
26
|
+
elif file.endswith('.seq') or file.endswith('.madx'):
|
|
27
|
+
format = 'madx'
|
|
28
|
+
elif file.endswith('.py'):
|
|
29
|
+
format = 'python'
|
|
30
|
+
|
|
31
|
+
if file and (file.startswith('http://') or file.startswith('https://')):
|
|
32
|
+
string = xt.general.read_url(file, timeout=timeout)
|
|
33
|
+
file = None
|
|
34
|
+
|
|
35
|
+
if format == 'json':
|
|
36
|
+
ddd = xt.json.load(file=file, string=string)
|
|
37
|
+
if '__class__' in ddd:
|
|
38
|
+
cls_name = ddd.pop('__class__')
|
|
39
|
+
cls = getattr(xt, cls_name)
|
|
40
|
+
return cls.from_dict(ddd)
|
|
41
|
+
elif 'lines' in ddd: # is environment
|
|
42
|
+
return xt.Environment.from_dict(ddd)
|
|
43
|
+
elif 'element_names' in ddd:
|
|
44
|
+
return xt.Line.from_dict(ddd)
|
|
45
|
+
else:
|
|
46
|
+
raise ValueError('Cannot determine class from json data')
|
|
47
|
+
elif format == 'madx':
|
|
48
|
+
return xt.load_madx_lattice(file=file, string=string)
|
|
49
|
+
elif format == 'python':
|
|
50
|
+
if string is not None:
|
|
51
|
+
raise NotImplementedError('Loading from string not implemented for python format')
|
|
52
|
+
env = xt.Environment()
|
|
53
|
+
env.call(file)
|
|
54
|
+
return env
|
|
@@ -427,6 +427,16 @@ class MadxLoader:
|
|
|
427
427
|
params['ksl'] = ksl
|
|
428
428
|
if params.pop('lrad', None):
|
|
429
429
|
_warn(f'Multipole `{name}` was specified with a length, ignoring!')
|
|
430
|
+
for kk in list(params.keys()):
|
|
431
|
+
if kk.startswith('k') and kk.endswith('l'):
|
|
432
|
+
if kk == 'ksl' or kk == 'knl':
|
|
433
|
+
continue
|
|
434
|
+
order = int(kk[1:-1])
|
|
435
|
+
if knl not in params:
|
|
436
|
+
params['knl'] = []
|
|
437
|
+
if len(params['knl']) <= order:
|
|
438
|
+
params['knl'] += [0] * (order - len(params['knl']) + 1)
|
|
439
|
+
params['knl'][order] = params.pop(kk)
|
|
430
440
|
|
|
431
441
|
elif parent_name == 'vkicker':
|
|
432
442
|
if (kick := params.pop('kick', None)):
|
|
@@ -15,6 +15,10 @@ def compensate_radiation_energy_loss(line, delta0=0, rtol_eneloss=1e-12,
|
|
|
15
15
|
assert line.particle_ref is not None, "Particle reference is not set"
|
|
16
16
|
assert np.abs(line.particle_ref.q0) == 1, "Only |q0| = 1 is supported (for now)"
|
|
17
17
|
|
|
18
|
+
if len(set(line.element_names)) != len(line.element_names):
|
|
19
|
+
raise ValueError("Line must not contain repeated elements to use "
|
|
20
|
+
"`compensate_radiation_energy_loss(...)`. ")
|
|
21
|
+
|
|
18
22
|
if 'record_iterations' in kwargs:
|
|
19
23
|
record_iterations = kwargs['record_iterations']
|
|
20
24
|
kwargs.pop('record_iterations')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xtrack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.86.0
|
|
4
4
|
Summary: Tracking library for particle accelerators
|
|
5
5
|
Home-page: https://xsuite.readthedocs.io/
|
|
6
6
|
Download-URL: https://pypi.python.org/pypi/xtrack
|
|
@@ -23,6 +23,7 @@ Requires-Dist: PyHEADTAIL; extra == "tests"
|
|
|
23
23
|
Requires-Dist: pytest; extra == "tests"
|
|
24
24
|
Requires-Dist: pytest-mock; extra == "tests"
|
|
25
25
|
Requires-Dist: pymadng; extra == "tests"
|
|
26
|
+
Requires-Dist: requests-mock; extra == "tests"
|
|
26
27
|
Provides-Extra: notebooks
|
|
27
28
|
Requires-Dist: jupyter; extra == "notebooks"
|
|
28
29
|
Requires-Dist: ipympl; extra == "notebooks"
|
|
@@ -51,6 +51,7 @@ tests/test_legacy_multiline_to_env.py
|
|
|
51
51
|
tests/test_lhc_env.py
|
|
52
52
|
tests/test_lhc_match_phase_15.py
|
|
53
53
|
tests/test_line.py
|
|
54
|
+
tests/test_load.py
|
|
54
55
|
tests/test_lumi.py
|
|
55
56
|
tests/test_mad_writer.py
|
|
56
57
|
tests/test_madloader.py
|
|
@@ -123,6 +124,7 @@ xtrack/internal_record.py
|
|
|
123
124
|
xtrack/json.py
|
|
124
125
|
xtrack/line.py
|
|
125
126
|
xtrack/linear_normal_form.py
|
|
127
|
+
xtrack/load.py
|
|
126
128
|
xtrack/lumi.py
|
|
127
129
|
xtrack/mad_loader.py
|
|
128
130
|
xtrack/mad_writer.py
|
xtrack-0.85.0/xtrack/_version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.85.0'
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|