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
faeade71
Commit
faeade71
authored
Jul 15, 2021
by
Doerr, Kevin
Browse files
Added draw ellipse function into app.py
parent
be92f1da
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/myApp/app.py
View file @
faeade71
...
...
@@ -14,6 +14,7 @@ Show the available templates:
>>> makeBasePyQtApp -l
"""
from
phantasy_apps.allison_scanner.data
import
draw_beam_ellipse_with_params
from
PyQt5.QtCore
import
pyqtSlot
from
PyQt5.QtWidgets
import
QMainWindow
...
...
@@ -119,8 +120,20 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
self
.
matplotlibbaseWidget
.
update_figure
()
def
draw_ellipse
(
self
):
raise
NotImplementedError
#
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
=
'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
,
s
.
xtwiss_alpha
,
s
.
xtwiss_beta
,
(
s
.
xtwiss_alpha
**
2
+
1
)
/
s
.
xtwiss_beta
,
1
)
params
=
dict
(
zip
(
keys
,
vals
))
self
.
matplotlibbaseWidget
.
clear_figure
()
draw_beam_ellipse_with_params
(
params
,
color
=
'b'
,
factor
=
4
,
ax
=
self
.
matplotlibbaseWidget
.
axes
,
xoy
=
'x'
,
fill
=
'g'
,
anote
=
True
)
self
.
matplotlibbaseWidget
.
update_figure
()
if
__name__
==
"__main__"
:
from
PyQt5.QtWidgets
import
QApplication
...
...
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