Ejemplo n.º 1
0
def setUpModule():
    global mtr

    setup_ophyd()

    mtr = EpicsMotor(motor_recs[0])
    mtr.wait_for_connection()
Ejemplo n.º 2
0
def setUpModule():
    global mtr

    setup_ophyd()

    mtr = EpicsMotor(motor_recs[0])
    mtr.wait_for_connection()
Ejemplo n.º 3
0
    def count_time(self):
        '''Exposure time, as set by bluesky'''
        return self._count_time

    @count_time.setter
    def count_time(self, count_time):
        self._count_time = count_time


class SRXSaturn(SaturnSoftTrigger, Saturn):
    def __init__(self, prefix, *, read_attrs=None, configuration_attrs=None,
                 **kwargs):
        if read_attrs is None:
            read_attrs = ['mca.spectrum']

        if configuration_attrs is None:
            configuration_attrs = ['mca.preset_real_time',
                                   'mca.preset_live_time',
                                   'dxp.preset_mode',
                                   ]

        super().__init__(prefix, read_attrs=read_attrs,
                         configuration_attrs=configuration_attrs, **kwargs)


if __name__ == '__main__':
    from ophyd.commands import setup_ophyd
    setup_ophyd()

    saturn = SRXSaturn('dxpSaturn:', name='saturn')
Ejemplo n.º 4
0
from ophyd.commands import setup_ophyd

setup_ophyd()  # this does low-level stuff to get pyepics talking

from bluesky import RunEngine
from bluesky.plans import *
from bluesky.callbacks import *


def custom_callback_example(name, doc):
    """
    a very simple example: print document name each time one is
    generated

    Example
    -------
    >>> RE(plan, custom_callback_example)  # single use
    >>> RE.subscribe('all', custom_callback_example)  # use always
    """
    # name is a string; doc is a dict
    print(name)


def data_writer(filename, field):
    "make a callback function that writes data to an h5 file"

    def cb(name, doc):
        if name != 'event':
            return

    # We have an event document. Extract the measurement of interest.