Ejemplo n.º 1
0
def RE(request):
    loop = asyncio.new_event_loop()
    loop.set_debug(True)
    RE = RunEngine({}, loop=loop)

    bec = best_effort.BestEffortCallback()
    RE.subscribe(bec)
    return RE
Ejemplo n.º 2
0
def bluesky_utils():
    # setup run engine
    RE = RunEngine({})
    bec = best_effort.BestEffortCallback()
    bec.disable_plots()
    RE.subscribe(bec)
    # setup databroker and mongo
    db = Broker.named("local")
    try:
        databroker.assets.utils.install_sentinels(db.reg.config, version=1)
    except Exception:
        pass
    # setup file handler
    RE.subscribe(db.insert)
    db.reg.register_handler("srw", SRWFileHandler, overwrite=True)
    db.reg.register_handler("SIREPO_FLYER", SRWFileHandler, overwrite=True)
    return RE, db
def utils():
    # bluesky RunEngine
    RE = RunEngine({})
    bec = best_effort.BestEffortCallback()
    RE.subscribe(bec)

    # Mongo Backend
    db = Broker.named("local")
    try:
        databroker.assets.utils.install_sentinels(db.reg.config, version=1)
    except Exception:
        pass
    # update database info
    RE.subscribe(db.insert)
    db.reg.register_handler("srw", SRWFileHandler, overwrite=True)

    # store data
    root_dir = "/tmp/sirepo_flyer_data"
    _ = make_dir_tree(datetime.datetime.now().year, base_path=root_dir)

    return RE, db
Ejemplo n.º 4
0
import datetime
import json  # noqa F401

import databroker
import matplotlib.pyplot as plt
import numpy as np  # noqa F401
from bluesky.callbacks import best_effort
from bluesky.run_engine import RunEngine
from databroker import Broker
from ophyd.utils import make_dir_tree

from sirepo_bluesky.shadow_handler import ShadowFileHandler
from sirepo_bluesky.srw_handler import SRWFileHandler

RE = RunEngine({})
bec = best_effort.BestEffortCallback()
RE.subscribe(bec)

# MongoDB backend:
db = Broker.named('local')  # mongodb backend
try:
    databroker.assets.utils.install_sentinels(db.reg.config, version=1)
except Exception:
    pass

RE.subscribe(db.insert)
db.reg.register_handler('srw', SRWFileHandler, overwrite=True)
# db.reg.register_handler('shadow', ShadowFileHandler, overwrite=True)
db.reg.register_handler('SIREPO_FLYER', SRWFileHandler, overwrite=True)

plt.ion()