-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #591 from BCDA-APS/590-deprecations
remove deprecated items
- Loading branch information
Showing
12 changed files
with
19 additions
and
710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
.. autosummary:: | ||
~ApsCycleComputedRO | ||
~ApsCycleDM | ||
""" | ||
|
||
|
@@ -141,38 +140,6 @@ def get(self): | |
return self._cycle_name | ||
|
||
|
||
class ApsCycleComputedRO(SynSignalRO): | ||
""" | ||
DEPRECATED (1.5.4): Use newer ``ApsCycleDM`` instead. | ||
Compute the APS cycle name based on the calendar and the usual practice. | ||
.. index:: Ophyd Signal; ApsCycleComputedRO | ||
Absent any facility PV that provides the name of the current operating | ||
cycle, this can be approximated by python computation (as long as the | ||
present scheduling pattern is maintained) | ||
This signal is read-only. | ||
NOTE: There is info provided by the APS proposal & ESAF systems. See | ||
:class:`~ApsCycleDM`. | ||
""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
warnings.warn( | ||
"DEPRECATED: ApsCycleComputedRO() will be removed" | ||
" in a future release. Instead, use newer ``ApsCycleDM``.", | ||
DeprecationWarning, | ||
) | ||
super().__init__(*args, **kwargs) | ||
|
||
def get(self): | ||
dt = datetime.datetime.now() | ||
aps_cycle = f"{dt.year}-{int((dt.month-0.1)/4) + 1}" | ||
return aps_cycle | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Pete R. Jemian | ||
# :email: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,10 @@ | |
.. autosummary:: | ||
~device_read2table | ||
~listdevice | ||
~listdevice_1_5_2 | ||
~object_explorer | ||
""" | ||
|
||
__all__ = """ | ||
device_read2table | ||
listdevice | ||
listdevice_1_5_2 | ||
object_explorer | ||
""".split() | ||
__all__ = ["listdevice", ] | ||
|
||
|
||
from collections import defaultdict | ||
|
@@ -91,29 +83,6 @@ def _list_epics_signals(obj): | |
return items | ||
|
||
|
||
def device_read2table( | ||
# fmt:off | ||
device, show_ancient=True, use_datetime=True, printing=True | ||
# fmt:on | ||
): | ||
""" | ||
DEPRECATED (release 1.3.8): Use listdevice() instead. (Remove in 1.6.0.) | ||
""" | ||
# fmt: off | ||
warnings.warn( | ||
"DEPRECATED: device_read2table() will be removed" | ||
" in release 1.6.0. Use listdevice() instead.", | ||
DeprecationWarning, | ||
) | ||
listdevice_1_5_2( | ||
device, | ||
show_ancient=show_ancient, | ||
use_datetime=use_datetime, | ||
printing=printing, | ||
) | ||
# fmt: on | ||
|
||
|
||
def listdevice( | ||
obj, | ||
scope=None, | ||
|
@@ -208,75 +177,6 @@ def listdevice( | |
return pd.DataFrame(dd) | ||
|
||
|
||
def listdevice_1_5_2( | ||
# fmt:off | ||
device, show_ancient=True, use_datetime=True, printing=True | ||
# fmt:on | ||
): | ||
""" | ||
DEPRECATED (release 1.5.3): Use listdevice() instead. (Remove in 1.6.0.) | ||
Read an ophyd device and return a pyRestTable Table. | ||
Include an option to suppress ancient values identified | ||
by timestamp from 1989. These are values only defined in | ||
the original ``.db`` file. | ||
""" | ||
table = pyRestTable.Table() | ||
table.labels = "name value timestamp".split() | ||
ANCIENT_YEAR = 1989 | ||
for k, rec in device.read().items(): | ||
value = rec["value"] | ||
ts = rec["timestamp"] | ||
dt = datetime.datetime.fromtimestamp(ts) | ||
if dt.year > ANCIENT_YEAR or show_ancient: | ||
if use_datetime: | ||
ts = dt | ||
table.addRow((k, value, ts)) | ||
|
||
if printing: | ||
print(table) | ||
|
||
return table | ||
|
||
|
||
def object_explorer(obj, sortby=None, fmt="simple", printing=True): | ||
""" | ||
DEPRECATED (release 1.5.3): Use listdevice() instead. (Remove in 1.6.0.) | ||
print the contents of obj | ||
""" | ||
t = pyRestTable.Table() | ||
t.addLabel("name") | ||
t.addLabel("PV reference") | ||
t.addLabel("value") | ||
items = _list_epics_signals(obj) | ||
if items is None: | ||
logger.debug("No EPICS signals found.") | ||
else: | ||
logger.debug(f"number of items: {len(items)}") | ||
|
||
def sorter(obj): | ||
if sortby is None: | ||
key = obj.dotted_name | ||
elif str(sortby).lower() == "pv": | ||
key = _get_pv(obj) or "--" | ||
else: | ||
# fmt: off | ||
raise ValueError( | ||
f"sortby should be None or 'PV', found sortby='{sortby}'" | ||
) | ||
# fmt: on | ||
return key | ||
|
||
for item in sorted(items, key=sorter): | ||
t.addRow((item.dotted_name, _get_pv(item), item.get())) | ||
|
||
if printing: | ||
print(t.reST(fmt=fmt)) | ||
return t | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Pete R. Jemian | ||
# :email: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.