NSLS-II / Bug-Reports

Unified issue-tracker for bugs in the data acquisition, management, and analysis software at NSLS-II
BSD 3-Clause "New" or "Revised" License
2 stars 5 forks source link

Quad Electrometer is not correctly configure in Bluesky #93

Closed yugangzhang closed 8 years ago

yugangzhang commented 8 years ago

Quad Electrometer in CHX is not correctly configure in Bluesky.

Here is the current code

from ophyd import (ProsilicaDetector, SingleTrigger, TIFFPlugin,
                   ImagePlugin, StatsPlugin, DetectorBase, HDF5Plugin,
                   AreaDetector, EpicsSignal, EpicsSignalRO)

class Elm(SingleTrigger, DetectorBase):
    pass

When run elm = Elm('XF:11IDA-BI{AH401B}AH401B:',)

We get


In [137]: elm = Elm('XF:11IDA-BI{AH401B}AH401B:',)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/home/xf11id/conda_envs/collection/lib/python3.5/site-packages/ophyd/device.py in __getattr__(self, name)
    585                 # Initial access of signal
--> 586                 cpt = self._sig_attrs[name]
    587                 return cpt.__get__(self, None)

KeyError: 'cam'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
/home/xf11id/.ipython/profile_collection/startup/20-area-detectors.py in <module>()
----> 1 elm = Elm('XF:11IDA-BI{AH401B}AH401B:',)

/home/xf11id/conda_envs/collection/lib/python3.5/site-packages/ophyd/areadetector/trigger_mixins.py in __init__(self, image_name, *args, **kwargs)
     51     """
     52     def __init__(self, *args, image_name=None, **kwargs):
---> 53         super().__init__(*args, **kwargs)
     54         if image_name is None:
     55             image_name = '_'.join([self.name, 'image'])

/home/xf11id/conda_envs/collection/lib/python3.5/site-packages/ophyd/areadetector/trigger_mixins.py in __init__(self, *args, **kwargs)
     31         super().__init__(*args, **kwargs)
     32         # settings
---> 33         self.stage_sigs.update([(self.cam.acquire, 0),  # If acquiring, stop.
     34                                 (self.cam.image_mode, 1),  # 'Multiple' mode
     35                                 ])

/home/xf11id/conda_envs/collection/lib/python3.5/site-packages/ophyd/device.py in __getattr__(self, name)
    587                 return cpt.__get__(self, None)
    588             except KeyError:
--> 589                 raise AttributeError(name)
    590 
    591         attr_names = name.split('.')

AttributeError: cam
yugangzhang commented 8 years ago

I figured out a way to solve it.

from ophyd import (Device, Component as Cpt, EpicsSignalRO)

class Elm(Device):
    sum_x = Cpt(EpicsSignalRO, 'SumX:MeanValue_RBV')
    sum_y = Cpt(EpicsSignalRO, 'SumY:MeanValue_RBV')
    sum_all = Cpt(EpicsSignalRO, 'SumAll:MeanValue_RBV')

elm = Elm('XF:11IDA-BI{AH401B}AH401B:', name='elm')
ghost commented 8 years ago

Good job @yugangzhang

yugangzhang commented 8 years ago

Thanks! I just found someone's code and modify it.