from pylab import
from scipy.optimize import
from scipy import optimize
import ocelot
from ocelot import
from ocelot.cpbd.errors import create_copy
from ocelot.cpbd.match import closed_orbit
from ocelot.cpbd.orbit_correction import
from ocelot.cpbd.response_matrix import *
'''
assign errors and compute orbit
'''
lat = create_copy(lat0,1)
for e in lat.sequence:
if e.class == Quadrupole:
e.dx = np.random.randn()
e.dy = np.random.randn()
lat.update_transfer_maps()
p0 = closed_orbit(lat)
###########
output
###########
Traceback (most recent call last):
File "C:\workspace\misc\loco\co_issue0.py", line 35, in
p0 = closed_orbit(lat)
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\match.py", line 311, in closed_orbit
R = tm0.R(energy)[:4, :4]
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 239, in
m2.R = lambda energy: np.dot(self.R(energy), m.R(energy))
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 239, in
m2.R = lambda energy: np.dot(self.R(energy), m.R(energy))
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 239, in
m2.R = lambda energy: np.dot(self.R(energy), m.R(energy))
[Previous line repeated 990 more times]
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 397, in
m.R = lambda energy: m.R_z(s, energy)
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 793, in
tm.R_z = lambda z, energy: np.dot(np.dot(rot_mtx(-tilt), r_z_e(z, energy)), rot_mtx(tilt))
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\r_matrix.py", line 86, in
r_z_e = lambda z, energy: uni_matrix(z, 0, hx=0, sum_tilts=0, energy=energy)
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\r_matrix.py", line 29, in uni_matrix
kx = np.sqrt(kx2 + 0.j)
RecursionError: maximum recursion depth exceeded while calling a Python object
from pylab import from scipy.optimize import from scipy import optimize
import ocelot from ocelot import from ocelot.cpbd.errors import create_copy from ocelot.cpbd.match import closed_orbit from ocelot.cpbd.orbit_correction import from ocelot.cpbd.response_matrix import *
qf = Quadrupole(l=0.2, k1 = 2, eid="qf") qd = Quadrupole(l=0.2, k1 = -2, eid="qd") d1 = Drift(l=1.) hv = Hcor(l=0.0, angle=0.0e-3) vv = Vcor(l=0.0, angle=0.0e-3) bpm = Monitor()
fcell = (hv,vv,qf,d1,hv, vv,qd,bpm, d1,hv,vv,qf,bpm, d1, hv,vv, qd,d1 )
this works for small lattices (e.g. 10 cells) but not for larger
lat0 = MagneticLattice((100*fcell), method=MethodTM())
''' assign errors and compute orbit ''' lat = create_copy(lat0,1) for e in lat.sequence: if e.class == Quadrupole: e.dx = np.random.randn() e.dy = np.random.randn() lat.update_transfer_maps()
p0 = closed_orbit(lat)
########### output ###########
Traceback (most recent call last): File "C:\workspace\misc\loco\co_issue0.py", line 35, in
p0 = closed_orbit(lat)
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\match.py", line 311, in closed_orbit
R = tm0.R(energy)[:4, :4]
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 239, in
m2.R = lambda energy: np.dot(self.R(energy), m.R(energy))
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 239, in
m2.R = lambda energy: np.dot(self.R(energy), m.R(energy))
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 239, in
m2.R = lambda energy: np.dot(self.R(energy), m.R(energy))
[Previous line repeated 990 more times]
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 397, in
m.R = lambda energy: m.R_z(s, energy)
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\optics.py", line 793, in
tm.R_z = lambda z, energy: np.dot(np.dot(rot_mtx(-tilt), r_z_e(z, energy)), rot_mtx(tilt))
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\r_matrix.py", line 86, in
r_z_e = lambda z, energy: uni_matrix(z, 0, hx=0, sum_tilts=0, energy=energy)
File "c:\workspace\ocelot-collab\ocelot\ocelot\cpbd\r_matrix.py", line 29, in uni_matrix
kx = np.sqrt(kx2 + 0.j)
RecursionError: maximum recursion depth exceeded while calling a Python object