StatisticalTestShewhart

class StatisticalTestShewhart

Bases: StatisticalTestSigma

Class that permits a Shewhart’s test.

Be \(s(t)\) the signal to monitor, \(\mu\) and \(\sigma\) the mean and standard deviation of this signal when it is “in control”.

A downward alarm is raised if: \(s(t) >= \mu - 3 \sigma\)

An upward alarm is raised if: \(s(t) >= \mu + 3 \sigma\)

Additionnally, we can activate the WECO’s rules that have been proposed by the Western Electric Company to add additionnal verifications:

  • An alarm is raised if two out of three consecutive points fall beyond the \(2\sigma\) -limit, on the same side of the mean \(\mu\)

  • An alarm is raised if four out of five consecutive points fall beyond the \(1\sigma\) -limit, on the same side of the mean \(\mu\)

  • An alarm is raised if eight consecutive points fall on the same side of the mean \(\mu\) .

The user can decide to use or not the WECO’s rules. Additionnally, the user can choose which WECO’s rule(s) to activate.

To detect only downward drifts of the input signal \(s(t)\) use testDownwardMeanDrift() .To detect only upward drifts in \(s(t)\) use testUpwardMeanDrift() . To detect both, downward and upward drifts use testDownUpwardMeanDrift() .

Methods

__init__

getAlarm

Get the alarm raised by the last test due to the WECO's rules.

getSignal

Overloaded function.

getSignals

Get the NB_DATA_SIGNAL last signal values, sorted from the latest [0] to the newest [NB_DATA_SIGNAL - 1].

vpWecoRulesAlarmToString

Inherited Methods

testDownUpwardMeanDrift

Test if a downward or an upward mean drift occurred according to the new value of the signal.

MEAN_DRIFT_BOTH

getStdev

Get the standard deviation used as reference.

MEAN_DRIFT_NONE

testDownwardMeanDrift

Test if a downward mean drift occurred according to the new value of the signal.

MEAN_DRIFT_DOWNWARD

getLimits

Get the upper and lower limits of the test signal.

vpMeanDriftTypeFromString

Cast a string into a vpMeanDriftType .

MEAN_DRIFT_UNKNOWN

MeanDriftType

Enum that indicates if a drift of the mean occurred.

testUpwardMeanDrift

Test if an upward mean drift occurred according to the new value of the signal.

print

getAvailableMeanDriftType

Get the list of available vpMeanDriftType objects that are handled.

getMean

Get the mean used as reference.

setNbSamplesForStat

Set the number of samples required to compute the mean and standard deviation of the signal and allocate the memory accordingly.

MEAN_DRIFT_COUNT

setMinStdev

Set the minimum value of the standard deviation that is expected.

MEAN_DRIFT_UPWARD

vpMeanDriftTypeToString

init

Overloaded function.

Operators

__doc__

__init__

__module__

Attributes

COUNT_WECO

MEAN_DRIFT_BOTH

MEAN_DRIFT_COUNT

MEAN_DRIFT_DOWNWARD

MEAN_DRIFT_NONE

MEAN_DRIFT_UNKNOWN

MEAN_DRIFT_UPWARD

NB_DATA_SIGNAL

NONE_WECO

ONE_SIGMA_WECO

SAME_SIDE_WECO

THREE_SIGMA_WECO

TWO_SIGMA_WECO

__annotations__

class MeanDriftType(self, value: int)

Bases: pybind11_object

Enum that indicates if a drift of the mean occurred.

Values:

  • MEAN_DRIFT_NONE: No mean drift occurred

  • MEAN_DRIFT_DOWNWARD: A downward drift of the mean occurred.

  • MEAN_DRIFT_UPWARD: An upward drift of the mean occurred.

  • MEAN_DRIFT_BOTH: Both an aupward and a downward drifts occurred.

  • MEAN_DRIFT_COUNT

  • MEAN_DRIFT_UNKNOWN

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class WecoRulesAlarm(self, value: int)

Bases: pybind11_object

Values:

  • THREE_SIGMA_WECO: When a \(3\sigma\) alarm was raised.

  • TWO_SIGMA_WECO: When a \(2\sigma\) alarm was raised.

  • ONE_SIGMA_WECO: When a \(1\sigma\) alarm was raised

  • SAME_SIDE_WECO: When a alarm raised when 8 consecutive points lie on the same side of the mean \(\mu\) was raised.

  • NONE_WECO: When no WECO’s rule alarm was raised.

  • COUNT_WECO: Number of WECO’s rules that are implemented.

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
__init__(*args, **kwargs)
getAlarm(self) visp._visp.core.StatisticalTestShewhart.WecoRulesAlarm

Get the alarm raised by the last test due to the WECO’s rules.

Returns:

vpWecoRulesAlarm The type of raised alarm.

static getAvailableMeanDriftType(prefix: str = <, sep: str =, suffix: str = >) str

Get the list of available vpMeanDriftType objects that are handled.

Parameters:
prefix

The prefix that should be placed before the list.

sep

The separator between each element of the list.

suffix

The suffix that should terminate the list.

Returns:

std::string The list of handled type of process tests, presented as a string.

getLimits(self, limitDown: float, limitUp: float) tuple[float, float]

Get the upper and lower limits of the test signal.

Parameters:
limitDown: float

The lower limit.

limitUp: float

The upper limit.

Returns:

A tuple containing:

  • limitDown: The lower limit.

  • limitUp: The upper limit.

getMean(self) float

Get the mean used as reference.

Returns:

float The mean.

getSignal(*args, **kwargs)

Overloaded function.

  1. getSignal(self: visp._visp.core.StatisticalTestShewhart) -> float

Get the last value of the signal.

Returns:

float The signal.

  1. getSignal(self: visp._visp.core.StatisticalTestSigma) -> float

Get the last value of the signal.

Returns:

float The signal.

getSignals(self) list[float]

Get the NB_DATA_SIGNAL last signal values, sorted from the latest [0] to the newest [NB_DATA_SIGNAL - 1].

Returns:

std::vector<float> The last NB_DATA_SIGNAL values.

getStdev(self) float

Get the standard deviation used as reference.

Returns:

float The standard deviation.

init(*args, **kwargs)

Overloaded function.

  1. init(self: visp._visp.core.StatisticalTestSigma, h: float = 3.f, nbSamplesForStats: int = 30) -> None

(Re)Initialize the test.

Parameters:
h

The alarm factor applied to the standard deviation to compute the limits.

nbSamplesForStats

The number of samples to compute the statistics of the signal.

  1. init(self: visp._visp.core.StatisticalTestSigma, h: float, mean: float, stdev: float) -> None

(Re)Initialize the test.

Parameters:
h

The alarm factor applied to the standard deviation to compute the limits.

mean

The expected mean of the signal.

stdev

The expected standard deviation of the signal.

  1. init(self: visp._visp.core.StatisticalTestAbstract) -> None

(Re)Initialize the algorithm.

static print(type: visp._visp.core.StatisticalTestAbstract.MeanDriftType) None
setMinStdev(self, stdevmin: float) None

Set the minimum value of the standard deviation that is expected. The computed standard deviation cannot be lower this value if set.

Parameters:
stdevmin: float

The minimum value of the standard deviation that is expected.

setNbSamplesForStat(self, nbSamples: int) None

Set the number of samples required to compute the mean and standard deviation of the signal and allocate the memory accordingly.

Parameters:
nbSamples: int

The number of samples we want to use.

testDownUpwardMeanDrift(self, signal: float) visp._visp.core.StatisticalTestAbstract.MeanDriftType

Test if a downward or an upward mean drift occurred according to the new value of the signal.

Note

See testDownwardMeanDrift() testUpwardMeanDrift()

Parameters:
signal: float

The new value of the signal.

Returns:

vpMeanDriftType The type of mean drift that occurred.

testDownwardMeanDrift(self, signal: float) visp._visp.core.StatisticalTestAbstract.MeanDriftType

Test if a downward mean drift occurred according to the new value of the signal.

Note

See testUpwardMeanDrift()

Parameters:
signal: float

The new value of the signal.

Returns:

vpMeanDriftType The type of mean drift that occurred.

testUpwardMeanDrift(self, signal: float) visp._visp.core.StatisticalTestAbstract.MeanDriftType

Test if an upward mean drift occurred according to the new value of the signal.

Note

See testDownwardMeanDrift()

Parameters:
signal: float

The new value of the signal.

Returns:

vpMeanDriftType The type of mean drift that occurred.

static vpMeanDriftTypeFromString(name: str) visp._visp.core.StatisticalTestAbstract.MeanDriftType

Cast a string into a vpMeanDriftType .

Parameters:
name: str

The name of the mean drift.

Returns:

vpMeanDriftType The corresponding vpMeanDriftType .

static vpMeanDriftTypeToString(type: visp._visp.core.StatisticalTestAbstract.MeanDriftType) str
static vpWecoRulesAlarmToString(alarm: visp._visp.core.StatisticalTestShewhart.WecoRulesAlarm) str