Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added check for baseline stream in for live line plotting #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
76 changes: 39 additions & 37 deletions bluesky_widgets/models/auto_plot_builders/_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,43 +178,45 @@ def handle_new_stream(self, run, stream_name, **kwargs):

if ndims == 1:
(x_key,) = dim_fields
key = (stream_name, x_key, (tuple(columns),))
try:
lines_instances = self._lines_instances[key]
except KeyError:
lines_instances = []
axes_list = []
for y_key in columns:
dtype = descriptor["data_keys"][y_key]["dtype"]
if dtype not in ("number", "integer"):
warn("Omitting {} from plot because dtype is {}" "".format(y_key, dtype))
continue
axes = Axes(x_label=x_key, title=y_key)
axes_list.append(axes)
lines_kwargs = {}
if self.max_runs is not None:
lines_kwargs["max_runs"] = self.max_runs
lines = Lines(
x=x_key,
ys=(y_key,),
needs_streams=(stream_name,),
axes=axes,
**lines_kwargs,
)
lines_instances.append(lines)
if not axes_list:
return
title = ", ".join((str(lines.ys[0]) for lines in lines_instances)) + f" vs. {x_key}"
if len(title) > 15:
short_title = title[:15] + "..."
else:
short_title = title
figure = Figure(axes_list, title=title, short_title=short_title)
self._lines_instances[key] = lines_instances
self.plot_builders.extend(lines_instances)
self.figures.append(figure)
for lines in lines_instances:
lines.add_run(run, **kwargs)
if stream_name != 'baseline':

key = (stream_name, x_key, (tuple(columns),))
try:
lines_instances = self._lines_instances[key]
except KeyError:
lines_instances = []
axes_list = []
for y_key in columns:
dtype = descriptor["data_keys"][y_key]["dtype"]
if dtype not in ("number", "integer"):
warn("Omitting {} from plot because dtype is {}" "".format(y_key, dtype))
continue
axes = Axes(x_label=x_key, title=y_key)
axes_list.append(axes)
lines_kwargs = {}
if self.max_runs is not None:
lines_kwargs["max_runs"] = self.max_runs
lines = Lines(
x=x_key,
ys=(y_key,),
needs_streams=(stream_name,),
axes=axes,
**lines_kwargs,
)
lines_instances.append(lines)
if not axes_list:
return
title = ", ".join((str(lines.ys[0]) for lines in lines_instances)) + f" vs. {x_key}"
if len(title) > 15:
short_title = title[:15] + "..."
else:
short_title = title
figure = Figure(axes_list, title=title, short_title=short_title)
self._lines_instances[key] = lines_instances
self.plot_builders.extend(lines_instances)
self.figures.append(figure)
for lines in lines_instances:
lines.add_run(run, **kwargs)

elif ndims == 2:
return []
Expand Down