-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
twiss with coupled latice #40
Comments
divide by zero is not a 'warning'. The code works incorrectly, so this needs to be fixed. |
divided by zero is error which crushs the code. Here is not this case see below print M[2, 3]/M[2, 2]_m.beta_y - M[2, 3]_m.alpha_y, arctan(M[2, 3]/(M[2, 2]_m.beta_y - M[2, 3]_m.alpha_y)) 5.45502412182 0.00111206462467 |
stranhe. Why does devide by zero not cause code to crash. Anyway it has nothing to do with coupliong |
done |
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)
The text was updated successfully, but these errors were encountered: