atef.check.AnyComparison

class atef.check.AnyComparison(name: str | None = None, description: str | None = None, invert: bool = False, reduce_period: int | float | None = None, reduce_method: ~atef.reduce.ReduceMethod = ReduceMethod.average, string: bool | None = None, severity_on_failure: ~atef.enums.Severity = Severity.error, if_disconnected: ~atef.enums.Severity = Severity.error, comparisons: ~typing.List[~atef.check.Comparison] = <factory>)[source]

Comparison passes if any contained comparison passes.

Attributes:
description
name
reduce_period
string

Methods

__call__(value)

Run the comparison against value.

children()

Return children of this group, as a tree view might expect

compare(value[, identifier])

Compare the provided value using the comparator's settings.

describe()

Describe the comparison in words.

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.

replace_comparison(old_comp, new_comp)

Replace old_comp with new_comp in this dataclass.

Methods

__init__(name: str | None = None, description: str | None = None, invert: bool = False, reduce_period: int | float | None = None, reduce_method: ~atef.reduce.ReduceMethod = ReduceMethod.average, string: bool | None = None, severity_on_failure: ~atef.enums.Severity = Severity.error, if_disconnected: ~atef.enums.Severity = Severity.error, comparisons: ~typing.List[~atef.check.Comparison] = <factory>) None
children() List[Comparison][source]

Return children of this group, as a tree view might expect

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]

Describe the comparison in words.

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. Prepares all comparisons contained in this comparison.

Parameters:
cacheDataCache, optional

The data cache instance, if available.

replace_comparison(old_comp: Comparison, new_comp: Comparison) None[source]

Replace old_comp with new_comp in this dataclass. A common method for all dataclasses that hold comparisons.

Parameters:
old_compComparison

Comparsion to replace

new_compComparison

Comparison to replace old_comp with

Attributes

description: str | None = None

Description tied to this comparison.

if_disconnected: Severity = 2

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

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.

name: str | None = None
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.

comparisons: List[Comparison]