ARES add pictures

This commit is contained in:
2024-09-10 14:35:22 +02:00
parent 4c9e613ee9
commit a0a390b206
12 changed files with 90 additions and 34 deletions

View File

@@ -35,9 +35,11 @@ bitmask for simulation:
0x80:
"""
import os.path
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QSlider, QLineEdit,\
QCheckBox, QHBoxLayout, QVBoxLayout, QGroupBox, QGridLayout, QComboBox
from PyQt5.QtGui import QPainter, QColor, QPen, QBrush, QPolygon, QPolygonF, QTransform, QPainterPath
from PyQt5.QtGui import QPainter, QColor, QPen, QBrush, QPolygon, QPolygonF, QTransform, QPainterPath, QPixmap
from PyQt5.QtCore import QPoint, QPointF, Qt,pyqtSignal
import PyQt5.QtGui as QtGui
@@ -144,7 +146,22 @@ class ARESdevice():
'cc':22, # detector angle
}
self.setGeometry(g)
self._pic=pic=dict()
base=os.path.join(os.path.dirname(os.path.realpath(__file__)),'pic')
print(base)
for k,v in (
('ir','ARES_2Theta_InnerRing.png'),
('or','ARES_2Theta_OuterRing.png'),
('bl','ARES_Below.png'),
('df','ARES_Diffractometer.png'),
('di','ARES_Diode.png'),
('jf','ARES_Jungfrau.png'),
('lm','ARES_LaserMirror.png'),
('ma','ARES_Master.png'),
('mi','ARES_Mirrors.png'),
('pb','ARES_Parabola.png'),
):
pic[k]=QPixmap(os.path.join(base,v))
def setGeometry(self,geo):
self._geo=geo
@@ -219,6 +236,7 @@ class ARESdevice():
# scl scaling for x and y translation of coordinate systems
# paintMode: mode how to paint the diffraction beam
p=self._paint
pic=self._pic
ofs=p['ofs']
rArm=p['rArm']
@@ -233,6 +251,9 @@ class ARESdevice():
aDet=p['aDet']
aTrg=p['aTrg']
sclTrf=p['sclTrf']
#x=p.get('x',0)
#y=p.get('y',0)
#print(x,y)
tickW,tickL=3,20 # tick px-width, tick len
diW,diH=40,20 # diodes
@@ -324,6 +345,42 @@ class ARESdevice():
#qp.setPen(penRd)
#qp.drawRect(-10, -10+rArm, 20, 20)
#--- pixmaps ---
pm=pic['bl'] #bellow
w,h=pm.width(),pm.height()
qp.setTransform(tfArm);qp.translate(0, -rArm);qp.scale(.64,.64)
qp.drawPixmap(QPointF(-w/2,-h),pm)
pm=pic['mi'] #foccussing mirror
w,h=pm.width(),pm.height()
qp.setTransform(tf2Th);qp.translate(-39.6,-273.6);qp.scale(.64,.64)
qp.drawPixmap(QPointF(-w/2,-h/2),pm)
pm=pic['di'] #diode 2
w,h=pm.width(),pm.height()
qp.setTransform(tf2Th);qp.rotate(54);qp.translate(0,-290-71);qp.scale(.64,.64)
qp.drawPixmap(QPointF(-w/2,-h/2),pm)
pm=pic['df'] #diffrantometer
w,h=pm.width(),pm.height()
qp.setTransform(tfTrg);qp.translate(22, 17);qp.scale(.64,.64)
qp.drawPixmap(QPointF(-w/2,-h/2),pm)
pm=pic['jf'] #jungfrau detector
w,h=pm.width(),pm.height()
qp.setTransform(tfJFr);qp.translate(-25, -225);qp.scale(.64,.64)
qp.drawPixmap(QPointF(-w/2,-h/2),pm)
pm=pic['lm'] #laser mirror
w,h=pm.width(),pm.height()
qp.setTransform(tfDet);qp.rotate(181-7);qp.translate(13, -193);qp.scale(.64,.64)
qp.drawPixmap(QPointF(-w/2,-h/2),pm)
pm=pic['di'] #diode
w,h=pm.width(),pm.height()
qp.setTransform(tfDet);qp.rotate(165.4);qp.translate(-0, -205);qp.scale(.32,.32)
qp.drawPixmap(QPointF(-w/2,-h/2),pm)
#--- RIXS-arm devices ---
qp.setTransform(tfArm)
qp.setPen(QPen(QtCore.Qt.red, tickW, QtCore.Qt.SolidLine))
@@ -385,7 +442,7 @@ class ARESdevice():
#parabola mirror
qp.setTransform(tf0)
qp.setPen(penBk)
qp.setBrush(QColor(80,80,80,128))
qp.setBrush(QColor(192,192,0,192))
a,b=50.8,12
path=QPainterPath()
path.moveTo(-b-a/2,a)
@@ -462,7 +519,10 @@ class WndVisualize(QWidget):
('aDet',(0,360,), 30), # angle detector
('aTrg',(0,360,), 30), # angle target
('sclA', ( -8, 8), 1),
('sclD', (-8, 8), 1),):
('sclD', (-8, 8), 1),
#('x', (-100, 100), 10),
#('y', (-100, 100), 10),
):
wLb=QLabel(f"<font>{key}</font>",objectName=key) #MOST BE with <font> as it is changed later and else creates a seg fault
@@ -474,6 +534,8 @@ class WndVisualize(QWidget):
else:
v=pDev['sclTrf'][1]
v=int(round(np.log2(v)*2))
#elif key in ('x','y'):
# v=0
else:
v=pDev[key]
wSl.setValue(v)
@@ -639,21 +701,21 @@ class WndVisualize(QWidget):
dev=app._dev
if dev.containsPoint(mousePos):
self._devSel=dev
wGrp=self._wdGrpDraw
wGrp.setTitle(dev._name)
devP=dev._paint
for wSl in wGrp.findChildren(QSlider):
#_log.info(wSl)
key=wSl.objectName()
if key.startswith('scl'):
if key[-1]=='A':
v=devP['sclTrf'][0]
else:
v=devP['sclTrf'][1]
v=int(round(np.log2(v)*2))
else:
v=devP[key]
wSl.setValue(int(v))
#wGrp=self._wdGrpDraw
#wGrp.setTitle(dev._name)
#devP=dev._paint
#for wSl in wGrp.findChildren(QSlider):
# #_log.info(wSl)
# key=wSl.objectName()
# if key.startswith('scl'):
# if key[-1]=='A':
# v=devP['sclTrf'][0]
# else:
# v=devP['sclTrf'][1]
# v=int(round(np.log2(v)*2))
# else:
# v=devP[key]
# wSl.setValue(int(v))
self._mouseDrag={'obj':dev,'start':(mousePos,dev._paint['ofs'])}
try:

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
ARESvis/pic/ARES_Below.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
ARESvis/pic/ARES_Diode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
ARESvis/pic/ARES_Master.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -13,9 +13,8 @@ EPICS simulation motor PVs:
~/Documents/prj/SwissFEL/test_ioc/MotorSim/iocBoot/SATES30-RIXS/SATES30-RIXS.cmd
caQtDM -attach ~/Documents/prj/SwissFEL/test_ioc/MotorSim/iocBoot/SATES30-RIXS/SATES30-RIXS.ui
bitmask for simulation:
0x01: EPICS motors
bitmask for modes:
0x01:
0x02:
0x04:
0x08:
@@ -23,8 +22,6 @@ bitmask for simulation:
0x20:
0x40:
0x80:
"""
@@ -86,9 +83,6 @@ def obj_info(obj,p=''):
except AttributeError:
pass
#Ui_MainWindow, QMainWindow = loadUiType("graphEx1.ui")
#class RIXSgrating(QMainWindow, Ui_MainWindow):
# def __init__(self, ):
@@ -114,7 +108,7 @@ class WndMainRIXS(QWidget):
self._wDevs=w=QWidget(self)
w.move(10, 10)
lv=QVBoxLayout(w)
lv.addWidget(w)
#lv.addWidget(w)
for pb in ('Visualize','Vars'):
w=QPushButton(pb)
@@ -447,11 +441,11 @@ class RIXSdevice():
p=self._paint
sclA,sclD=p['sclTrf']
p.update({
'r1':int(geo['r1']*sclD),
'r2':int(geo['r2']*sclD),
'aa':int((90-geo['aa'])*sclA),
'bb':int((90-geo['bb'])*sclA),
'cc':int(geo['cc']),
'r1':geo['r1']*sclD,
'r2':geo['r2']*sclD,
'aa':(90-geo['aa'])*sclA,
'bb':(90-geo['bb'])*sclA,
'cc':geo['cc'],
})
def geometry2motor(self):
@@ -1061,7 +1055,7 @@ class WndVars(QWidget):
self.update_label(k,v)
self.update()
def update_label(self, k,v,**kwargs):
def update_label(self,k,v,**kwargs):
#_log.info(f'{k}:{v}:{kwargs}')
app=QApplication.instance()
dev=app._dev