Commit 1e928e6f authored by Matias Guijarro's avatar Matias Guijarro
Browse files

Merge branch 'epoch_timer' into 'master'

add epoch as second channel to SoftwareTimerMaster

Closes #696

See merge request bliss/bliss!1282
parents fbca1c21 ff1b26fa
......@@ -18,9 +18,13 @@ class SoftwareTimerMaster(AcquisitionMaster):
AcquisitionMaster.__init__(self, None, name, **keys)
self.count_time = count_time
self.sleep_time = sleep_time
self.channels.append(
AcquisitionChannel(self, "elapsed_time", numpy.double, (), unit="s")
)
self.channels.append(
AcquisitionChannel(self, "epoch", numpy.float, (), unit="s")
)
self._nb_point = 0
self._started_time = None
......@@ -55,6 +59,7 @@ class SoftwareTimerMaster(AcquisitionMaster):
self._started_time = start_trigger
self.channels[0].emit(start_trigger - self._started_time)
self.channels[1].emit(start_trigger)
self.wait_slaves()
......
......@@ -37,8 +37,12 @@ def test_alias_data_channel(alias_session):
"\n"
)
d = list()
for n in s.node.iterator.walk(filter="channel", wait=False):
assert " ".join([n.db_name, n.alias]) in dump1
d.append(" ".join([n.db_name, n.alias]))
for l in dump1:
assert l in d
dump2 = """{a2scan}:axis:roby True
{a2scan}:axis:robz True
......@@ -53,5 +57,9 @@ def test_alias_data_channel(alias_session):
"\n"
)
d = list()
for n in s.node.iterator.walk(filter="channel", wait=False):
assert " ".join([n.db_name, str(n.has_alias)]) in dump2
d.append(" ".join([n.db_name, str(n.has_alias)]))
for l in dump2:
assert l in d
......@@ -155,6 +155,7 @@ def test_soft_counter_scan(beacon):
"voltage",
"get_pressure",
"temp_f",
"epoch",
}
assert set(data.keys()) == counter_names
......
......@@ -93,7 +93,7 @@ def test_soft_axis_scan(beacon):
data = scan.get_data()
# TODO: names should be full counter names after issue #395 is solved
channel_names = {"elapsed_time", "motor_counter", "another_motor"}
channel_names = {"elapsed_time", "motor_counter", "another_motor", "epoch"}
assert set(data.keys()) == channel_names
positions = numpy.linspace(-200, 200, 100)
......
......@@ -101,7 +101,7 @@ def test_a2scan_display(session):
assert (
lines[6].strip()
== "# dt[s] robz[mm] roby diode4 diode5"
== "# dt[s] robz[mm] roby epoch[s] diode4 diode5"
)
arry = []
......@@ -110,6 +110,7 @@ def test_a2scan_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"]
......@@ -160,7 +161,7 @@ def test_a2scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby robz[mm] diode4 diode5"
== "# dt[s] roby robz[mm] epoch[s] diode4 diode5"
)
arry = []
......@@ -169,6 +170,7 @@ def test_a2scan_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"]
......@@ -277,7 +279,7 @@ def test_a2scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby diode4 diode5"
== "# dt[s] roby epoch[s] diode4 diode5"
)
arry = []
......@@ -286,6 +288,7 @@ def test_a2scan_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"]
......@@ -330,8 +333,8 @@ def test_a2scan_display(session):
arry.append(tab)
assert arry[0] == ["dt[s]", "0.0"]
assert arry[1] == ["diode4", "4.0"]
assert arry[2] == ["diode5", "5.0"]
assert arry[2] == ["diode4", "4.0"]
assert arry[3] == ["diode5", "5.0"]
# print(' finished')
......@@ -365,13 +368,17 @@ def test_a2scan_display(session):
# GRAB THE SCAN DISPLAY LINES
grab_lines(p, lines)
assert lines[6].strip() == "# dt[s] diode4 diode5"
assert (
lines[6].strip()
== "# dt[s] epoch[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)
......@@ -422,7 +429,7 @@ def test_a2scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby robz[mm] diode4 diode5"
== "# dt[s] roby robz[mm] epoch[s] diode4 diode5"
)
arry = []
......@@ -431,6 +438,7 @@ def test_a2scan_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"]
......@@ -474,15 +482,16 @@ def test_a2scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby diode4 diode5"
== "# dt[s] roby epoch[s] diode4 diode5"
)
arry = []
for line in lines[7:]:
line = " ".join(line.strip().split())
tab = line.split(" ")
if len(tab) > 1:
if len(tab) > 2:
tab.pop(1)
tab.pop(2)
arry.append(tab)
assert arry[0] == ["0", "0.5", "4", "5"]
......@@ -518,15 +527,16 @@ def test_a2scan_display(session):
assert (
lines[6].strip()
== "# dt[s] roby diode4 diode5"
== "# dt[s] roby epoch[s] diode4 diode5"
)
arry = []
for line in lines[7:]:
line = " ".join(line.strip().split())
tab = line.split(" ")
if len(tab) > 1:
if len(tab) > 2:
tab.pop(1)
tab.pop(2)
arry.append(tab)
assert arry[0] == ["0", "0.5", "4", "5"]
......
......@@ -41,5 +41,6 @@ def test_long_trigger_timescan(beacon, diode_acq_device_factory):
s = Scan(chain, save=False)
s.run()
assert len(s.get_data()) == 2 # check that the dictionary has 2 entries
assert len(s.get_data()) == 3
assert "elapsed_time" in s.get_data()
assert len(s.get_data()["elapsed_time"]) == 3 # check data is present
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