Skip to content

Commit

Permalink
Merge pull request #166 from ZLLentz/dev-rename-compat
Browse files Browse the repository at this point in the history
FIX: compatibility with pcdsdevices 2.0.0
  • Loading branch information
ZLLentz authored Jun 29, 2019
2 parents f3fc123 + dfe02a5 commit 0a5e4dd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ requirements:
- coloredlogs
- pyfiglet
- happi >1.1.1
- pcdsdevices >=0.6.0
- pcdsdevices >=2.0.0
- pcdsdaq >=2.0.0
- psdm_qs_cli >=0.2.2
- lightpath >=0.3.0
Expand Down
12 changes: 6 additions & 6 deletions hutch_python/cam_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from .constants import SUCCESS_LEVEL

from pcdsdevices.areadetector.detectors import PCDSDetector
from pcdsdevices.areadetector.detectors import PCDSAreaDetector

logger = logging.getLogger(__name__)
logger.success = partial(logger.log, SUCCESS_LEVEL)
Expand All @@ -28,7 +28,7 @@ def read_camviewer_cfg(filename):
Returns
-------
objs: ``{str: PCDSDetector}``
objs: ``{str: PCDSAreaDetector}``
Each detector object, indexed by name.
"""
info = interpret_cfg(filename)
Expand Down Expand Up @@ -118,7 +118,7 @@ def load_cams(info):
Returns
-------
objs: ``{str: PCDSDetector}``
objs: ``{str: PCDSAreaDetector}``
Each detector object, indexed by name.
"""
# Any cam that needs the event loop has to have one set in the thread
Expand Down Expand Up @@ -146,7 +146,7 @@ def build_and_log(info_part):
Returns
-------
obj: ``PCDSDetector``
obj: ``PCDSAreaDetector``
The loaded detector, or None.
"""
# We sync with the main thread's loop so that they work as expected later
Expand Down Expand Up @@ -202,7 +202,7 @@ def build_cam(cam_type, pv_info, evr, name, *args):
Returns
-------
cam: ``PCDSDetector``
cam: ``PCDSAreaDetector``
"""
if not cam_type.startswith('GE'):
raise UnsupportedConfig('Only cam type GE (area detector) supported.',
Expand All @@ -211,7 +211,7 @@ def build_cam(cam_type, pv_info, evr, name, *args):
raise MalformedConfig(name=name)
detector_prefix = get_det_prefix(pv_info)
name = name.replace(' ', '_').lower()
return PCDSDetector(detector_prefix, name=name)
return PCDSAreaDetector(detector_prefix, name=name)


def get_det_prefix(pv_info):
Expand Down
6 changes: 3 additions & 3 deletions hutch_python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ophyd.areadetector.plugins import PluginBase
from ophyd.device import Component as Cpt
from ophyd.signal import Signal
from pcdsdevices.areadetector.detectors import PCDSDetector
from pcdsdevices.areadetector.detectors import PCDSAreaDetector

import hutch_python.utils

Expand All @@ -23,8 +23,8 @@

TST_CAM_CFG = str(Path(__file__).parent / '{}camviewer.cfg')

for component in PCDSDetector.component_names:
cpt_class = getattr(PCDSDetector, component).cls
for component in PCDSAreaDetector.component_names:
cpt_class = getattr(PCDSAreaDetector, component).cls
if issubclass(cpt_class, PluginBase):
cpt_class.plugin_type = Cpt(Signal, value=cpt_class._plugin_type)

Expand Down
10 changes: 5 additions & 5 deletions hutch_python/tests/test_cam_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ophyd.sim import make_fake_device, fake_device_cache, FakeEpicsSignal
import pytest

from pcdsdevices.areadetector.detectors import PCDSDetector
from pcdsdevices.areadetector.detectors import PCDSAreaDetector

import hutch_python.cam_load as cam_load
from hutch_python.cam_load import (read_camviewer_cfg, interpret_lines,
Expand All @@ -17,15 +17,15 @@
CFG = TST_CAM_CFG.format('')

fake_device_cache[EpicsSignalWithRBV] = FakeEpicsSignal
FakeDet = make_fake_device(PCDSDetector)
cam_load.PCDSDetector = FakeDet
FakeDet = make_fake_device(PCDSAreaDetector)
cam_load.PCDSAreaDetector = FakeDet


def test_build_cam():
logger.debug('test_build_cam')
# Basic functionality test
obj = build_cam('GE:16', 'PREFIX:IMAGE2', None, 'my_cam')
assert isinstance(obj, PCDSDetector)
assert isinstance(obj, PCDSAreaDetector)


def test_build_cam_errors():
Expand All @@ -42,7 +42,7 @@ def test_read_camviewer_cfg():
logger.debug('test_read_camviewer_cfg')
# Basic functionality test
objs = read_camviewer_cfg(CFG)
assert isinstance(objs['my_cam'], PCDSDetector)
assert isinstance(objs['my_cam'], PCDSAreaDetector)
assert len(objs) == 1


Expand Down

0 comments on commit 0a5e4dd

Please sign in to comment.