add gonio default positions
This commit is contained in:
@@ -52,9 +52,10 @@ class AppCfg(QSettings):
|
||||
WINDOW_STATE= "window/state"
|
||||
|
||||
DFT_POS_DET ="default_position/detector" #json
|
||||
DFT_POS_GONIO ="default_position/gonio" #json
|
||||
DFT_POS_PST ="default_position/post_sample_tube" #json
|
||||
DFT_POS_COL ="default_position/collimator" #json
|
||||
DFT_POS_BKLGT ="default_position/backlight" #json
|
||||
DFT_POS_BKLGT ="default_position/backlight" #json
|
||||
|
||||
DT_HOST="deltatau/host"
|
||||
DT_MISC="deltatau/miscellaneous"
|
||||
@@ -140,8 +141,8 @@ class AppCfg(QSettings):
|
||||
dflt.append((AppCfg.DAQ_BS_CH, ("SARES30-LSCP1-CRISTA1:CH0:1",))) #list of BS channels
|
||||
if AppCfg.DAQ_PV_CH not in keys:
|
||||
dflt.append((AppCfg.DAQ_PV_CH, () )) #list of PVs
|
||||
|
||||
|
||||
if AppCfg.DFT_POS_GONIO not in keys:
|
||||
dflt.append((AppCfg.DFT_POS_GONIO, {'mount':(0.,0.,0.,0.),'align':(0.,0.,0.,0.)}))#defout positions
|
||||
|
||||
for k,v in dflt:
|
||||
_log.warning(f'{k} not defined. use default')
|
||||
@@ -163,7 +164,7 @@ class AppCfg(QSettings):
|
||||
elif key in (AppCfg.GBL_MISC, # for all these keys convert to json and change " to '
|
||||
AppCfg.GEO_CAM_PARAM,
|
||||
AppCfg.GEO_FND_FID, AppCfg.GEO_AUTOFOC,
|
||||
AppCfg.DFT_POS_DET,AppCfg.DFT_POS_PST,AppCfg.DFT_POS_COL,AppCfg.DFT_POS_BKLGT,
|
||||
AppCfg.DFT_POS_DET,AppCfg.DFT_POS_GONIO,AppCfg.DFT_POS_PST,AppCfg.DFT_POS_COL,AppCfg.DFT_POS_BKLGT,
|
||||
AppCfg.DT_MISC,
|
||||
AppCfg.DAQ_DET,AppCfg.DAQ_LOC,AppCfg.DAQ_RUN,AppCfg.DAQ_BS_CH,AppCfg.DAQ_PV_CH
|
||||
):
|
||||
@@ -190,7 +191,7 @@ class AppCfg(QSettings):
|
||||
elif key in (AppCfg.GBL_MISC,
|
||||
AppCfg.GEO_CAM_PARAM,
|
||||
AppCfg.GEO_FND_FID, AppCfg.GEO_AUTOFOC,
|
||||
AppCfg.DFT_POS_DET,AppCfg.DFT_POS_PST,AppCfg.DFT_POS_COL,AppCfg.DFT_POS_BKLGT,
|
||||
AppCfg.DFT_POS_DET,AppCfg.DFT_POS_GONIO,AppCfg.DFT_POS_PST,AppCfg.DFT_POS_COL,AppCfg.DFT_POS_BKLGT,
|
||||
AppCfg.DT_MISC,
|
||||
AppCfg.DAQ_DET,AppCfg.DAQ_LOC,AppCfg.DAQ_RUN,AppCfg.DAQ_BS_CH,AppCfg.DAQ_PV_CH
|
||||
):
|
||||
@@ -243,6 +244,7 @@ class WndParameter(QMainWindow):
|
||||
dft_pos_col = cfg.value(AppCfg.DFT_POS_COL)
|
||||
dft_pos_bklgt = cfg.value(AppCfg.DFT_POS_BKLGT)
|
||||
dft_pos_det = cfg.value(AppCfg.DFT_POS_DET)
|
||||
dft_pos_gonio = cfg.value(AppCfg.DFT_POS_GONIO)
|
||||
geo_cam_param = cfg.value(AppCfg.GEO_CAM_PARAM)
|
||||
dt_host = cfg.value(AppCfg.DT_HOST)
|
||||
dt_misc = cfg.value(AppCfg.DT_MISC)
|
||||
@@ -356,6 +358,12 @@ verbose bits:
|
||||
{'name':'set_in', 'title':'use current position as "in"', 'type':'action'},
|
||||
{'name':'set_out', 'title':'use current position as "out"', 'type':'action'},
|
||||
]},
|
||||
{'name':AppCfg.DFT_POS_GONIO, 'title':'gonio reference positions', 'type':'group', 'expanded':False, 'children':[
|
||||
{'name':'pos_mount', 'title':'Mount position', 'value':dft_pos_gonio.get('mount'), 'type':'str' },
|
||||
{'name':'pos_align', 'title':'Align position', 'value':dft_pos_gonio.get('align'), 'type':'str' },
|
||||
{'name':'set_mount', 'title':'use current position as "mount"', 'type':'action'},
|
||||
{'name':'set_align', 'title':'use current position as "align"', 'type':'action'},
|
||||
]},
|
||||
{'name':'Delta Tau Parameters', 'type':'group','expanded':False, 'children':[
|
||||
{'name':AppCfg.DT_HOST, 'title':'host name (host[:port:port_gather])','value':dt_host, 'type':'str'},
|
||||
{'name':AppCfg.DT_MISC, 'title':'miscellaneous', 'type':'group', 'children':[
|
||||
@@ -407,12 +415,14 @@ verbose bits:
|
||||
child.sigValueChanging.connect(lambda a,b: self.cb_valueChanging(a,b))
|
||||
for ch2 in child.children():
|
||||
ch2.sigValueChanging.connect(lambda a,b: self.cb_valueChanging(a,b))
|
||||
p.param(AppCfg.DFT_POS_PST, 'set_in' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_PST, 'in'))
|
||||
p.param(AppCfg.DFT_POS_PST, 'set_out').sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_PST, 'out'))
|
||||
p.param(AppCfg.DFT_POS_COL, 'set_in' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_COL, 'in'))
|
||||
p.param(AppCfg.DFT_POS_COL, 'set_out').sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_COL, 'out'))
|
||||
p.param(AppCfg.DFT_POS_DET, 'set_in' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_DET, 'in'))
|
||||
p.param(AppCfg.DFT_POS_DET, 'set_out').sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_DET, 'out'))
|
||||
p.param(AppCfg.DFT_POS_PST, 'set_in' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_PST, 'in'))
|
||||
p.param(AppCfg.DFT_POS_PST, 'set_out' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_PST, 'out'))
|
||||
p.param(AppCfg.DFT_POS_COL, 'set_in' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_COL, 'in'))
|
||||
p.param(AppCfg.DFT_POS_COL, 'set_out' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_COL, 'out'))
|
||||
p.param(AppCfg.DFT_POS_DET, 'set_in' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_DET, 'in'))
|
||||
p.param(AppCfg.DFT_POS_DET, 'set_out' ).sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_DET, 'out'))
|
||||
p.param(AppCfg.DFT_POS_GONIO,'set_mount').sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_GONIO,'mount'))
|
||||
p.param(AppCfg.DFT_POS_GONIO,'set_align').sigActivated.connect(lambda x: self.cb_use_cur_pos_as(AppCfg.DFT_POS_GONIO,'align'))
|
||||
#p.param('Save/Restore functionality', 'Save State').sigActivated.connect(self.cb_save)
|
||||
#p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(self.cb_restore)
|
||||
|
||||
@@ -496,6 +506,10 @@ verbose bits:
|
||||
d=dict(map(lambda x:(x.name(),x.value()), parent.children()))
|
||||
for k in ('set_in','set_out'): del d[k]
|
||||
cfg.setValue(par_nm,d)
|
||||
elif par_nm == AppCfg.DFT_POS_GONIO:
|
||||
k=parent.children()[:-2]
|
||||
d=dict(map(lambda x:(x.name(),tuple(map(float,x.value().strip('[]()').split(', ')))), k))
|
||||
cfg.setValue(par_nm,d)
|
||||
elif par_nm==AppCfg.GBL_DEV_PREFIX:
|
||||
v=tuple(map(lambda x:x.value(), parent.children()))
|
||||
cfg.setValue(par_nm, v)
|
||||
@@ -550,7 +564,15 @@ verbose bits:
|
||||
# 'xeye_x', 'xeye_y'])
|
||||
#p.children()
|
||||
cld=p.children()
|
||||
if dev==AppCfg.DFT_POS_PST:
|
||||
if dev==AppCfg.DFT_POS_GONIO:
|
||||
if pos=='mount':
|
||||
idx=0
|
||||
elif pos=='align':
|
||||
idx=1
|
||||
val=tuple(map(lambda k: twk[k].get_val(),('fast_x','fast_y','base_x','base_z')))
|
||||
cld[idx].setValue(json.dumps(val, cls=MyJsonEncoder))
|
||||
return
|
||||
elif dev==AppCfg.DFT_POS_PST:
|
||||
# k=('x_in_us','y_in_us','x_in_ds','y_in_ds','x_out_delta','y_out_delta','z_in','z_out',)
|
||||
if pos=='in':
|
||||
lut=((0,'tube_usx'),(1,'tube_usy'),(2,'tube_dsx'),(3,'tube_dsy'),(6,'tube_z'))
|
||||
|
||||
Reference in New Issue
Block a user