Reference sixtrack tracking engine in pure python
rdemaria / pysixtrack Goto Github PK
View Code? Open in Web Editor NEWReference sixtrack tracking engine in pure python
License: Apache License 2.0
Reference sixtrack tracking engine in pure python
License: Apache License 2.0
Here an example:
In [7]: ps_part.p0c = 7000*1e9
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-7-6b6e194dff1d> in <module>()
----> 1 ps_part.p0c = 7000*1e9
~/Desktop/WeakStrongDevelopment/pysixtrack/pysixtrack/particles.py in p0c(self, p0c)
282 new = self._f1(self.mass0, p0c)
283 self._update_ref(*new)
--> 284 self._update_particles(*new)
285
286 energy0 = property(lambda self: self._energy0)
~/Desktop/WeakStrongDevelopment/pysixtrack/pysixtrack/particles.py in _update_particles(self, mass0, beta0, gamma0, p0c, energy0)
328 Energy = self.Energy
329 Pc = self.Pc
--> 330 mratio = mass / mass0
331 self._mratio = mratio
332 self._chi = self._qratio / mratio
NameError: name 'mass' is not defined
In [2]: import pysixtrack
In [3]: pysixtrack.Line()
Out[3]: Line(elements=[])
In [4]: l1 = pysixtrack.Line()
In [5]: l1.elements.append('hello')
In [6]: l2 = pysixtrack.Line()
In [7]: l2
Out[7]: Line(elements=['hello'])
For now, loader_mad
knows about rcollimator
but in general (at least in recent MAD-X versions) it should be collimator
. Let's also add kicker
and elseparator
(at least they are present in the SIS100 lattice, could be useful to translate them to hkicker
and vkicker
resp. a zero drift!).
We should clean up the names in the particle in pysixtrack and pysixtracklib to use the same as pyblep.
To be improved before merging:
cpymad
functionality, e.g.:>>> seq = madx.sequence.XYZ
>>> multipole = seq.expanded_elements[0]
>>> multipole.align_errors
AlignError(dx=-2.1754812916408347e-05, dy=-6.556356908596416e-06,
ds=0.0, dphi=0.0, dtheta=0.0, dpsi=0.0, mrex=0.0, mrey=0.0, mredx=0.0,
mredy=0.0, arex=0.0, arey=0.0, mscalx=0.0, mscaly=0.0)
>>> multipole.field_errors.dkn
[0.0,
1.1472076071601915e-06,
5.002980147857331e-06,
0.013090083041168831,
-0.19713806015162913,
-73.91912412030126,
-9.796705181638819,
0.0,
(...)
0.0]
Originally posted by @aoeftiger in #28 (comment)
For an instantiated elements.Multipole, it'd be really useful to assign higher-order magnet strengths even if they were not declared at instantiation.
e.g.
m = pysixtrack.elements.Multipole(knl=[0])
m.knl[1] = 1e-2 # currently raises an IndexError
This could be implemented based on abc.Sequence
similarly to the cpymad.madx.ArrayAttribute
approach -- which comes in really handy in cpymad
.
This feature would be useful for manipulation of Multipoles in particular in view of adding error components to an existing lattice.
Most notably, the BeamMonitor introduced in commit 3c0dceb is not present in the version installable via pip, causing pysixtracklib to fail on a vanilla installation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.