Skip to content

Commit

Permalink
Merge pull request #159 from AbbyGi/more-useful-time-plots
Browse files Browse the repository at this point in the history
Plot time relative to the start of the run
  • Loading branch information
AbbyGi authored Nov 2, 2021
2 parents efeb5b2 + 096cf6b commit 193db00
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bluesky_widgets/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,18 @@ def construct_namespace(run, stream_names):
"""
namespace = dict(_base_namespace) # shallow copy
with lock_if_live(run):
run_start_time = run.metadata["start"]["time"]
# Add columns from streams in stream_names. Earlier entries will get
# precedence.
for stream_name in reversed(stream_names):
ds = run[stream_name].to_dask()
namespace.update({column: ds[column] for column in ds})
namespace.update({column: ds[column] for column in ds.coords})
if "time" in namespace:
namespace["time"] = namespace["time"] - run_start_time
namespace.update({stream_name: run[stream_name].to_dask() for stream_name in stream_names})
for stream_name in stream_names:
namespace[stream_name]["time"] = namespace[stream_name]["time"] - run_start_time
namespace.update({"run": run})
return namespace

Expand Down

0 comments on commit 193db00

Please sign in to comment.