<commit_before>import h5py
from databroker import Broker
from databroker._core import register_builtin_handlers

db = Broker.named('srx')
register_builtin_handlers(db.reg)


# srx detector, to be moved to filestore
from databroker.assets.handlers import Xspress3HDF5Handler, HandlerBase

class BulkXSPRESS(HandlerBase):
    HANDLER_NAME = 'XPS3_FLY'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self):
        return self._handle['entry/instrument/detector/data'][:]


class ZebraHDF5Handler(HandlerBase):
    HANDLER_NAME = 'ZEBRA_HDF51'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self, column):
        return self._handle[column][:]


class SISHDF5Handler(HandlerBase):
    HANDLER_NAME = 'SIS_HDF51'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self, column):
        return self._handle[column][:]


class BulkMerlin(BulkXSPRESS):
    HANDLER_NAME = 'MERLIN_FLY_STREAM_V1'
    def __call__(self):
        return self._handle['entry/instrument/detector/data'][:]


db.reg.register_handler(BulkXSPRESS.HANDLER_NAME, BulkXSPRESS,
                        overwrite=True)
db.reg.register_handler('SIS_HDF51', SISHDF5Handler, 
                        overwrite=True)
db.reg.register_handler('ZEBRA_HDF51', ZebraHDF5Handler, 
                        overwrite=True)
db.reg.register_handler(BulkMerlin.HANDLER_NAME, BulkMerlin, 
                        overwrite=True)
<commit_msg>DEV: dexela detector added<commit_after>import h5py
from databroker import Broker
from databroker._core import register_builtin_handlers

db = Broker.named('srx')
register_builtin_handlers(db.reg)


# srx detector, to be moved to filestore
from databroker.assets.handlers import Xspress3HDF5Handler, HandlerBase

class BulkXSPRESS(HandlerBase):
    HANDLER_NAME = 'XPS3_FLY'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self):
        return self._handle['entry/instrument/detector/data'][:]


class ZebraHDF5Handler(HandlerBase):
    HANDLER_NAME = 'ZEBRA_HDF51'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self, column):
        return self._handle[column][:]


class SISHDF5Handler(HandlerBase):
    HANDLER_NAME = 'SIS_HDF51'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self, column):
        return self._handle[column][:]


class BulkMerlin(BulkXSPRESS):
    HANDLER_NAME = 'MERLIN_FLY_STREAM_V1'
    def __call__(self):
        return self._handle['entry/instrument/detector/data'][:]

class BulkDexela(HandlerBase):
    HANDLER_NAME = 'DEXELA_FLY_V1'
    def __init__(self, resource_fn):
        self._handle = h5py.File(resource_fn, 'r')

    def __call__(self):
        return self._handle['entry/instrument/detector/data'][:]

db.reg.register_handler(BulkXSPRESS.HANDLER_NAME, BulkXSPRESS,
                        overwrite=True)
db.reg.register_handler('SIS_HDF51', SISHDF5Handler, 
                        overwrite=True)
db.reg.register_handler('ZEBRA_HDF51', ZebraHDF5Handler, 
                        overwrite=True)
db.reg.register_handler(BulkMerlin.HANDLER_NAME, BulkMerlin, 
                        overwrite=True)
db.reg.register_handler(BulkDexela.HANDLER_NAME, BulkDexela,
                        overwrite=True)

{'fraction_non_alphanumeric': 0.10361653272101033, 'fraction_numerical': 0.012055109070034443, 'mean_word_length': 3.5201037613488975, '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': '6179593', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1192, 'n_words': 198}