iagapov / ocelot Goto Github PK
View Code? Open in Web Editor NEWMain repository moved to https://github.com/ocelot-collab/ocelot
License: GNU General Public License v3.0
Main repository moved to https://github.com/ocelot-collab/ocelot
License: GNU General Public License v3.0
so that each script needs only from ocelot import *
undulator transfer map order 2 by default. Twiss does not work (standard sase_tdp.py script)
add helical undulator parameter
starting from get_envelope in
https://github.com/iagapov/desy/blob/master/flash/track_flash.py
put together a library of similar processing functions, including
-> slice emittance and twiss parameters
-> current profile
why such name? Maybe rename to 'Marker'?
from ocelot import *
from ocelot.gui.accelerator import *
d2 = Drift(l=1.0)
sf1 = Sextupole(l=0.25, k2= 260)
beam = Beam()
beam.E = 5.0
beam.sigma_E = 0.002
beam.beta_x = 1
beam.beta_y = 1
tw0 = Twiss(beam)
lat = MagneticLattice( (d2,sf1,d2))
tws=twiss(lat, Twiss(beam), nPoints = 1000)
plot_opt_func(lat, tws)
plt.show()
for zero length sextupoles will be better to use multipole.
taking into account multipoles in chromaticity calculation
demos -- to be distributed with code, simple clean examples, on version control
repository -- only related to working machines (xfel), clean, separate version control + xfel.eu website
scripts(work) -- work in progress scripts. Version control? Partial version control?
remove ocelot.gui.file.txt from version control
Script enclosed. Bad matching in both planes.
fel.py line 38, check formulae
a = p.aw02 / (2*(2+p.aw02))
etc.
(make sure there's no confusion between k_rms and k_max)
e.g. something likephase advance e1 ->e2
constr[e2] = {'dmux', pi, e1}
scipy.weave is unsupported now. We need to choose standard tool for speeding up some calculations. Maybe cython?
Replace scipy.weave in code.
add test for mad-x translation to ocelot.test -- 1 example
rename cpbd.optics.track into step and move to cpbd.tracking
rename cpbd.tracking to cpbd.track
optical functions with cavities on differ from elegant
in the lower panel where the elements are shown:
ksi_x = -25.994508998
ksi_y = -22.8071219474
Chromatism compensate: Before: {'SF': 1.5, 'SD': -1.5}
Chromatism compensate: After: {'SF': 5.8914775395193395, 'SD': -6.8036102026266407}
0
No module named msvccompiler in numpy.distutils; trying from distutils
creating c:\users\iagapov\appdata\local\temp\scipy-iagapov-sushtr\python27_intermediate\compiler_e3b0c44298fc1c149afbf4c8996fb924
Cannot build msvcr library: "msvcr90d.dll" not found
Cannot build msvcr library: "msvcr90d.dll" not found
No module named msvccompiler in numpy.distutils; trying from distutils
Cannot build msvcr library: "msvcr90d.dll" not found
charge = 1e-09
Traceback (most recent call last):
File "track_flash2.py", line 40, in
p_array, charge_array = astra_beam2particleArray(filename='elegant_files/flash_out_200000.ast')
File "/data/netapp/xfel/products/test/ocelot/adaptors/astra2ocelot.py", line 50, in astra_beam2particleArray
xxstg = exact_xp_2_xxstg(xp, gamref)
File "/data/netapp/xfel/products/test/ocelot/adaptors/astra2ocelot.py", line 13, in exact_xp_2_xxstg
u = u/np.linalg.norm(u, 2, 1).reshape((N, 1))
TypeError: norm() takes at most 2 arguments (3 given)
[iagapov@it-hpc-wgs01]/data/netapp/xfel/products/desy/demos/ebeam/flash%
Traceback (most recent call last):
File "/home/ilya/workspace/desy/petra3/petra_twiss.py", line 40, in
eb.integrals_id()
File "/home/ilya/workspace/ocelot/cpbd/e_beam_params.py", line 125, in integrals_id
B = K2field(elem.Kx, lu = elem.lperiod)
NameError: global name 'K2field' is not defined
or at least up to second order
cpbd.beam.get_envelope() should calculate twiss parameters with taking into account dispersion.
function definition does not conform to standards
functions related to undulator parameters need to be moved to appropriate modules.
Traceback (most recent call last):
File "C:/Users/tomins/Documents/Dropbox/DESY/repository/ocelot/demos/optics/ex6.py", line 92, in
s2 = fwhm(x,np.abs(of.mesh.points[:,of.ny/2]))
File "C:\Users\tomins\Documents\Dropbox\DESY\repository\ocelot\common\math_op.py", line 126, in fwhm
return x[downs[-1]] - x[ups[0]]
IndexError: list index out of range
add temperature parameter to Fhkl lookup
remove one of this possibility for clarity
update_transfer_maps does not seem to work correctly with cavities
following code should work:
navi = Navigator()
while navi.z0 < lat.totalLen:
track(lat, plist, dz=dz, navi=navi, order=1)
navi.reset()
while navi.z0 < lat.totalLen:
track(lat, plist, dz=dz, navi=navi, order=1)
beam file interpolation on transform
for r56 for drifts and cavities is 0. Should not be 0.
using expressions
h_eV_s = const.codata.value('Planck constant in eV s')
in common.globals
is not recommended since the value might be installation dependant
and not always verifyable
use explicit values
with coupling twiss does not work with error
ocelot/cpbd/optics.py:170: RuntimeWarning: divide by zero encountered in double_scalars
d_mux = arctan(M[0, 1]/(M[0, 0]_m.beta_x - M[0, 1]_m.alpha_x))
this should be changed to some other warning/error indicating that in coupled case decoupled twiss is not correct
test case:
D0 = Drift (l = 5., id = "D0")
D1 = Drift (l = 1., id = "D1")
D2 = Drift (l = 2.0, id = "D2")
Q1 = Quadrupole (l = 0.1, k1 = -0.6, id = "Q1")
Q2 = Quadrupole (l = 0.1, k1 = 0.01, id = "Q2", tilt = pi/4)
sec = (D0, Q1, D1, Q2, D2)
beam = Beam()
beam.E = 6.0
beam.sigma_E = 0.002
beam.emit_xn = 0.4e-6
beam.emit_yn = 0.4e-6
beam.gamma_rel = beam.E / (0.511e-3)
beam.emit_x = beam.emit_xn / beam.gamma_rel
beam.emit_y = beam.emit_yn / beam.gamma_rel
beam.beta_x = 10.0
beam.beta_y = 3.0
beam.alpha_x = 2.0
beam.alpha_y = -2.0
lat = MagneticLattice(sec)
tw0 = Twiss(beam)
tws=twiss(lat, tw0, nPoints = 1000)
RFcavity is already present as Cavity. Maybe add missing parameters to 'Cavity'.
Maybe calculate harmonic number from
remove ocelot.rad
remove ocelot.lib and move ocelot.lib.genera -> ocelot.genera
consider renaming genera -> sr to improve understandability, but not necessarily
Consider deleting the line
beam_new.z = beam_new.z[:-i_diff]
in the update_beam function in hxrss_common.py
The number of slices in the radiation file is larger than the original one in the beam file. i_diff is defined as such difference. If you redefine beam_new.z with beam_new.z = beam_new.z[:-i_diff]
you actually cut the original beamfile, ending up with less slices than in the original beamfile. Deleting this line you end up with a number of slices in the beam file equal to the original one.
please have a look if is possible to add fintx parameter to bends
http://frs.home.cern.ch/frs/Xdoc/Introduction/bend.html
This is used for lcls lattice
currently fint1 = fint2 = fint
and a function to attach solvers according to z range or area.
in the screen object, after the call info like nx ny etc is removed. Better keep it.
rename:
phys_ref.pdf --> electron_optics_ref.pdf
rename:
OCELOT Program
Physical Methods Manual
-->>
OCELOT: electron optics physics reference
C:\Users\iagapov\workspace\ocelot/lib/genera/build/genera_libs/undulator.so
platform = win32 os.name = nt
Traceback (most recent call last):
File "C:\Users\iagapov\workspace\ocelot\demos\sr\spatial.py", line 5, in
from ocelot.lib.genera.src.python.radiation import generaSR
File "C:\Users\iagapov\workspace\ocelot\lib\genera\src\python\radiation\generaSR.py", line 6, in
from ocelot.lib.genera.src.python.trajectory.lat_trajectory import trace4radiation
File "C:\Users\iagapov\workspace\ocelot\lib\genera\src\python\trajectory\lat_trajectory.py", line 2, in
from undulator import und_trace
File "C:\Users\iagapov\workspace\ocelot\lib\genera\src\python\trajectory\undulator.py", line 40, in
exec(open(path_to_ocelot + "/lib/genera/src/cpp/compile.py"))
File "C:\Users\iagapov\workspace\ocelot/lib/genera/src/cpp/compile.py", line 73, in
compile(dir_path)
File "C:\Users\iagapov\workspace\ocelot/lib/genera/src/cpp/compile.py", line 33, in compile
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "C:\Python27\lib\subprocess.py", line 709, in init
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
thus optics for bend and sbend not the same
in optics module
rename module common -> math.py
on mac some scripts imports this module instead of standard math module
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.