How to use the ophyd.device.Component 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 / ophyd / mca.py View on Github external
prefix = '{}{}'.format(self.prefix, self.parameter_prefix)
        name = '{}_param{}'.format(self.name, index)
        param = EpicsDXPLowLevelParameter(prefix, name=name)
        self._parameter_cache[index] = param
        return param


class EpicsDXPMapping(Device):
    apply = Cpt(EpicsSignal, 'Apply')
    auto_apply = Cpt(SignalWithRBV, 'AutoApply')
    auto_pixels_per_buffer = Cpt(SignalWithRBV, 'AutoPixelsPerBuffer')
    buffer_size = Cpt(EpicsSignalRO, 'BufferSize_RBV')
    collect_mode = Cpt(SignalWithRBV, 'CollectMode')
    ignore_gate = Cpt(SignalWithRBV, 'IgnoreGate')
    input_logic_polarity = Cpt(SignalWithRBV, 'InputLogicPolarity')
    list_mode = Cpt(SignalWithRBV, 'ListMode')
    mbytes_read = Cpt(EpicsSignalRO, 'MBytesRead_RBV')
    next_pixel = Cpt(EpicsSignal, 'NextPixel')
    pixel_advance_mode = Cpt(SignalWithRBV, 'PixelAdvanceMode')
    pixels_per_buffer = Cpt(SignalWithRBV, 'PixelsPerBuffer')
    pixels_per_run = Cpt(SignalWithRBV, 'PixelsPerRun')
    read_rate = Cpt(EpicsSignalRO, 'ReadRate_RBV')
    sync_count = Cpt(SignalWithRBV, 'SyncCount')


class EpicsDXPBaseSystem(Device):
    channel_advance = Cpt(EpicsSignal, 'ChannelAdvance')
    client_wait = Cpt(EpicsSignal, 'ClientWait')
    dwell = Cpt(EpicsSignal, 'Dwell')
    max_scas = Cpt(EpicsSignal, 'MaxSCAs')
    num_scas = Cpt(SignalWithRBV, 'NumSCAs')
github bluesky / ophyd / ophyd / mca.py View on Github external
read_baseline_histograms = Cpt(EpicsSignal, 'ReadBaselineHistograms')
    read_all = Cpt(EpicsSignal, 'ReadAll')
    read_all_once = Cpt(EpicsSignal, 'ReadAllOnce')

    # As a debugging note, if snl_connected is not '1', your IOC is
    # misconfigured:
    snl_connected = Cpt(EpicsSignal, 'SNL_Connected')

    # Copying to individual elements
    copy_adcp_ercent_rule = Cpt(EpicsSignal, 'CopyADCPercentRule')
    copy_baseline_cut_enable = Cpt(EpicsSignal, 'CopyBaselineCutEnable')
    copy_baseline_cut_percent = Cpt(EpicsSignal, 'CopyBaselineCutPercent')
    copy_baseline_filter_length = Cpt(EpicsSignal, 'CopyBaselineFilterLength')
    copy_baseline_threshold = Cpt(EpicsSignal, 'CopyBaselineThreshold')
    copy_decay_time = Cpt(EpicsSignal, 'CopyDecayTime')
    copy_detector_polarity = Cpt(EpicsSignal, 'CopyDetectorPolarity')
    copy_energy_threshold = Cpt(EpicsSignal, 'CopyEnergyThreshold')
    copy_gap_time = Cpt(EpicsSignal, 'CopyGapTime')
    copy_max_energy = Cpt(EpicsSignal, 'CopyMaxEnergy')
    copy_max_width = Cpt(EpicsSignal, 'CopyMaxWidth')
    copy_peaking_time = Cpt(EpicsSignal, 'CopyPeakingTime')
    copy_preamp_gain = Cpt(EpicsSignal, 'CopyPreampGain')
    copy_roic_hannel = Cpt(EpicsSignal, 'CopyROIChannel')
    copy_roie_nergy = Cpt(EpicsSignal, 'CopyROIEnergy')
    copy_roi_sca = Cpt(EpicsSignal, 'CopyROI_SCA')
    copy_reset_delay = Cpt(EpicsSignal, 'CopyResetDelay')
    copy_trigger_gap_time = Cpt(EpicsSignal, 'CopyTriggerGapTime')
    copy_trigger_peaking_time = Cpt(EpicsSignal, 'CopyTriggerPeakingTime')
    copy_trigger_threshold = Cpt(EpicsSignal, 'CopyTriggerThreshold')

    # do_* executes the process:
    do_read_all = Cpt(EpicsSignal, 'DoReadAll')
github bluesky / ophyd / ophyd / mca.py View on Github external
# Baseline PVs
    baseline_cut_percent = Cpt(SignalWithRBV, 'BaselineCutPercent')
    baseline_cut_enable = Cpt(SignalWithRBV, 'BaselineCutEnable')
    baseline_filter_length = Cpt(SignalWithRBV, 'BaselineFilterLength')
    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
github bluesky / ophyd / ophyd / sim.py View on Github external
specs = {'NPY_SEQ'}

    def __init__(self, filename, root=''):
        self._name = os.path.join(root, filename)

    def __call__(self, index):
        return np.load('{}_{}.npy'.format(self._name, index))

    def get_file_list(self, datum_kwarg_gen):
        "This method is optional. It is not needed for access, but for export."
        return ['{name}_{index}.npy'.format(name=self._name, **kwargs)
                for kwargs in datum_kwarg_gen]


class ABDetector(Device):
    a = Component(SynSignal, func=random.random, kind=Kind.hinted)
    b = Component(SynSignal, func=random.random)

    def trigger(self):
        return self.a.trigger() & self.b.trigger()


class DetWithCountTime(Device):
    intensity = Component(SynSignal, func=lambda: 0, kind=Kind.hinted)
    count_time = Component(Signal)


class DetWithConf(Device):
    a = Component(SynSignal, func=lambda: 1, kind=Kind.hinted)
    b = Component(SynSignal, func=lambda: 2, kind=Kind.hinted)
    c = Component(SynSignal, func=lambda: 3)
    d = Component(SynSignal, func=lambda: 4)
github bluesky / ophyd / ophyd / mca.py View on Github external
snl_connected = Cpt(EpicsSignal, 'SNL_Connected')

    # Copying to individual elements
    copy_adcp_ercent_rule = Cpt(EpicsSignal, 'CopyADCPercentRule')
    copy_baseline_cut_enable = Cpt(EpicsSignal, 'CopyBaselineCutEnable')
    copy_baseline_cut_percent = Cpt(EpicsSignal, 'CopyBaselineCutPercent')
    copy_baseline_filter_length = Cpt(EpicsSignal, 'CopyBaselineFilterLength')
    copy_baseline_threshold = Cpt(EpicsSignal, 'CopyBaselineThreshold')
    copy_decay_time = Cpt(EpicsSignal, 'CopyDecayTime')
    copy_detector_polarity = Cpt(EpicsSignal, 'CopyDetectorPolarity')
    copy_energy_threshold = Cpt(EpicsSignal, 'CopyEnergyThreshold')
    copy_gap_time = Cpt(EpicsSignal, 'CopyGapTime')
    copy_max_energy = Cpt(EpicsSignal, 'CopyMaxEnergy')
    copy_max_width = Cpt(EpicsSignal, 'CopyMaxWidth')
    copy_peaking_time = Cpt(EpicsSignal, 'CopyPeakingTime')
    copy_preamp_gain = Cpt(EpicsSignal, 'CopyPreampGain')
    copy_roic_hannel = Cpt(EpicsSignal, 'CopyROIChannel')
    copy_roie_nergy = Cpt(EpicsSignal, 'CopyROIEnergy')
    copy_roi_sca = Cpt(EpicsSignal, 'CopyROI_SCA')
    copy_reset_delay = Cpt(EpicsSignal, 'CopyResetDelay')
    copy_trigger_gap_time = Cpt(EpicsSignal, 'CopyTriggerGapTime')
    copy_trigger_peaking_time = Cpt(EpicsSignal, 'CopyTriggerPeakingTime')
    copy_trigger_threshold = Cpt(EpicsSignal, 'CopyTriggerThreshold')

    # do_* executes the process:
    do_read_all = Cpt(EpicsSignal, 'DoReadAll')
    do_read_baseline_histograms = Cpt(EpicsSignal, 'DoReadBaselineHistograms')
    do_read_traces = Cpt(EpicsSignal, 'DoReadTraces')
    do_status_all = Cpt(EpicsSignal, 'DoStatusAll')

    # Time
    dead_time = Cpt(EpicsSignal, 'DeadTime')
github bluesky / ophyd / ophyd / mca.py View on Github external
from collections import OrderedDict

from .signal import (Signal, EpicsSignal, EpicsSignalRO)
from .device import (Device, Component as Cpt, DynamicDeviceComponent as DDC,
                     BlueskyInterface, Kind)
from .areadetector import EpicsSignalWithRBV as SignalWithRBV


logger = logging.getLogger(__name__)


class ROI(Device):

    # 'name' is not an allowed attribute
    label = Cpt(EpicsSignal, 'NM', lazy=True)
    count = Cpt(EpicsSignalRO, '', lazy=True)
    net_count = Cpt(EpicsSignalRO, 'N', lazy=True)
    preset_count = Cpt(EpicsSignal, 'P', lazy=True)
    is_preset = Cpt(EpicsSignal, 'IP', lazy=True)
    bkgnd_chans = Cpt(EpicsSignal, 'BG', lazy=True)
    hi_chan = Cpt(EpicsSignal, 'HI', lazy=True)
    lo_chan = Cpt(EpicsSignal, 'LO', lazy=True)

    def __init__(self, prefix, *, read_attrs=None, configuration_attrs=None,
                 name=None, parent=None, **kwargs):

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


def add_rois(range_, **kwargs):
github bluesky / ophyd / ophyd / mca.py View on Github external
copy_max_energy = Cpt(EpicsSignal, 'CopyMaxEnergy')
    copy_max_width = Cpt(EpicsSignal, 'CopyMaxWidth')
    copy_peaking_time = Cpt(EpicsSignal, 'CopyPeakingTime')
    copy_preamp_gain = Cpt(EpicsSignal, 'CopyPreampGain')
    copy_roic_hannel = Cpt(EpicsSignal, 'CopyROIChannel')
    copy_roie_nergy = Cpt(EpicsSignal, 'CopyROIEnergy')
    copy_roi_sca = Cpt(EpicsSignal, 'CopyROI_SCA')
    copy_reset_delay = Cpt(EpicsSignal, 'CopyResetDelay')
    copy_trigger_gap_time = Cpt(EpicsSignal, 'CopyTriggerGapTime')
    copy_trigger_peaking_time = Cpt(EpicsSignal, 'CopyTriggerPeakingTime')
    copy_trigger_threshold = Cpt(EpicsSignal, 'CopyTriggerThreshold')

    # do_* executes the process:
    do_read_all = Cpt(EpicsSignal, 'DoReadAll')
    do_read_baseline_histograms = Cpt(EpicsSignal, 'DoReadBaselineHistograms')
    do_read_traces = Cpt(EpicsSignal, 'DoReadTraces')
    do_status_all = Cpt(EpicsSignal, 'DoStatusAll')

    # Time
    dead_time = Cpt(EpicsSignal, 'DeadTime')
    elapsed_live = Cpt(EpicsSignal, 'ElapsedLive')
    elapsed_real = Cpt(EpicsSignal, 'ElapsedReal')
    idead_time = Cpt(EpicsSignal, 'IDeadTime')

    # low-level
    read_low_level_params = Cpt(EpicsSignal, 'ReadLLParams')

    # Traces
    read_traces = Cpt(EpicsSignal, 'ReadTraces')
    trace_modes = Cpt(EpicsSignal, 'TraceModes', string=True)
    trace_times = Cpt(EpicsSignal, 'TraceTimes')
github bluesky / ophyd / ophyd / mca.py View on Github external
# Preset info
    preset_events = Cpt(EpicsSignal, 'PresetEvents')
    preset_live_time = Cpt(EpicsSignal, 'PresetLive')
    preset_real_time = Cpt(EpicsSignal, 'PresetReal')
    preset_mode = Cpt(EpicsSignal, 'PresetMode', string=True)
    preset_triggers = Cpt(EpicsSignal, 'PresetTriggers')

    # Acquisition
    erase_all = Cpt(EpicsSignal, 'EraseAll')
    erase_start = Cpt(EpicsSignal, 'EraseStart', trigger_value=1)
    start_all = Cpt(EpicsSignal, 'StartAll')
    stop_all = Cpt(EpicsSignal, 'StopAll')

    # Status
    set_acquire_busy = Cpt(EpicsSignal, 'SetAcquireBusy')
    acquire_busy = Cpt(EpicsSignal, 'AcquireBusy')
    status_all = Cpt(EpicsSignal, 'StatusAll')
    status_all_once = Cpt(EpicsSignal, 'StatusAllOnce')
    acquiring = Cpt(EpicsSignal, 'Acquiring')

    # Reading
    read_baseline_histograms = Cpt(EpicsSignal, 'ReadBaselineHistograms')
    read_all = Cpt(EpicsSignal, 'ReadAll')
    read_all_once = Cpt(EpicsSignal, 'ReadAllOnce')

    # As a debugging note, if snl_connected is not '1', your IOC is
    # misconfigured:
    snl_connected = Cpt(EpicsSignal, 'SNL_Connected')

    # Copying to individual elements
    copy_adcp_ercent_rule = Cpt(EpicsSignal, 'CopyADCPercentRule')
    copy_baseline_cut_enable = Cpt(EpicsSignal, 'CopyBaselineCutEnable')