id4_common.devices.scaler#

Scalers

Module Contents#

class id4_common.devices.scaler.LocalScalerChannel(prefix, ch_num, **kwargs)#

Bases: ophyd.scaler.ScalerChannel

ScalerChannel that defers match_name until after EPICS connection.

Why: the upstream ScalerChannel.__init__ calls match_name(), which does self.chname.get() and triggers an EPICS connection while the device is being instantiated. That breaks make_devices(connect=False) when the IOC is off, because guarneri’s loader fails before any of our deferred-connect logic gets a chance to run.

class id4_common.devices.scaler.PresetMonitorSignal(*args, **kwargs)#

Bases: ophyd.signal.Signal

Signal that control the selected monitor channel

get(**kwargs)#

Return the monitor preset converted to seconds for the time channel.

put(value, *, timestamp=None, force=False, metadata=None)#

Put updates the internal readback value.

The value is optionally checked first, depending on the value of force. In addition, VALUE subscriptions are run. Extra kwargs are ignored (for API compatibility with EpicsSignal kwargs pass through). :param value: Value to set :type value: any :param timestamp: The timestamp associated with the value, defaults to time.time() :type timestamp: float, optional :param metadata: Further associated metadata with the value (such as alarm status,

severity, etc.)

Parameters:

force (bool, optional) – Check the value prior to setting it, defaults to False

class id4_common.devices.scaler.LocalScalerCH(*args, **kwargs)#

Bases: id4_common.devices.counters_mixin.CountersMixin, ophyd.scaler.ScalerCH

ScalerCH subclass with a flexible monitor channel and plot/read channel selection.

channels#
preset_time = None#
preset_monitor#

Return the ophyd signal used to control scan count time.

Resolved by walking the dotted path in _preset_monitor_attr. Set that class attribute in subclasses instead of overriding this property.

freq#
property channels_name_map#

Return a dict mapping EPICS channel name strings to component attribute names.

select_plot_channels(chan_names=None)#

Set the Kind of each channel to hinted (in chan_names) or normal (others).

Pass chan_names=None (the default) to hint every named channel. Pass an empty list to hint no channel (all named channels are demoted to Kind.normal); used by CountersClass._apply_extra_read to clear stale hints.

select_read_channels(chan_names=None)#

Select channels based on the EPICS name PV.

Parameters:

chan_names (Iterable[str] or None) – The names (as reported by the channel.chname signal) of the channels to select. If None, select all channels named in the EPICS scaler.

property monitor#

Return the EPICS name of the currently selected monitor channel.

property plot_options#

Return a list of all named scaler channel names available for plotting.

select_plot(channels)#

Set the hinted kind for the given channels by delegating to select_plot_channels.

select_read(channels: list) None#

Mark the named channels as Kind.normal (read, not plotted).

Leaves other channels’ kinds untouched. Use select_plot_channels or select_read_channels for full configuration; this is the minimal hook used by CountersClass._apply_extra_read so a scaler channel can be added to the read list without becoming hinted.

property label_option_map: dict#

Identity map — scaler labels are already field names after match_names().

field_for_label(label)#

Return the ophyd field name for a plot-option label.

For scalers the label is already the field name after match_names().

default_settings()#

Set default monitor to chan01 and select all named read and plot channels.