Commit 42ac634d authored by Zhang, Tong's avatar Zhang, Tong
Browse files

Merge branch 'master' into 'master'

Master

See merge request !3
parents a83c1b6d 4bf96dad
......@@ -122,19 +122,27 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
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=True)
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()
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_y = dict(zip(keys_y, vals_y))
self.matplotlibbaseWidget_1.clear_figure()
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__":
from PyQt5.QtWidgets import QApplication
import sys
......
......@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui_app.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
......@@ -12,16 +12,23 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1024, 768)
MainWindow.resize(1284, 709)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icons/default.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(
QtGui.QPixmap(":/icons/default.png"), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.matplotlibbaseWidget = MatplotlibBaseWidget(self.centralwidget)
self.matplotlibbaseWidget.setGeometry(QtCore.QRect(0, 0, 640, 480))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.matplotlibbaseWidget.sizePolicy().hasHeightForWidth())
self.matplotlibbaseWidget.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(14)
......@@ -43,11 +50,10 @@ class Ui_MainWindow(object):
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget.setFigureXYticksFont(font)
self.matplotlibbaseWidget.setProperty("figureToolbarToggle", False)
self.matplotlibbaseWidget.setObjectName("matplotlibbaseWidget")
self.verticalLayout.addWidget(self.matplotlibbaseWidget)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(0, 480, 121, 19))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
......@@ -56,11 +62,11 @@ class Ui_MainWindow(object):
self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.quad1_name_cbb = QtWidgets.QComboBox(self.centralwidget)
self.quad1_name_cbb.setGeometry(QtCore.QRect(120, 480, 79, 27))
self.quad1_name_cbb.setObjectName("quad1_name_cbb")
self.horizontalLayout.addWidget(self.quad1_name_cbb)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(210, 480, 111, 19))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
......@@ -69,15 +75,45 @@ class Ui_MainWindow(object):
self.label_2.sizePolicy().hasHeightForWidth())
self.label_2.setSizePolicy(sizePolicy)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
self.quad1_grad_dsbox = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.quad1_grad_dsbox.setGeometry(QtCore.QRect(320, 480, 111, 28))
self.quad1_grad_dsbox.setDecimals(3)
self.quad1_grad_dsbox.setObjectName("quad1_grad_dsbox")
self.horizontalLayout.addWidget(self.quad1_grad_dsbox)
self.verticalLayout.addLayout(self.horizontalLayout)
self.matplotlibbaseWidget_1 = MatplotlibBaseWidget(self.centralwidget)
self.matplotlibbaseWidget_1.setGeometry(QtCore.QRect(640, 0, 640, 480))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.matplotlibbaseWidget_1.sizePolicy().hasHeightForWidth())
self.matplotlibbaseWidget_1.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(14)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget_1.setFigureXYlabelFont(font)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(16)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget_1.setFigureTitleFont(font)
font = QtGui.QFont()
font.setFamily("sans-serif")
font.setPointSize(12)
font.setBold(False)
font.setItalic(False)
font.setWeight(50)
self.matplotlibbaseWidget_1.setFigureXYticksFont(font)
self.matplotlibbaseWidget_1.setProperty("figureToolbarToggle", False)
self.matplotlibbaseWidget_1.setObjectName("matplotlibbaseWidget_1")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1024, 30))
self.menubar.setGeometry(QtCore.QRect(0, 0, 1284, 24))
self.menubar.setObjectName("menubar")
self.menu_File = QtWidgets.QMenu(self.menubar)
self.menu_File.setObjectName("menu_File")
......@@ -109,9 +145,17 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.matplotlibbaseWidget.setFigureXlabel(
_translate("MainWindow", "X (mm)"))
self.matplotlibbaseWidget.setFigureYlabel(
_translate("MainWindow", "X\' (mrad)"))
self.label.setText(_translate("MainWindow", "Select quadrupole"))
self.label_2.setText(_translate("MainWindow", "Gradient Setting"))
self.quad1_grad_dsbox.setSuffix(_translate("MainWindow", " T/m"))
self.matplotlibbaseWidget_1.setFigureXlabel(
_translate("MainWindow", "Y (mm)"))
self.matplotlibbaseWidget_1.setFigureYlabel(
_translate("MainWindow", "Y\' (mrad)"))
self.menu_File.setTitle(_translate("MainWindow", "&File"))
self.menu_Help.setTitle(_translate("MainWindow", "&Help"))
self.action_About.setText(_translate("MainWindow", "&About"))
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1024</width>
<height>768</height>
<width>1284</width>
<height>709</height>
</rect>
</property>
<property name="windowTitle">
......@@ -18,90 +18,182 @@
<normaloff>:/icons/default.png</normaloff>:/icons/default.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="MatplotlibBaseWidget" name="matplotlibbaseWidget">
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select quadrupole</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="quad1_name_cbb"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Gradient Setting</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="quad1_grad_dsbox">
<property name="suffix">
<string> T/m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<widget class="MatplotlibBaseWidget" name="matplotlibbaseWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="figureXlabel">
<string>X (mm)</string>
</property>
<property name="figureYlabel">
<string>X' (mrad)</string>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureToolbarToggle" stdset="0">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>0</x>
<y>480</y>
<width>121</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select quadrupole</string>
</property>
</widget>
<widget class="QComboBox" name="quad1_name_cbb">
<property name="geometry">
<rect>
<x>120</x>
<y>480</y>
<width>79</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>210</x>
<y>480</y>
<width>111</width>
<height>19</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Gradient Setting</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="quad1_grad_dsbox">
<property name="geometry">
<rect>
<x>320</x>
<y>480</y>
<width>111</width>
<height>28</height>
</rect>
</property>
<property name="suffix">
<string> T/m</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
<widget class="MatplotlibBaseWidget" name="matplotlibbaseWidget_1">
<property name="geometry">
<rect>
<x>640</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="figureXlabel">
<string>Y (mm)</string>
</property>
<property name="figureYlabel">
<string>Y' (mrad)</string>
</property>
<property name="figureXYlabelFont">
<font>
<family>sans-serif</family>
<pointsize>14</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureTitleFont">
<font>
<family>sans-serif</family>
<pointsize>16</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureXYticksFont">
<font>
<family>sans-serif</family>
<pointsize>12</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="figureToolbarToggle" stdset="0">
<bool>false</bool>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1024</width>
<height>30</height>
<width>1284</width>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment