GithubHelp home page GithubHelp logo

iagapov / ocelot Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 11.0 457.49 MB

Main repository moved to https://github.com/ocelot-collab/ocelot

License: GNU General Public License v3.0

Python 76.61% Makefile 0.18% C++ 11.69% C 0.22% GLSL 10.25% Batchfile 0.04% CSS 1.01%

ocelot's People

Contributors

ggeloni avatar iagapov avatar novokshonov avatar sergey-tomin avatar sserkez avatar ttanikawa avatar zagorodnov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocelot's Issues

demos.optics.ex6.py does not work

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

e_beam_parameters looks broken, please check

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

sextupole: remove parameter ms

for zero length sextupoles will be better to use multipole.
taking into account multipoles in chromaticity calculation

plot sextupole in gui.accelerator

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()

restructure

remove ocelot.rad
remove ocelot.lib and move ocelot.lib.genera -> ocelot.genera
consider renaming genera -> sr to improve understandability, but not necessarily

desy.demos.ebeam.track_flash2 crashes

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%

rename module math.py

rename module common -> math.py
on mac some scripts imports this module instead of standard math module

cpbd.demos.sr examples do not work (windows)

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

speed up calculations

scipy.weave is unsupported now. We need to choose standard tool for speeding up some calculations. Maybe cython?
Replace scipy.weave in code.

cpbd.demo.storage_ring_da does not work (windows)

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

scipy.constants use not recommended

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

FEL simulations: hxrss_common.py - consider change in update_beam

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.

common.globals

functions related to undulator parameters need to be moved to appropriate modules.

docs/phys_ref.pdf

rename:

phys_ref.pdf --> electron_optics_ref.pdf

rename:

OCELOT Program
Physical Methods Manual

-->>
OCELOT: electron optics physics reference

sort out script locations

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?

cavity map

optical functions with cavities on differ from elegant

twiss broken

undulator transfer map order 2 by default. Twiss does not work (standard sase_tdp.py script)

genera.calculate_sr

in the screen object, after the call info like nx ny etc is removed. Better keep it.

remove RFcavity

RFcavity is already present as Cavity. Maybe add missing parameters to 'Cavity'.
Maybe calculate harmonic number from

get_envelope()

cpbd.beam.get_envelope() should calculate twiss parameters with taking into account dispersion.

element names in gui.accelerator

in the lower panel where the elements are shown:

  1. Show element name and type when the mouse is focused on the element
  2. Then the color-coding label (quad, bend, sext) can also be removed

twiss with coupled latice

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)

cleanup weave

  1. Allow for clean inclusion/exclusion of weave code in cpbd
  2. check performance on cluster

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.