Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Advance output of last points in continuous scan #1668

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/sardana/macroserver/scan/gscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2669,19 +2669,23 @@ def on_waypoints_end(self, restore_positions=None):
instead of _motion or in both cases: CSScan and CTScan
coordinate the physical motors' velocit.
"""
self.macro.debug("on_waypoints_end() entering...")
self.debug("on_waypoints_end() entering...")
self.set_all_waypoints_finished(True)
if restore_positions is not None:
self._restore_motors() # first restore motors backup
self._setFastMotions() # then try to go even faster (limits)
self.macro.info("Correcting overshoot...")
self._physical_motion.move(restore_positions)
self.motion_end_event.set()
self.cleanup()
self.macro.debug("Waiting for data events to be processed")
self.debug("Waiting for data events to be processed")
self.wait_value_buffer()
self.join_thread_pool()
self.macro.debug("All data events are processed")
self.debug("All data events are processed")
self.data.endRecords()
if restore_positions is not None:
self.macro.info("Overshoot was corrected")
else:
self.macro.info("Overshoot was not corrected")

# Note: The commented out code below works, but due to an issue with
# output of the last measurement point, it should not be enabled yet.
Expand Down Expand Up @@ -2945,8 +2949,9 @@ def scan_loop(self):
self.debug("Waiting for value buffer events to be processed")
self.wait_value_buffer()
self.join_thread_pool()
self.macro.checkPoint()
self.debug("All data events are processed")
self._fill_missing_records()
self.data.endRecords()
yield 100

if hasattr(macro, 'getHooks'):
Expand Down
11 changes: 9 additions & 2 deletions src/sardana/macroserver/scan/scandata.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,13 @@ def isRecordCompleted(self, recordno):

def addRecords(self, records):
list(map(self.addRecord, records))

def end(self):

def endRecords(self):
"""Complete and add *initilized* records

Complete (eventually apply interpolation) initilized
records and add them to the *data handler*.
"""
start = self.currentIndex
for i in range(start, len(self.records)):
rc = self.records[i]
Expand All @@ -502,6 +507,8 @@ def end(self):
self.applyZeroOrderInterpolation(rc)
self.datahandler.addRecord(self, rc)
self.currentIndex += 1

def end(self):
self.datahandler.endRecordList(self)

def getDataHandler(self):
Expand Down