Commit 8c6025e3 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

Merge branch '2819-add-scan-property-to-sequence-object' into 'master'

Resolve "add scan property to sequence object"

Closes #2819

See merge request !3794
parents 44df3c82 0df89ab5
Pipeline #49177 passed with stages
in 129 minutes and 30 seconds
......@@ -140,7 +140,7 @@ class Sequence:
def __init__(self, scan_info=None, title="sequence_of_scans"):
self.title = title
self.scan = None
self._scan = None
self._scan_info = ScanInfo.normalize(scan_info)
self._scan_info["is-scan-sequence"] = True
self.custom_channels = dict()
......@@ -161,7 +161,6 @@ class Sequence:
def sequence_context(self):
group_scan = gevent.spawn(
......@@ -228,8 +227,14 @@ class Sequence:
self.group_custom_slave = None
self.scan = ScanGroup(chain, self.title, save=True, scan_info=self._scan_info)
self._scan = ScanGroup(chain, self.title, save=True, scan_info=self._scan_info)
def scan(self):
if self._scan is None:
return self._scan
def node(self):
......@@ -242,14 +247,14 @@ class Sequence:
Which is the initial one, or the one published by the scan which publish
this sequence.
if self.scan is None:
if self._scan is None:
return self._scan_info
def state(self):
if self.scan is None:
if self._scan is None:
return ScanState.IDLE
return self.scan.state
......@@ -19,6 +19,7 @@ from bliss.scanning.chain import AcquisitionChannel
from import get_session_node
from bliss import current_session
from bliss.scanning.scan import ScanState
from bliss.scanning.acquisition.calc import CalcChannelAcquisitionSlave
def test_sequence_terminated_scans(session):
......@@ -443,3 +444,27 @@ def test_sequence_issue_2752(session, scan_meta):
with seq.sequence_context() as ctx:
assert "Failed to prepare scan sequence" in str(excinfo)
def test_sequence_create_scan_before_running(session):
diode = session.config.get("diode")
seq = Sequence()
scan = seq.scan
calc = CalcChannelAcquisitionSlave("", [], None, [])
scan.acq_chain.add(seq.group_acq_master, calc)
nodes_before_running = scan.acq_chain.nodes_list
with seq.sequence_context() as seq_context:
s1 = scans.loopscan(20, .1, diode, run=False)
g1 = gevent.spawn(
gevent.joinall([g1], raise_error=True)
nodes_after_running = seq.scan.acq_chain.nodes_list
# check that scan sequence does not have been recreated with sequence context
assert nodes_before_running == nodes_after_running
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