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:
local_event = self._last_event
self._last_event = dict()
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
last_data = last_data[-1]
except IndexError:
data["channel_index"] = 0
self._new_scan_data(data_type, master_name, data, last_data)
self._new_scan_data(data_type, master_name, data)
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":
for plot in self.live_scan_plots_dict[master_name]["0d"]:
for channel_name, channel_data in last_data.items():
self.update_data(plot.plot_id, channel_name, channel_data)
elif data_type == "1d":
spectrum_data = last_data
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"]]
self.update_data(plot.plot_id, channel_name, spectrum_data)
if spectrum_data.ndim == 1:
......@@ -472,9 +462,13 @@ class Flint:
y = spectrum_data[1]
plot.addCurve(x, y, legend=channel_name)
elif data_type == "2d":
plot = self.live_scan_plots_dict[master_name]["2d"][data["channel_index"]]
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)
plot_image = plot.getImage(channel_name) # returns last plotted image
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