Commit cdedab50 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

flint: follow new way of watching_session

parent dbf1c61a
...@@ -434,32 +434,22 @@ class Flint: ...@@ -434,32 +434,22 @@ class Flint:
local_event = self._last_event local_event = self._last_event
self._last_event = dict() self._last_event = dict()
for (master_name, _), (data_type, data) in local_event.items(): for (master_name, _), (data_type, data) in local_event.items():
last_data = data["data"]
if data_type in ("1d", "2d"):
if data_type == "2d":
last_data.from_stream = True
try:
last_data = last_data[-1]
except IndexError:
continue
else:
data["channel_index"] = 0
try: try:
self._new_scan_data(data_type, master_name, data, last_data) self._new_scan_data(data_type, master_name, data)
except: except:
sys.excepthook(*sys.exc_info()) sys.excepthook(*sys.exc_info())
finally: finally:
self._refresh_task = None self._refresh_task = None
def _new_scan_data(self, data_type, master_name, data, last_data): def _new_scan_data(self, data_type, master_name, data):
if data_type == "0d": if data_type == "0d":
for plot in self.live_scan_plots_dict[master_name]["0d"]: for plot in self.live_scan_plots_dict[master_name]["0d"]:
for channel_name, channel_data in last_data.items(): for channel_name, channel_data in last_data.items():
self.update_data(plot.plot_id, channel_name, channel_data) self.update_data(plot.plot_id, channel_name, channel_data)
plot.update_all() plot.update_all()
elif data_type == "1d": elif data_type == "1d":
spectrum_data = last_data
channel_name = data["channel_name"] channel_name = data["channel_name"]
spectrum_data = data["channel_data_node"].get(-1)
plot = self.live_scan_plots_dict[master_name]["1d"][data["channel_index"]] plot = self.live_scan_plots_dict[master_name]["1d"][data["channel_index"]]
self.update_data(plot.plot_id, channel_name, spectrum_data) self.update_data(plot.plot_id, channel_name, spectrum_data)
if spectrum_data.ndim == 1: if spectrum_data.ndim == 1:
...@@ -472,9 +462,13 @@ class Flint: ...@@ -472,9 +462,13 @@ class Flint:
y = spectrum_data[1] y = spectrum_data[1]
plot.addCurve(x, y, legend=channel_name) plot.addCurve(x, y, legend=channel_name)
elif data_type == "2d": elif data_type == "2d":
plot = self.live_scan_plots_dict[master_name]["2d"][data["channel_index"]] plot = self.live_scan_plots_dict[master_name]["2d"][data["channel_index"]]
channel_name = data["channel_name"] channel_name = data["channel_name"]
image_data = last_data channel_data_node = data["channel_data_node"]
channel_data_node.from_stream = True
image_view = channel_data_node.get(-1)
image_data = image_view.get(-1)
self.update_data(plot.plot_id, channel_name, image_data) self.update_data(plot.plot_id, channel_name, image_data)
plot_image = plot.getImage(channel_name) # returns last plotted image plot_image = plot.getImage(channel_name) # returns last plotted image
if plot_image is None: if plot_image is None:
......
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