xtrack 0.47.1__tar.gz → 0.47.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.47.1/xtrack.egg-info → xtrack-0.47.2}/PKG-INFO +1 -1
- xtrack-0.47.2/xtrack/_version.py +1 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/line.py +32 -6
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/mad_loader.py +9 -4
- {xtrack-0.47.1 → xtrack-0.47.2/xtrack.egg-info}/PKG-INFO +1 -1
- xtrack-0.47.1/xtrack/_version.py +0 -1
- {xtrack-0.47.1 → xtrack-0.47.2}/LICENSE +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/MANIFEST.in +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/README.md +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/base_classes.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/BB6D.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/BB6Ddata.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/beambeam.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/boost.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/gaussian_fields.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/propagate_sigma_matrix.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/qgauss.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/slicing.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/be_beamfields/spacecharge.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/elements.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/line.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/mathlibs.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/particles.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/ducktrack/temp_pyparticles.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/pyproject.toml +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/setup.cfg +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/setup.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/_temp/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/_temp/lhc_match/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/_temp/lhc_match/gen_madx_optics_file.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/_temp/lhc_match/lhc_match.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/_temp/lhc_match/var_limits.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/base_element.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures_src/limitellipse.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures_src/limitpolygon.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures_src/limitracetrack.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures_src/limitrect.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures_src/limitrectellipse.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/apertures_src/longitudinallimitrect.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/beam_interaction.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/bend.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/cavity.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/combinedfunctionmagnet.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/dipoleedge.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/drift.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/drift_elem.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/elens.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/exciter.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/firstordertaylormap.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/fringe.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/fringe_track.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/lineartransfermatrix.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/linesegmentmap.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/multipolar_kick.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/multipole.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/nonlinearlens.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/quadrupole.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/referenceenergyincrease.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/rfmultipole.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/second_order_taylor_map.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/sextupole.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/simplethinbend.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/simplethinquadrupole.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/solenoid.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/srotation.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/track_thick_bend.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/track_thick_cfd.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/track_yrotation.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/wedge.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/wedge_track.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/wire.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/xrotation.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/xyshift.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/yrotation.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/elements_src/zetashift.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/beam_elements/exciter.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/compounds.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/footprint.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/general.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/headers/atomicadd.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/headers/checks.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/headers/constants.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/headers/particle_states.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/headers/synrad_spectrum.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/internal_record.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/linear_normal_form.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/loss_location_refinement/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/loss_location_refinement/loss_location_refinement.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/lumi.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/match.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/beam_position_monitor.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/beam_position_monitor.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/beam_profile_monitor.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/beam_profile_monitor.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/beam_size_monitor.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/beam_size_monitor.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/last_turns_monitor.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/last_turns_monitor.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/particles_monitor.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/monitors/particles_monitor.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/multiline/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/multiline/multiline.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/multiline/shared_knobs.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/multisetter/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/multisetter/multisetter.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/pipeline/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/pipeline/core.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/pipeline/manager.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/pipeline/multitracker.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/prebuild_kernels.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/prebuilt_kernels/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/prebuilt_kernels/kernel_definitions.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/progress_indicator.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/__init__.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/random_generators.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/random_src/exponential.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/random_src/exponential_integral_Ei.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/random_src/normal.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/random_src/rutherford.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/random/random_src/uniform.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/slicing.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/survey.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/tapering.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/targets.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/tracker.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/tracker_data.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/tracker_src/tracker.h +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack/twiss.py +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack.egg-info/SOURCES.txt +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack.egg-info/dependency_links.txt +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack.egg-info/requires.txt +0 -0
- {xtrack-0.47.1 → xtrack-0.47.2}/xtrack.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = '0.47.2'
|
@@ -10,6 +10,7 @@ import json
|
|
10
10
|
from contextlib import contextmanager
|
11
11
|
from copy import deepcopy
|
12
12
|
from pprint import pformat
|
13
|
+
from pathlib import Path
|
13
14
|
from typing import List, Literal, Optional, Collection
|
14
15
|
|
15
16
|
import numpy as np
|
@@ -3765,25 +3766,47 @@ class LineVars:
|
|
3765
3766
|
self._cache_active = value
|
3766
3767
|
self.line._xdeps_manager._tree_frozen = value
|
3767
3768
|
|
3768
|
-
def
|
3769
|
+
def set_from_madx_file(self, filename, mad_stdout=False):
|
3770
|
+
|
3771
|
+
'''
|
3772
|
+
Set variables veluas of expression from a MAD-X file.
|
3773
|
+
|
3774
|
+
Parameters
|
3775
|
+
----------
|
3776
|
+
filename : str or list of str
|
3777
|
+
Path to the MAD-X file(s) to load.
|
3778
|
+
mad_stdout : bool, optional
|
3779
|
+
If True, the MAD-X output is printed to stdout.
|
3780
|
+
|
3781
|
+
Notes
|
3782
|
+
-----
|
3783
|
+
The MAD-X file is executed in a temporary MAD-X instance, and the
|
3784
|
+
variables are copied to the line after the execution.
|
3785
|
+
'''
|
3786
|
+
|
3769
3787
|
from cpymad.madx import Madx
|
3770
|
-
mad = Madx()
|
3788
|
+
mad = Madx(stdout=mad_stdout)
|
3771
3789
|
mad.options.echo = False
|
3772
3790
|
mad.options.info = False
|
3773
3791
|
mad.options.warn = False
|
3774
|
-
|
3792
|
+
if isinstance(filename, (str, Path)):
|
3793
|
+
filename = [filename]
|
3794
|
+
else:
|
3795
|
+
assert isinstance(filename, (list, tuple))
|
3796
|
+
for ff in filename:
|
3797
|
+
mad.call(str(ff))
|
3775
3798
|
|
3776
3799
|
assert self.cache_active is False, (
|
3777
3800
|
'Cannot load optics file when cache is active')
|
3778
3801
|
|
3779
3802
|
mad.input('''
|
3780
|
-
elm: marker;
|
3781
|
-
beam; use,sequence=
|
3803
|
+
elm: marker; dummy: sequence, l=1; e:elm, at=0.5; endsequence;
|
3804
|
+
beam; use,sequence=dummy;''')
|
3782
3805
|
|
3783
3806
|
defined_vars = set(mad.globals.keys())
|
3784
3807
|
|
3785
3808
|
xt.general._print.suppress = True
|
3786
|
-
dummy_line = xt.Line.from_madx_sequence(mad.sequence.
|
3809
|
+
dummy_line = xt.Line.from_madx_sequence(mad.sequence.dummy,
|
3787
3810
|
deferred_expressions=True)
|
3788
3811
|
xt.general._print.suppress = False
|
3789
3812
|
|
@@ -3805,6 +3828,9 @@ class LineVars:
|
|
3805
3828
|
|
3806
3829
|
self.line._xdeps_vref._owner.default_factory = None
|
3807
3830
|
|
3831
|
+
def load_madx_optics_file(self, filename, mad_stdout=False):
|
3832
|
+
self.set_from_madx_file(filename, mad_stdout=mad_stdout)
|
3833
|
+
|
3808
3834
|
class VarValues:
|
3809
3835
|
|
3810
3836
|
def __init__(self, vars):
|
@@ -686,11 +686,16 @@ class MadLoader:
|
|
686
686
|
madeval = None
|
687
687
|
self.Builder = ElementBuilder
|
688
688
|
|
689
|
-
|
689
|
+
# Avoid progress bar if there are few elements
|
690
|
+
if len(self.sequence.expanded_elements) > 10:
|
691
|
+
_prog = progress(
|
690
692
|
self.iter_elements(madeval=madeval),
|
691
693
|
desc=f'Converting sequence "{self.sequence.name}"',
|
692
|
-
total=len(self.sequence.expanded_elements))
|
693
|
-
|
694
|
+
total=len(self.sequence.expanded_elements))
|
695
|
+
else:
|
696
|
+
_prog = self.iter_elements(madeval=madeval)
|
697
|
+
|
698
|
+
for ii, el in enumerate(_prog):
|
694
699
|
# for each mad element create xtract elements in a buffer and add to a line
|
695
700
|
converter = getattr(self, "convert_" + el.type, None)
|
696
701
|
adder = getattr(self, "add_" + el.type, None)
|
@@ -827,7 +832,7 @@ class MadLoader:
|
|
827
832
|
def _convert_quadrupole_thick(self, mad_el):
|
828
833
|
if mad_el.k1s:
|
829
834
|
tilt = -self.math.atan2(mad_el.k1s, mad_el.k1) / 2
|
830
|
-
k1 =
|
835
|
+
k1 = self.math.sqrt(mad_el.k1s ** 2 + mad_el.k1 ** 2)
|
831
836
|
else:
|
832
837
|
tilt = None
|
833
838
|
k1 = mad_el.k1
|
xtrack-0.47.1/xtrack/_version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = '0.47.1'
|
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
|
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
|