Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zhang, Tong
Online Model App
Commits
9e469705
Commit
9e469705
authored
Jul 21, 2021
by
Doerr, Kevin
Browse files
Merged draw_ellipse functions into one overall function
parent
f26d29ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/myApp/app.py
View file @
9e469705
...
...
@@ -90,8 +90,7 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
replace with your routine for beam ellipse drawing.
"""
try
:
self
.
draw_ellipse_x
()
self
.
draw_ellipse_y
()
self
.
draw_ellipse
except
NotImplementedError
:
self
.
draw_envelope
()
...
...
@@ -120,36 +119,28 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
)
self
.
matplotlibbaseWidget
.
update_figure
()
def
draw_ellipse
_x
(
self
):
def
draw_ellipse
(
self
):
#raise NotImplementedError
"""Draw beam ellipse onto the figure area.
"""Draw
x and y
beam ellipse onto the figure area.
"""
ARIS_LAT
.
sync_settings
()
_
,
fm
=
ARIS_LAT
.
run
()
r
,
s
=
fm
.
run
(
monitor
=
'all'
)
keys
=
[
i
.
format
(
u
=
'x'
)
for
i
in
(
'{u}_cen'
,
'{u}p_cen'
,
'{u}_rms'
,
'{u}p_rms'
,
'emit_{u}'
,
'emitn_{u}'
,
'alpha_{u}'
,
'beta_{u}'
,
'gamma_{u}'
,
'total_intensity'
)]
vals
=
(
s
.
xcen
,
s
.
xpcen
,
s
.
xrms
,
s
.
xprms
,
s
.
xemittance
,
s
.
xnemittance
,
keys
_x
=
[
i
.
format
(
u
=
'x'
)
for
i
in
(
'{u}_cen'
,
'{u}p_cen'
,
'{u}_rms'
,
'{u}p_rms'
,
'emit_{u}'
,
'emitn_{u}'
,
'alpha_{u}'
,
'beta_{u}'
,
'gamma_{u}'
,
'total_intensity'
)]
vals
_x
=
(
s
.
xcen
,
s
.
xpcen
,
s
.
xrms
,
s
.
xprms
,
s
.
xemittance
,
s
.
xnemittance
,
s
.
xtwiss_alpha
,
s
.
xtwiss_beta
,
(
s
.
xtwiss_alpha
**
2
+
1
)
/
s
.
xtwiss_beta
,
1
)
params
=
dict
(
zip
(
keys
,
vals
))
params
_x
=
dict
(
zip
(
keys
_x
,
vals
_x
))
self
.
matplotlibbaseWidget
.
clear_figure
()
draw_beam_ellipse_with_params
(
params
,
color
=
'b'
,
factor
=
4
,
ax
=
self
.
matplotlibbaseWidget
.
axes
,
xoy
=
'x'
,
fill
=
'g'
,
anote
=
False
)
draw_beam_ellipse_with_params
(
params
_x
,
color
=
'b'
,
factor
=
4
,
ax
=
self
.
matplotlibbaseWidget
.
axes
,
xoy
=
'x'
,
fill
=
'g'
,
anote
=
False
)
self
.
matplotlibbaseWidget
.
update_figure
()
def
draw_ellipse_y
(
self
):
#raise NotImplementedError
"""Draw beam ellipse onto the figure area.
"""
ARIS_LAT
.
sync_settings
()
_
,
fm
=
ARIS_LAT
.
run
()
r
,
s
=
fm
.
run
(
monitor
=
'all'
)
keys
=
[
i
.
format
(
u
=
'y'
)
for
i
in
(
'{u}_cen'
,
'{u}p_cen'
,
'{u}_rms'
,
'{u}p_rms'
,
'emit_{u}'
,
'emitn_{u}'
,
'alpha_{u}'
,
'beta_{u}'
,
'gamma_{u}'
,
'total_intensity'
)]
vals
=
(
s
.
ycen
,
s
.
ypcen
,
s
.
yrms
,
s
.
yprms
,
s
.
yemittance
,
s
.
ynemittance
,
keys_y
=
[
i
.
format
(
u
=
'y'
)
for
i
in
(
'{u}_cen'
,
'{u}p_cen'
,
'{u}_rms'
,
'{u}p_rms'
,
'emit_{u}'
,
'emitn_{u}'
,
'alpha_{u}'
,
'beta_{u}'
,
'gamma_{u}'
,
'total_intensity'
)]
vals_y
=
(
s
.
ycen
,
s
.
ypcen
,
s
.
yrms
,
s
.
yprms
,
s
.
yemittance
,
s
.
ynemittance
,
s
.
ytwiss_alpha
,
s
.
ytwiss_beta
,
(
s
.
ytwiss_alpha
**
2
+
1
)
/
s
.
ytwiss_beta
,
1
)
params
=
dict
(
zip
(
keys
,
vals
))
params
_y
=
dict
(
zip
(
keys
_y
,
vals
_y
))
self
.
matplotlibbaseWidget_1
.
clear_figure
()
draw_beam_ellipse_with_params
(
params
,
color
=
'b'
,
factor
=
4
,
ax
=
self
.
matplotlibbaseWidget_1
.
axes
,
xoy
=
'y'
,
fill
=
'g'
,
anote
=
True
)
draw_beam_ellipse_with_params
(
params
_y
,
color
=
'b'
,
factor
=
4
,
ax
=
self
.
matplotlibbaseWidget_1
.
axes
,
xoy
=
'y'
,
fill
=
'g'
,
anote
=
True
)
self
.
matplotlibbaseWidget_1
.
update_figure
()
if
__name__
==
"__main__"
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment