Commit 14f7dfcb authored by Cyril Guilloud's avatar Cyril Guilloud

Merge branch '764-handle-and-hide-epoch-in-scan-display' into 'master'

Resolve "Handle and hide "Epoch" in scan display"

Closes #764

See merge request bliss/bliss!1304
parents dabdd4dc 1328a2ac
......@@ -40,7 +40,7 @@ set-option -g word-separators "; @()\'\`\"" #"
# useful to keep S-PageUp Binding to scroll up half a page
#set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
#set -ga terminal-overrides ',xterm*:smcup@:rmcup@'
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
#=== Bind F5 to switch window and clear copy selection =============
bind -n F5 if -F -t= '#{pane_in_mode}' 'send -X cancel' \; next-window
......
......@@ -117,6 +117,9 @@ class ScanPrinter:
channel_short_name = channels["master"]["display_names"][channel_fullname]
channel_unit = channels["master"]["scalars_units"][channel_fullname]
if channel_fullname == "timer:epoch":
continue
# name is in the form 'acq_master:channel_name' <---not necessarily true anymore (e.g. roi counter have . in name / respective channel has additional : in name)
if channel_short_name == "elapsed_time":
# timescan
......@@ -150,6 +153,10 @@ class ScanPrinter:
if channel_short_name == "elapsed_time":
self.col_labels.insert(1, "dt[s]")
continue
if channel_fullname == "timer:epoch":
continue
self.counter_names.append(
channel_short_name + (f"[{channel_unit}]" if channel_unit else "")
)
......@@ -310,13 +317,15 @@ class ScanDataListener:
self.counter_selection = self.scan_display.counters
def get_selected_counters(self, counter_names):
if not self.counter_selection:
return counter_names
selection = []
for cname in counter_names:
if cname in self.counter_selection or cname == "timer:elapsed_time":
selection.append(cname)
if not self.counter_selection:
for cname in counter_names:
if cname != "timer:epoch":
selection.append(cname)
else:
for cname in counter_names:
if cname in self.counter_selection or cname == "timer:elapsed_time":
selection.append(cname)
return selection
......@@ -382,7 +391,13 @@ class ScanDataListener:
selected_counters = self.get_selected_counters(channels["scalars"])
self.channel_names = channels["master"]["scalars"] + selected_counters
# remove epoch from channel_names
ch_master_scalar_wo_epoch = []
for cname in channels["master"]["scalars"]:
if cname != "timer:epoch":
ch_master_scalar_wo_epoch.append(cname)
self.channel_names = ch_master_scalar_wo_epoch + selected_counters
# get the number of masters and counters unfiltered
self.channels_number = len(channels["master"]["scalars"]) + len(
......@@ -392,7 +407,7 @@ class ScanDataListener:
# BUILD THE LABEL COLUMN
channel_labels = []
# GET THE LIST OF MASTER CHANNELS SHORT NAMES
for channel_name in channels["master"]["scalars"]:
for channel_name in ch_master_scalar_wo_epoch:
channel_short_name = channels["master"]["display_names"][channel_name]
channel_unit = channels["master"]["scalars_units"][channel_name]
......@@ -491,26 +506,22 @@ class ScanDataListener:
return
# Skip if partial data
# for channel_name in channel_info["data"]: # ??? for channel_name in self.channel_names: ???
for channel_name in self.channel_names:
if len(channel_info["data"][channel_name]) < self.scan_steps_index:
return
# Check if we receive more than one scan points (i.e. lines) per 'scan_data' event
data_lens = [
len(channel_info["data"][channel_name])
for channel_name in channel_info["data"]
]
bsize = min(data_lens)
# if bsize != self.scan_steps_index:
# print("receive", bsize, "lines at step", self.scan_steps_index-1, "printing", bsize - self.scan_steps_index+1, "lines" )
bsize = min(
[
len(channel_info["data"][channel_name])
for channel_name in channel_info["data"]
]
)
for i in range(bsize - self.scan_steps_index + 1):
# Get data for the current scan step
values_dict = {}
# for channel_name in channel_info["data"]: # ??? for channel_name in self.channel_names: ???
# if channel_name in self.channel_names:
for channel_name in self.channel_names:
values_dict[channel_name] = channel_info["data"][channel_name][
self.scan_steps_index - 1
......
......@@ -244,7 +244,7 @@ def test_standard_scan_display(session):
assert (
lines[6].strip()
== "# dt[s] robz[mm] roby epoch[s] diode4 diode5"
== "# dt[s] robz[mm] roby diode4 diode5"
)
arry = []
......@@ -253,7 +253,6 @@ def test_standard_scan_display(session):
tab = line.split(" ")
if len(tab) > 1:
tab.pop(1)
tab.pop(3)
arry.append(tab)
assert arry[0] == ["0", "0", "10", "4", "5"]
......@@ -304,7 +303,7 @@ def test_standard_scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby robz[mm] epoch[s] diode4 diode5"
== "# dt[s] roby robz[mm] diode4 diode5"
)
arry = []
......@@ -313,7 +312,6 @@ def test_standard_scan_display(session):
tab = line.split(" ")
if len(tab) > 1:
tab.pop(1)
tab.pop(3)
arry.append(tab)
assert arry[0] == ["0", "0", "10", "4", "5"]
......@@ -422,7 +420,7 @@ def test_standard_scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby epoch[s] diode4 diode5"
== "# dt[s] roby diode4 diode5"
)
arry = []
......@@ -431,7 +429,6 @@ def test_standard_scan_display(session):
tab = line.split(" ")
if len(tab) > 1:
tab.pop(1)
tab.pop(2)
arry.append(tab)
assert arry[0] == ["0", "0", "4", "5"]
......@@ -476,8 +473,8 @@ def test_standard_scan_display(session):
arry.append(tab)
assert arry[0] == ["dt[s]", "0.0"]
assert arry[2] == ["diode4", "4.0"]
assert arry[3] == ["diode5", "5.0"]
assert arry[1] == ["diode4", "4.0"]
assert arry[2] == ["diode5", "5.0"]
# print(' finished')
......@@ -511,17 +508,13 @@ def test_standard_scan_display(session):
# GRAB THE SCAN DISPLAY LINES
grab_lines(p, lines)
assert (
lines[6].strip()
== "# dt[s] epoch[s] diode4 diode5"
)
assert lines[6].strip() == "# dt[s] diode4 diode5"
arry = []
for line in lines[7:]:
line = " ".join(line.strip().split())
tab = line.split(" ")
if len(tab) > 1:
tab.pop(1)
tab.pop(1)
arry.append(tab)
......@@ -572,7 +565,7 @@ def test_standard_scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby robz[mm] epoch[s] diode4 diode5"
== "# dt[s] roby robz[mm] diode4 diode5"
)
arry = []
......@@ -581,7 +574,6 @@ def test_standard_scan_display(session):
tab = line.split(" ")
if len(tab) > 1:
tab.pop(1)
tab.pop(3)
arry.append(tab)
assert arry[0] == ["0", "0", "10", "4", "5"]
......@@ -625,7 +617,7 @@ def test_standard_scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby epoch[s] diode4 diode5"
== "# dt[s] roby diode4 diode5"
)
arry = []
......@@ -634,7 +626,6 @@ def test_standard_scan_display(session):
tab = line.split(" ")
if len(tab) > 2:
tab.pop(1)
tab.pop(2)
arry.append(tab)
assert arry[0] == ["0", "0.5", "4", "5"]
......@@ -670,7 +661,7 @@ def test_standard_scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby epoch[s] diode4 diode5"
== "# dt[s] roby diode4 diode5"
)
arry = []
......@@ -679,7 +670,6 @@ def test_standard_scan_display(session):
tab = line.split(" ")
if len(tab) > 2:
tab.pop(1)
tab.pop(2)
arry.append(tab)
assert arry[0] == ["0", "0.5", "4", "5"]
......
Markdown is supported
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