Commit 67e5d5c2 authored by Jose Tiago Macara Coutinho's avatar Jose Tiago Macara Coutinho Committed by blissadm_ID31@bibhelm
Browse files

SPEC config: add lima ROI

parent 7521ad29
......@@ -300,6 +300,27 @@ def bliss_list_string_init(lstr) '{
return lstr ? lstr : " "
}'
def bliss_list_string_n(lstr) '{
local i j lstr_arr[] lstr_n
lstr_n = split(lstr, lstr_arr)
for (i = j = 0; i < lstr_n; i++) {
if (lstr_arr[i] != "")
j++
}
return j
}'
def bliss_list_string_item(lstr, n) '{
local i j lstr_arr[] lstr_n
lstr_n = split(lstr, lstr_arr)
for (i = j = 0; i < lstr_n; i++) {
if (lstr_arr[i] != "")
if (++j == n)
return lstr_arr[i]
}
return ""
}'
def bliss_list_string_includes(lstr, e) '{
lstr = bliss_list_string_init(lstr)
return (index(lstr, sprintf(" %s ", e)) > 0)
......
......@@ -17,6 +17,8 @@ def limasettingssetup '{
exit
}
limaroisetup
first_time = !bliss_settings_class_is_registered("lima.common")
if (first_time) {
# TODO: Add global lima settings: CCD_U, NO_CCDS
......@@ -44,7 +46,8 @@ def lima_get_settings_class(lima_name) '{
def lima_dump_object_settings(lima_class, lima_name) '{
local ccd_u obj_settings[] has_roi cbeg rbeg cend rend width height set_str
local rlist rmne i set_key
ccd_u = lima_ccd_unit(lima_name)
obj_settings["active_on_ct"] = CCD_ON[ccd_u]
......@@ -158,6 +161,22 @@ def lima_dump_object_settings(lima_class, lima_name) '{
}
obj_settings["online_gui"] = set_str
rlist = bliss_list_string_init()
for (i = 1; i <= list_n(LIMA_ROI); i++) {
rmne = list_item(LIMA_ROI, i)
if (LIMA_ROI[rmne]["ccdname"] == lima_name) {
rlist = bliss_list_string_add(rlist, rmne)
set_key = sprintf("roi_%s", rmne)
set_str = sprintf("%s,%s,%s,%s,%s", LIMA_ROI[rmne]["xmin"], \
LIMA_ROI[rmne]["xmax"], \
LIMA_ROI[rmne]["ymin"], \
LIMA_ROI[rmne]["ymax"], \
LIMA_ROI[rmne]["type"])
obj_settings[set_key] = set_str
}
}
obj_settings["roi_list"] = rlist
return obj_settings
}'
......@@ -235,10 +254,13 @@ def lima_load_default_settings(lima_name) '{
CCD_GUI[ccd_u]["on"] = 0
CCD_GUI[ccd_u]["guiconf"] = 1
_limaroi_load(lima_name, "")
}'
def lima_load_ext_settings(lima_name, obj_settings) '{
local ccd_u has_roi cbeg rbeg cend rend width height set_str sarr[]
local rlist rmne i set_key
ccd_u = lima_ccd_unit(lima_name)
......@@ -349,6 +371,26 @@ def lima_load_ext_settings(lima_name, obj_settings) '{
CCD_GUI[ccd_u]["on"] = 1
CCD_GUI[ccd_u]["guiconf"] = 1
}
rlist = obj_settings["roi_list"]
for (i = 1; i <= bliss_list_string_n(rlist); i++) {
rmne = bliss_list_string_item(rlist, i)
if (list_item(LIMA_ROI, rmne) == -1)
list_add(LIMA_ROI, rmne)
LIMA_ROI[rmne]["ccdname"] = lima_name
set_key = sprintf("roi_%s", rmne)
split(obj_settings[set_key], sarr, ",")
cbeg = int(sarr[0])
cend = int(sarr[1])
rbeg = int(sarr[2])
rend = int(sarr[3])
LIMA_ROI[rmne]["type"] = sarr[4]
LIMA_ROI[rmne]["xmin"] = cbeg
LIMA_ROI[rmne]["xmax"] = cend
LIMA_ROI[rmne]["ymin"] = rbeg
LIMA_ROI[rmne]["ymax"] = rend
}
}'
def lima_resetup(lima_name) '{
......@@ -365,11 +407,14 @@ def lima_resetup(lima_name) '{
_limapar_set(lima_name, "saving_suffix", CCD_SUFFIX[ccd_u])
_limapar_set(lima_name, "saving_next_number", CCD_N[ccd_u])
_limaroi_server_send(lima_name)
ccd_u = CCD_U
gui_on = CCD_GUI[CCD_U]["on"]
gui_conf = CCD_GUI[CCD_U]["guiconf"]
ccdgui gui_on gui_conf
CCD_U = ccd_u
}'
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