<commit_before># vi: ts=4 sw=4
'''
:mod:`ophyd.control.areadetector` - areaDetector
================================================

.. module:: ophyd.controls.areadetector.detectors
 :synopsis:  `areaDetector`_ detector abstractions

.. _areaDetector: http://cars.uchicago.edu/software/epics/areaDetector.html
'''

from __future__ import print_function

from .base import (ADBase, ADComponent as C)
from . import cam


__all__ = ['DetectorBase',
           'AreaDetector',
           'Andor3Detector',
           'AndorDetector',
           'BrukerDetector',
           'FirewireLinDetector',
           'FirewireWinDetector',
           'LightFieldDetector',
           'Mar345Detector',
           'MarCCDDetector',
           'PerkinElmerDetector',
           'PilatusDetector',
           'PixiradDetector',
           'PointGreyDetector',
           'ProsilicaDetector',
           'PSLDetector',
           'PvcamDetector',
           'RoperDetector',
           'SimDetector',
           'URLDetector',
           ]


class DetectorBase(ADBase):
    """
    The base class for the hardware-specific classes that follow.

    Note that Plugin also inherits from ADBase.
    This adds some AD-specific methods that are not shared by the plugins.
    """
    def dispatch(self, key):
        """When a new acquisition is finished, this method is called with a
        key which is a label like 'light', 'dark', or 'gain8'.

        It in turn calls all of the file plugins and makes them insert a
        datum into FileStore.
        """
        from .plugins import FilePlugin  # terrible but necesary unless we move
        file_plugins = [a for _, a in self._signals.items() if
                        isinstance(a, FilePlugin)]
        for p in file_plugins:
            p.generate_datum(key)

    def make_data_keys(self):
        source = 'PV:{}'.format(self.prefix)
        shape = tuple(self.cam.array_size)  # casting for paranoia's sake
        return dict(shape=shape, source=source, dtype='array',
                    external='FILESTORE:')

    def generate_datum(self):
        # overridden by FileStore mixin classes, if any
        pass


class AreaDetector(DetectorBase):
    cam = C(cam.AreaDetectorCam, 'cam1:')


class SimDetector(DetectorBase):
    _html_docs = ['simDetectorDoc.html']
    cam = C(cam.SimDetectorCam, 'cam1:')


class AdscDetector(DetectorBase):
    _html_docs = ['adscDoc.html']
    cam = C(cam.AdscDetectorCam, 'cam1:')
<commit_msg>CLN: minor refactor<commit_after># vi: ts=4 sw=4
'''
:mod:`ophyd.control.areadetector` - areaDetector
================================================

.. module:: ophyd.controls.areadetector.detectors
 :synopsis:  `areaDetector`_ detector abstractions

.. _areaDetector: http://cars.uchicago.edu/software/epics/areaDetector.html
'''

from __future__ import print_function

from .base import (ADBase, ADComponent as C)
from . import cam


__all__ = ['DetectorBase',
           'AreaDetector',
           'Andor3Detector',
           'AndorDetector',
           'BrukerDetector',
           'FirewireLinDetector',
           'FirewireWinDetector',
           'LightFieldDetector',
           'Mar345Detector',
           'MarCCDDetector',
           'PerkinElmerDetector',
           'PilatusDetector',
           'PixiradDetector',
           'PointGreyDetector',
           'ProsilicaDetector',
           'PSLDetector',
           'PvcamDetector',
           'RoperDetector',
           'SimDetector',
           'URLDetector',
           ]


class DetectorBase(ADBase):
    """
    The base class for the hardware-specific classes that follow.

    Note that Plugin also inherits from ADBase.
    This adds some AD-specific methods that are not shared by the plugins.
    """
    def dispatch(self, key):
        """When a new acquisition is finished, this method is called with a
        key which is a label like 'light', 'dark', or 'gain8'.

        It in turn calls all of the file plugins and makes them insert a
        datum into FileStore.
        """
        from .plugins import FilePlugin  # bad but necesary unless we move
        file_plugins = [s for s in self._signals.values() if
                        isinstance(s, FilePlugin)]
        for p in file_plugins:
            p.generate_datum(key)

    def make_data_keys(self):
        source = 'PV:{}'.format(self.prefix)
        shape = tuple(self.cam.array_size)  # casting for paranoia's sake
        return dict(shape=shape, source=source, dtype='array',
                    external='FILESTORE:')

    def generate_datum(self):
        # overridden by FileStore mixin classes, if any
        pass


class AreaDetector(DetectorBase):
    cam = C(cam.AreaDetectorCam, 'cam1:')


class SimDetector(DetectorBase):
    _html_docs = ['simDetectorDoc.html']
    cam = C(cam.SimDetectorCam, 'cam1:')


class AdscDetector(DetectorBase):
    _html_docs = ['adscDoc.html']
    cam = C(cam.AdscDetectorCam, 'cam1:')

{'fraction_non_alphanumeric': 0.11902360298567682, 'fraction_numerical': 0.004034698406294129, 'mean_word_length': 2.501412429378531, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '355498', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1452, 'n_words': 380}