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

remove deprecated features #463

Merged
merged 5 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
Change History
##############

:1.3.10: release expected 2021-01-01
:1.4.1: release expected 2021-01-31

:1.4.0: release expected 2021-01-01

* `#463 <https://github.com/BCDA-APS/apstools/pull/463>`_
Remove deprecated features.

* `apstools.suspenders.SuspendWhenChanged()`
* `apstools.utils.plot_prune_fifo()`
* `apstools.utils.show_ophyd_symbols()`
* `apstools.synapps.asyn.AsynRecord.binary_output_maxlength()`

:1.3.9: released 2020-11-30

Expand Down
85 changes: 0 additions & 85 deletions apstools/suspenders.py

This file was deleted.

2 changes: 0 additions & 2 deletions apstools/synApps/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@ class AsynRecord(EpicsRecordDeviceCommonAll):
timeout = Component(EpicsSignal, ".TMOT")
transaction_mode = Component(EpicsSignal, ".TMOD")
translated_input = Component(EpicsSignal, ".TINP")

binary_output_maxlength = output_maxlength # TODO: deprecated name
94 changes: 1 addition & 93 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 All @@ -34,7 +33,6 @@
~safe_ophyd_name
~select_live_plot
~select_mpl_figure
~show_ophyd_symbols
~split_quoted_line
~summarize_runs
~text_encode
Expand Down Expand Up @@ -735,24 +733,6 @@ def listobjects(show_pv=True, printing=True, verbose=False, symbols=None):
return table


def show_ophyd_symbols(show_pv=True,
printing=True,
verbose=False,
symbols=None):
"""
DEPRECATED: Use listobjects() instead.
"""
warnings.warn(
"DEPRECATED: show_ophyd_symbols() will be removed"
" in a future release. Use listobjects() instead."
)
listobjects(
show_pv=show_pv,
printing=printing,
verbose=verbose,
symbols=symbols)


def split_quoted_line(line):
"""
splits a line into words some of which might be quoted
Expand Down Expand Up @@ -1301,78 +1281,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 +1360,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
6 changes: 0 additions & 6 deletions docs/source/source/_suspenders.rst

This file was deleted.

12 changes: 1 addition & 11 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_listobjects(self):
wont_show = ("flyer1", "flyer2", "new_trivial_flyer", "trivial_flyer")
num = len(sims) - len(wont_show)
kk = sorted(sims.keys())
# sims hardware not found by show_ophyd_symbols() in globals!

table = APS_utils.listobjects(symbols=sims, printing=False)
self.assertEqual(4, len(table.labels))
rr = [r[0] for r in table.rows]
Expand All @@ -203,16 +203,6 @@ def test_listobjects(self):
self.assertTrue(k in rr, msg)
self.assertEqual(num, len(table.rows))

def test_show_ophyd_symbols(self):
sims = ophyd.sim.hw().__dict__
# wont_show = ("flyer1", "flyer2", "new_trivial_flyer", "trivial_flyer")
self.assertWarns(
UserWarning,
APS_utils.show_ophyd_symbols,
symbols=sims,
printing=False # kwargs
)

def test_unix(self):
cmd = 'echo "hello"'
out, err = APS_utils.unix(cmd)
Expand Down