How to use the ophyd.signal.EpicsSignalRO function in ophyd

To help you get started, we’ve selected a few ophyd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bluesky / ophyd / tests / test_signal.py View on Github external
def test_epicssignal_readonly():
    signal = EpicsSignalRO('readpv')
    signal.wait_for_connection()
    signal.value

    with pytest.raises(ReadOnlyError):
        signal.value = 10

    with pytest.raises(ReadOnlyError):
        signal.put(10)

    with pytest.raises(ReadOnlyError):
        signal.set(10)

    # vestigial, to be removed
    with pytest.raises(AttributeError):
        signal.setpoint_ts
github bluesky / ophyd / tests / test_signal.py View on Github external
def test_epicssignalro_alarm_status():
    sig = EpicsSignalRO('XF:31IDA-OP{Tbl-Ax:X1}Mtr.RBV')
    sig.alarm_status
    sig.alarm_severity
github bluesky / ophyd / ophyd / mca.py View on Github external
baseline_threshold = Cpt(SignalWithRBV, 'BaselineThreshold')
    baseline_energy_array = Cpt(EpicsSignal, 'BaselineEnergyArray')
    baseline_histogram = Cpt(EpicsSignal, 'BaselineHistogram')
    baseline_threshold = Cpt(SignalWithRBV, 'BaselineThreshold')

    # Misc PVs
    preamp_gain = Cpt(SignalWithRBV, 'PreampGain')
    detector_polarity = Cpt(SignalWithRBV, 'DetectorPolarity')
    reset_delay = Cpt(SignalWithRBV, 'ResetDelay')
    decay_time = Cpt(SignalWithRBV, 'DecayTime')
    max_energy = Cpt(SignalWithRBV, 'MaxEnergy')
    adc_percent_rule = Cpt(SignalWithRBV, 'ADCPercentRule')
    max_width = Cpt(SignalWithRBV, 'MaxWidth')

    # read-only diagnostics
    triggers = Cpt(EpicsSignalRO, 'Triggers', lazy=True)
    events = Cpt(EpicsSignalRO, 'Events', lazy=True)
    overflows = Cpt(EpicsSignalRO, 'Overflows', lazy=True)
    underflows = Cpt(EpicsSignalRO, 'Underflows', lazy=True)
    input_count_rate = Cpt(EpicsSignalRO, 'InputCountRate', lazy=True)
    output_count_rate = Cpt(EpicsSignalRO, 'OutputCountRate', lazy=True)

    mca_bin_width = Cpt(EpicsSignalRO, 'MCABinWidth_RBV')
    calibration_energy = Cpt(EpicsSignalRO, 'CalibrationEnergy_RBV')
    current_pixel = Cpt(EpicsSignal, 'CurrentPixel')
    dynamic_range = Cpt(EpicsSignalRO, 'DynamicRange_RBV')

    # Preset options
    preset_events = Cpt(SignalWithRBV, 'PresetEvents')
    preset_mode = Cpt(SignalWithRBV, 'PresetMode', string=True)
    preset_triggers = Cpt(SignalWithRBV, 'PresetTriggers')
github bluesky / ophyd / ophyd / flyers.py View on Github external
keys.

        Returns
        -------
        data_keys_by_stream : dict
            The keys must be strings and the values must be dict-like
            with keys that are str and the inner values are dict-like
            with the ``event_model.event_descriptor.data_key`` schema.
        '''


class AreaDetectorTimeseriesCollector(Device):
    control = Cpt(EpicsSignal, "TSControl")
    num_points = Cpt(EpicsSignal, "TSNumPoints")
    cur_point = Cpt(EpicsSignalRO, "TSCurrentPoint")
    waveform = Cpt(EpicsSignalRO, "TSTotal")
    waveform_ts = Cpt(EpicsSignalRO, "TSTimestamp")

    _default_configuration_attrs = ('num_points', )
    _default_read_attrs = ()

    def __init__(self, *args, stream_name=None, **kwargs):

        self.stream_name = stream_name

        super().__init__(*args, **kwargs)

    def _get_waveforms(self):
        n = self.cur_point.get()
        if n:
            return (self.waveform.get(count=n),
                    self.waveform_ts.get(count=n))
github bluesky / ophyd / examples / pvpositioner.py View on Github external
logger.info('--> post-move request, moving=%s', pos.moving)

    while not stat.done:
        logger.info('--> moving... %s error=%s', stat, stat.error)
        time.sleep(0.1)

    pos.move(-1, wait=True)
    logger.info('--> synchronous move request, moving=%s', pos.moving)

    logger.info('--> PV Positioner, using put completion and no DONE pv')

    # PV positioner, put completion, no done pv
    class MyPositioner(PVPositionerPC):
        '''PV positioner, put completion with a done pv'''
        setpoint = C(EpicsSignal, '.VAL')
        readback = C(EpicsSignalRO, '.RBV')

    pos = MyPositioner(config.motor_recs[0], name='mypos_pc_nodone')

    stat = pos.move(2, wait=False)
    logger.info('--> post-move request, moving=%s', pos.moving)

    while not stat.done:
        logger.info('--> moving... %s', stat)
        time.sleep(0.1)

    pos.move(0, wait=True)
    logger.info('--> synchronous move request, moving=%s', pos.moving)
github bluesky / ophyd / ophyd / flyers.py View on Github external
'''Waveform collector

    See: https://github.com/NSLS-II-CSX/timestamp

    Parameters
    ----------
    data_is_time : bool, optional
        Use time as the data being acquired
    '''
    _default_configuration_attrs = ()
    _default_read_attrs = ()

    select = Cpt(EpicsSignal, "Sw-Sel")
    reset = Cpt(EpicsSignal, "Rst-Sel")
    waveform_count = Cpt(EpicsSignalRO, "Val:TimeN-I")
    waveform = Cpt(EpicsSignalRO, "Val:Time-Wfrm")
    waveform_nord = Cpt(EpicsSignalRO, "Val:Time-Wfrm.NORD")
    data_is_time = Cpt(Signal)

    def __init__(self, *args,
                 data_is_time=True, stream_name=None,
                 **kwargs):
        self.stream_name = stream_name

        super().__init__(*args, **kwargs)

        self.data_is_time.put(data_is_time)

    def _get_waveform(self):
        if self.waveform_count.get():
            return self.waveform.get(count=int(self.waveform_nord.get()))
        else:
github bluesky / ophyd / ophyd / signal.py View on Github external
def __init__(self, read_pv, *,
                 pv_kw=None,
                 string=False,
                 auto_monitor=False,
                 name=None,
                 **kwargs):
        if 'rw' in kwargs:
            if kwargs['rw']:
                new_class = EpicsSignal
            else:
                new_class = EpicsSignalRO

            raise RuntimeError('rw is no longer an option for EpicsSignal. '
                               'Based on your setting of `rw`, you should be '
                               'using this class: {}'
                               ''.format(new_class.__name__))

        if pv_kw is None:
            pv_kw = dict()

        self._lock = threading.RLock()
        self._read_pv = None
        self._string = bool(string)
        self._pv_kw = pv_kw
        self._auto_monitor = auto_monitor

        if name is None:
github bluesky / ophyd / ophyd / areadetector / cam.py View on Github external
max_set_temperature = ADCpt(EpicsSignal, 'MaxSetTemperature')
    max_shutter_close_delay = ADCpt(EpicsSignalRO, 'MaxShutterCloseDelay_RBV')
    max_shutter_open_delay = ADCpt(EpicsSignalRO, 'MaxShutterOpenDelay_RBV')
    measured_temperature = ADCpt(EpicsSignalRO, 'MeasuredTemperature_RBV')
    min_set_temperature = ADCpt(EpicsSignal, 'MinSetTemperature')
    min_shutter_close_delay = ADCpt(EpicsSignalRO, 'MinShutterCloseDelay_RBV')
    min_shutter_open_delay = ADCpt(EpicsSignalRO, 'MinShutterOpenDelay_RBV')
    num_parallel_pixels = ADCpt(EpicsSignalRO, 'NumParallelPixels_RBV')
    num_ports = ADCpt(EpicsSignalRO, 'NumPorts_RBV')
    num_serial_pixels = ADCpt(EpicsSignalRO, 'NumSerialPixels_RBV')
    num_speed_table_entries = ADCpt(EpicsSignalRO, 'NumSpeedTableEntries_RBV')
    open_delay = ADCpt(SignalWithRBV, 'OpenDelay')
    pcifw_vers = ADCpt(EpicsSignalRO, 'PCIFWVers_RBV')
    pv_cam_vers = ADCpt(EpicsSignalRO, 'PVCamVers_RBV')
    pixel_parallel_dist = ADCpt(EpicsSignalRO, 'PixelParallelDist_RBV')
    pixel_parallel_size = ADCpt(EpicsSignalRO, 'PixelParallelSize_RBV')
    pixel_serial_dist = ADCpt(EpicsSignalRO, 'PixelSerialDist_RBV')
    pixel_serial_size = ADCpt(EpicsSignalRO, 'PixelSerialSize_RBV')
    pixel_time = ADCpt(EpicsSignalRO, 'PixelTime_RBV')
    post_mask = ADCpt(EpicsSignalRO, 'PostMask_RBV')
    post_scan = ADCpt(EpicsSignalRO, 'PostScan_RBV')
    pre_mask = ADCpt(EpicsSignalRO, 'PreMask_RBV')
    pre_scan = ADCpt(EpicsSignalRO, 'PreScan_RBV')
    serial_num = ADCpt(EpicsSignalRO, 'SerialNum_RBV')
    set_temperature = ADCpt(SignalWithRBV, 'SetTemperature')
    slot1_cam = ADCpt(EpicsSignalRO, 'Slot1Cam_RBV')
    slot2_cam = ADCpt(EpicsSignalRO, 'Slot2Cam_RBV')
    slot3_cam = ADCpt(EpicsSignalRO, 'Slot3Cam_RBV')
    speed_table_index = ADCpt(SignalWithRBV, 'SpeedTableIndex')
    trigger_edge = ADCpt(SignalWithRBV, 'TriggerEdge')
github bluesky / ophyd / ophyd / areadetector / cam.py View on Github external
'SimDetectorCam',
           'URLDetectorCam',
           ]


class CamBase(ADBase):
    _default_configuration_attrs = (ADBase._default_configuration_attrs +
                                    ('acquire_time', 'acquire_period',
                                     'model', 'num_exposures', 'image_mode',
                                     'manufacturer', 'trigger_mode'))

    ImageMode = enum(SINGLE=0, MULTIPLE=1, CONTINUOUS=2)

    # Shared among all cams and plugins
    array_counter = ADCpt(SignalWithRBV, 'ArrayCounter')
    array_rate = ADCpt(EpicsSignalRO, 'ArrayRate_RBV')
    asyn_io = ADCpt(EpicsSignal, 'AsynIO')

    nd_attributes_file = ADCpt(EpicsSignal, 'NDAttributesFile', string=True)
    pool_alloc_buffers = ADCpt(EpicsSignalRO, 'PoolAllocBuffers')
    pool_free_buffers = ADCpt(EpicsSignalRO, 'PoolFreeBuffers')
    pool_max_buffers = ADCpt(EpicsSignalRO, 'PoolMaxBuffers')
    pool_max_mem = ADCpt(EpicsSignalRO, 'PoolMaxMem')
    pool_used_buffers = ADCpt(EpicsSignalRO, 'PoolUsedBuffers')
    pool_used_mem = ADCpt(EpicsSignalRO, 'PoolUsedMem')
    port_name = ADCpt(EpicsSignalRO, 'PortName_RBV', string=True)

    # Cam-specific
    acquire = ADCpt(SignalWithRBV, 'Acquire')
    acquire_period = ADCpt(SignalWithRBV, 'AcquirePeriod')
    acquire_time = ADCpt(SignalWithRBV, 'AcquireTime')
github bluesky / ophyd / ophyd / areadetector / cam.py View on Github external
peltier_power = ADCpt(EpicsSignalRO, 'PeltierPower_RBV')
    sync_in_polarity = ADCpt(SignalWithRBV, 'SyncInPolarity')
    sync_out_function = ADCpt(SignalWithRBV, 'SyncOutFunction')
    sync_out_polarity = ADCpt(SignalWithRBV, 'SyncOutPolarity')
    system_reset = ADCpt(EpicsSignal, 'SystemReset')

    temperature = ADCpt(SignalWithRBV, 'Temperature')
    temperature_actual = ADCpt(EpicsSignal, 'TemperatureActual')
    temperature_box = ADCpt(EpicsSignalRO, 'BoxTemperature_RBV')
    temperature_hot = ADCpt(EpicsSignalRO, 'HotTemperature_RBV')

    threshold_1_actual = ADCpt(EpicsSignalRO, 'ThresholdActual1_RBV')
    threshold_2_actual = ADCpt(EpicsSignalRO, 'ThresholdActual2_RBV')
    threshold_3_actual = ADCpt(EpicsSignalRO, 'ThresholdActual3_RBV')
    threshold_4_actual = ADCpt(EpicsSignalRO, 'ThresholdActual4_RBV')
    thresholds_actual = DDC(ad_group(EpicsSignalRO,
                                     (('threshold_1', 'ThresholdActual1_RBV'),
                                      ('threshold_2', 'ThresholdActual2_RBV'),
                                      ('threshold_3', 'ThresholdActual3_RBV'),
                                      ('threshold_4', 'ThresholdActual4_RBV'),
                                      )),
                            doc='Actual thresholds')

    threshold_1 = ADCpt(SignalWithRBV, 'Threshold1')
    threshold_2 = ADCpt(SignalWithRBV, 'Threshold2')
    threshold_3 = ADCpt(SignalWithRBV, 'Threshold3')
    threshold_4 = ADCpt(SignalWithRBV, 'Threshold4')
    thresholds = DDC(ad_group(SignalWithRBV,
                              (('threshold_1', 'Threshold1'),
                               ('threshold_2', 'Threshold2'),
                               ('threshold_3', 'Threshold3'),
                               ('threshold_4', 'Threshold4'),