atef.check.Range

class atef.check.Range(name: str | None = None, description: str | None = None, invert: bool = False, reduce_period: int | float | None = None, reduce_method: ReduceMethod = ReduceMethod.average, string: bool | None = None, severity_on_failure: Severity = Severity.error, if_disconnected: Severity = Severity.error, low: int | float = 0, low_dynamic: DynamicValue | None = None, high: int | float = 0, high_dynamic: DynamicValue | None = None, warn_low: int | float | None = None, warn_low_dynamic: DynamicValue | None = None, warn_high: int | float | None = None, warn_high_dynamic: DynamicValue | None = None, inclusive: bool = True)[source]

A range comparison.

Attributes:
description
high_dynamic
low_dynamic
name
ranges
reduce_period
string
warn_high
warn_high_dynamic
warn_low
warn_low_dynamic

Methods

__call__(value)

Run the comparison against value.

compare(value[, identifier])

Compare the provided value using the comparator's settings.

describe()

Human-readable description of the comparison operation itself.

get_data_for_signal(signal)

Get data for the given signal, according to the string and data reduction settings.

get_data_for_signal_async(signal, *[, executor])

Get data for the given signal, according to the string and data reduction settings.

prepare([cache])

Prepare this comparison's value data.

Notes

If the following inequality holds, the range comparison will succeed:

low < value < high (inclusive=False) low <= value <= high (inclusive=True)

Additionally, warning levels may be specified. These should be configured such that:

low <= warn_low <= warn_high <= high

With these warning levels configured, a warning will be raised when the value falls within the following ranges. For inclusive=False:

low < value < warn_low
warn_high < value < high

or, when inclusive=True:

low <= value <= warn_low warn_high <= value <= high

Methods

__init__(name: str | None = None, description: str | None = None, invert: bool = False, reduce_period: int | float | None = None, reduce_method: ReduceMethod = ReduceMethod.average, string: bool | None = None, severity_on_failure: Severity = Severity.error, if_disconnected: Severity = Severity.error, low: int | float = 0, low_dynamic: DynamicValue | None = None, high: int | float = 0, high_dynamic: DynamicValue | None = None, warn_low: int | float | None = None, warn_low_dynamic: DynamicValue | None = None, warn_high: int | float | None = None, warn_high_dynamic: DynamicValue | None = None, inclusive: bool = True) None
compare(value: Any, identifier: str | None = None) Result

Compare the provided value using the comparator’s settings.

Parameters:
value

The value to compare.

identifierstr, optional

An identifier that goes along with the provided value. Used for severity result descriptions.

describe() str[source]

Human-readable description of the comparison operation itself.

To be implemented by subclass.

get_data_for_signal(signal: Signal) Any

Get data for the given signal, according to the string and data reduction settings.

Parameters:
signalophyd.Signal

The signal.

Returns:
Any

The acquired data.

Raises:
TimeoutError

If the get operation times out.

async get_data_for_signal_async(signal: Signal, *, executor: Executor | None = None) Any

Get data for the given signal, according to the string and data reduction settings.

Parameters:
signalophyd.Signal

The signal.

executorconcurrent.futures.Executor, optional

The executor to run the synchronous call in. Defaults to the loop-defined default executor.

Returns:
Any

The acquired data.

Raises:
TimeoutError

If the get operation times out.

async prepare(cache: DataCache | None = None) None[source]

Prepare this comparison’s value data. If a value_dynamic is specified, prepare its data. Prepares the high/low limits along with dynamic high/low warning values if they exist

Parameters:
cacheDataCache, optional

The data cache instance, if available.

Attributes

description: str | None = None

Description tied to this comparison.

high: int | float = 0

The high end of the range, which must be >= low.

high_dynamic: DynamicValue | None = None
if_disconnected: Severity = 2

If disconnected and unable to perform the comparison, set this result severity.

inclusive: bool = True

Should the low and high values be included in the range?

invert: bool = False

Invert the comparison’s result. Normally, a valid comparison - that is, one that evaluates to True - is considered successful. When invert is set, such a comparison would be considered a failure.

low: int | float = 0

The low end of the range, which must be <= high.

low_dynamic: DynamicValue | None = None
name: str | None = None
ranges
reduce_method: ReduceMethod = 'average'

Reduce collected samples by this reduce method.

reduce_period: int | float | None = None

Period over which the comparison will occur, where multiple samples may be acquired prior to a result being available.

severity_on_failure: Severity = 2

If the comparison fails, use this result severity.

string: bool | None = None

If applicable, request and compare string values rather than the default specified.

warn_high: int | float | None = None

The high end of the warning range, which must be >= warn_low.

warn_high_dynamic: DynamicValue | None = None
warn_low: int | float | None = None

The low end of the warning range, which must be <= warn_high.

warn_low_dynamic: DynamicValue | None = None