StatisticalTestMeanAdjustedCUSUM¶
- class StatisticalTestMeanAdjustedCUSUM(self: visp._visp.core.StatisticalTestMeanAdjustedCUSUM, h: float = 4.f, k: float = 1.f, nbPtsForStats: int = 30)¶
Bases:
StatisticalTestAbstract
Class that permits to perform a mean adjusted Cumulative Sum test.
The mean adjusted CUSUM test is designed to detect drift in the mean \(\mu\) of an observed signal \(s(t)\) .
Be \(\delta\) the amplitude of the mean drift we want to detect. Two test signals are computed at each iteration:
\(S_-(t) = max\{0, S_-(t-1) - (s(t) - \mu) - \frac{\delta}{2}\}\)
\(S_+(t) = max\{0, S_+(t-1) + (s(t) - \mu) - \frac{\delta}{2}\}\)
A downward alarm is raised if: \(S_-(t) >= thresh\)
An upward alarm is raised if: \(S_+(t) >= thresh\)
To ease the understanding of the detection threshold \(\delta\) and the alarm threshold \(thresh\) , ViSP implemented these two thresholds as a multiple of the standard deviation of the signal \(\sigma\) :
\(\delta = k \sigma , k \in R^{+*}\)
\(thresh = h \sigma , h \in R^{+*}\)
To have an Average Run Lenght of ~374 samples for a detection threshold \(\delta\) of 1 standard deviation \(\sigma\) , set \(h\) to 4.76 .
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() .
Construct a new vpStatisticalTestMeanAdjustedCUSUM object.
- Parameters:
- h
The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal.
- k
The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal.
- nbPtsForStats
The number of samples to use to compute the mean and the standard deviation of the signal to monitor.
Methods
Construct a new vpStatisticalTestMeanAdjustedCUSUM object.
Get the slack of the CUSUM test, i.e. amplitude of mean shift we want to be able to detect.
Get the alarm factor.
Get the detection factor.
Get the latest value of the test signal for downward jumps of the mean.
Get the latest value of the test signal for upward jumps of the mean.
Overloaded function.
Set the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect.
Set the upward and downward jump limits.
Inherited Methods
Cast a string into a vpMeanDriftType .
Enum that indicates if a drift of the mean occurred.
Get the upper and lower limits of the test signal.
Test if a downward or an upward mean drift occurred according to the new value of the signal.
Get the mean used as reference.
Test if a downward mean drift occurred according to the new value of the signal.
MEAN_DRIFT_COUNT
Get the standard deviation used as reference.
Test if an upward mean drift occurred according to the new value of the signal.
MEAN_DRIFT_NONE
Get the list of available vpMeanDriftType objects that are handled.
MEAN_DRIFT_DOWNWARD
Set the minimum value of the standard deviation that is expected.
MEAN_DRIFT_UNKNOWN
MEAN_DRIFT_UPWARD
Set the number of samples required to compute the mean and standard deviation of the signal and allocate the memory accordingly.
MEAN_DRIFT_BOTH
Operators
__doc__
Construct a new vpStatisticalTestMeanAdjustedCUSUM object.
__module__
Attributes
MEAN_DRIFT_BOTH
MEAN_DRIFT_COUNT
MEAN_DRIFT_DOWNWARD
MEAN_DRIFT_NONE
MEAN_DRIFT_UNKNOWN
MEAN_DRIFT_UPWARD
__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
- __init__(self: visp._visp.core.StatisticalTestMeanAdjustedCUSUM, h: float = 4.f, k: float = 1.f, nbPtsForStats: int = 30)¶
Construct a new vpStatisticalTestMeanAdjustedCUSUM object.
- Parameters:
- h
The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal.
- k
The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal.
- nbPtsForStats
The number of samples to use to compute the mean and the standard deviation of the signal to monitor.
- 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.
- getDelta(self) float ¶
Get the slack of the CUSUM test, i.e. amplitude of mean shift we want to be able to detect.
- Returns:
float The slack of the CUSUM test.
- getLimits(self, limitDown: float, limitUp: float) tuple[float, float] ¶
Get the upper and lower limits of the test signal.
- getStdev(self) float ¶
Get the standard deviation used as reference.
- Returns:
float The standard deviation.
- getTestSignalMinus(self) float ¶
Get the latest value of the test signal for downward jumps of the mean.
- Returns:
float Its latest value.
- getTestSignalPlus(self) float ¶
Get the latest value of the test signal for upward jumps of the mean.
- Returns:
float Its latest value.
- init(*args, **kwargs)¶
Overloaded function.
init(self: visp._visp.core.StatisticalTestMeanAdjustedCUSUM, h: float, k: float, nbPtsForStats: int) -> None
(Re)Initialize the mean adjusted CUSUM test.
- Parameters:
- h
The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal.
- k
The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal.
- nbPtsForStats
The number of points to use to compute the mean and the standard deviation of the signal
init(self: visp._visp.core.StatisticalTestMeanAdjustedCUSUM, delta: float, limitDown: float, limitUp: float, nbPtsForStats: int) -> None
Initialize the mean adjusted CUSUM test.
- Parameters:
- delta
The slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect.
- limitDown
The lower limit of the CUSUM test, for the downward jumps.
- limitUp
The upper limit of the CUSUM test, for the upward jumps.
- nbPtsForStats
The number of points to use to compute the mean and the standard deviation of the signal to monitor.
init(self: visp._visp.core.StatisticalTestMeanAdjustedCUSUM, h: float, k: float, mean: float, stdev: float) -> None
Initialize the mean adjusted CUSUM test.
- Parameters:
- h
The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal.
- k
The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal.
- mean
The expected mean of the signal to monitor.
- stdev
The expected standard deviation of the signal to monitor.
init(self: visp._visp.core.StatisticalTestMeanAdjustedCUSUM, delta: float, limitDown: float, limitUp: float, mean: float, stdev: float) -> None
Initialize the mean adjusted CUSUM test.
- Parameters:
- delta
The slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect.
- limitDown
The lower limit of the CUSUM test, for the downward jumps.
- limitUp
The upper limit of the CUSUM test, for the upward jumps.
- mean
The expected mean of the signal to monitor.
- stdev
The expected standard deviation of the signal to monitor.
init(self: visp._visp.core.StatisticalTestAbstract) -> None
(Re)Initialize the algorithm.
- static print(type: visp._visp.core.StatisticalTestAbstract.MeanDriftType) None ¶
- setDelta(self, delta: float) None ¶
Set the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect.
- 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.
- 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.
- 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()
- 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()
- 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()
- static vpMeanDriftTypeFromString(name: str) visp._visp.core.StatisticalTestAbstract.MeanDriftType ¶
Cast a string into a vpMeanDriftType .
- static vpMeanDriftTypeToString(type: visp._visp.core.StatisticalTestAbstract.MeanDriftType) str ¶