Skip to content

Commit

Permalink
fixes #407
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Nov 23, 2020
1 parent 15b184c commit 1e6672d
Showing 1 changed file with 1 addition and 74 deletions.
75 changes: 1 addition & 74 deletions apstools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
~listruns
~object_explorer
~pairwise
~plot_prune_fifo
~print_snapshot_list
~print_RE_md
~quantify_md_key_use
Expand Down Expand Up @@ -1301,78 +1300,6 @@ def ipython_shell_namespace():
return ns


def plot_prune_fifo(bec, n, y, x):
"""
find the plot with axes x and y and replot with only the last *n* lines
Note: this is not a bluesky plan. Call it as normal Python function.
EXAMPLE::
plot_prune_fifo(bec, 1, noisy, m1)
PARAMETERS
bec
*object* :
instance of BestEffortCallback
n
*int* :
number of plots to keep
y
*object* :
instance of ophyd.Signal (or subclass),
dependent (y) axis
x
*object* :
instance of ophyd.Signal (or subclass),
independent (x) axis
DEPRECATED: Will be removed by end of 2020-12.
Use :func:`trim_plot_lines` instead.
Note the order of parameters is different in :func:`trim_plot_lines`.
"""
warnings.warn(
"DEPRECATED: plot_prune_fifo() will be removed"
" in a future release. Use trim_plot_lines() instead."
" Note the order of parameters is different in trim_plot_lines()."
)

if n < 0:
raise ValueError(
"must be zero or greater",
f" received {n}")

for liveplot in bec._live_plots.values():
lp = liveplot.get(y.name)
if lp is None:
logger.debug(f"no LivePlot with name {y.name}")
continue
if lp.x != x.name or lp.y != y.name:
logger.debug(f"no LivePlot with axes ('{x.name}', '{y.name}')")
continue

# pick out only the traces that contain plot data
# skipping the lines that show peak centers
lines = [
tr
for tr in lp.ax.lines
if len(tr._x) != 2
or len(tr._y) != 2
or (len(tr._x) == 2 and tr._x[0] != tr._x[1])
]
if len(lines) > n:
logger.debug(f"limiting LivePlot({y.name}) to {n} traces")
lp.ax.lines = lines[-n:]
lp.ax.legend()
if n > 0:
lp.update_plot()
return lp


def select_mpl_figure(x, y):
"""
get the MatPlotLib Figure window for y vs x
Expand Down Expand Up @@ -1452,7 +1379,7 @@ def trim_plot_lines(bec, n, x, y):
instance of ophyd.Signal (or subclass),
dependent (y) axis
(new in release 1.3.5, replaces :func:`plot_prune_fifo`)
(new in release 1.3.5)
"""
liveplot = select_live_plot(bec, y)
if liveplot is None:
Expand Down

0 comments on commit 1e6672d

Please sign in to comment.