The stability module

Classes to monitor stability in some value.

Classes

StabilityTrend

class src.tools.stability.StabilityTrend(bufferSize, tolerance, timeout=None)[source]

A class for tracking stability based on trend.

Parameters :

bufferSize : int

The number of data points of which to keep track.

tolerance : float

The maximum deviation from zero which the slope can have while still being considered stable.

timeout : float

The maximum amount of time to monitor the system.

Methods

addPoint(value)[source]

Add a point to the monitor.

Parameters :

value : float

The value to add to the monitor.

getTrend()[source]

Return the slope of the line formed by the data.

Returns :

float :

The slope of the line formed by the data.

isBufferFull()[source]

Return whether the buffer is full.

Returns :

bool :

Whether the monitor’s buffer has been filled.

isFinished()[source]

Return whether the wait for stability can end.

Returns :

bool :

Whether the software can proceed, meaning either that the buffer is full and the system is stable or that the monitor has timed out.

isStable()[source]

Return whether the system is stable.

Returns :

bool :

Whether the system is stable.

isTimedOut()[source]

Return whether the monitor has timed out.

Returns :

bool :

Whether the system has passed the timeout.

StabilitySetpoint

class src.tools.stability.StabilitySetpoint(bufferSize, setpoint, tolerance, timeout=None)[source]

A class for tracking stability based on proximity to a setpoint.

Parameters :

bufferSize : int

The number of data points of which to keep track.

setpoint : float

The desired value for the system values.

tolerance : float

The maximum deviation from zero which the slope can have while still being considered stable.

timeout : float

The maximum amount of time to monitor the system.

Methods

addPoint(value)[source]

Add a point to the monitor.

Parameters :

value : float

The value to add to the monitor.

getTrend()[source]

Return the slope of the line formed by the data.

Returns :

float :

The slope of the line formed by the data.

isBufferFull()[source]

Return whether the buffer is full.

Returns :

bool :

Whether the monitor’s buffer has been filled.

isFinished()[source]

Return whether the wait for stability can end.

Returns :

bool :

Whether the software can proceed, meaning either that the buffer is full and the system is stable or that the monitor has timed out.

isStable()[source]

Return whether the system is stable.

Returns :

bool :

Whether the system is stable.

isTimedOut()[source]

Return whether the monitor has timed out.

Returns :

bool :

Whether the system has passed the timeout.

StabilityTimer

class src.tools.stability.StabilityTimer(duration, stability, timeout=None)[source]

A timer for checking for stability.

Parameters :

duration : float

The time in seconds over which the values should be stable before the timer asserts that it is finished.

stability : float

The largest separation between the maximum and minimum known values for which the timer may consider itself to be stable.

timeout : float

The maximum time in seconds to wait for the values to become stable.

Methods

addValue(newValue)[source]

Associate a new value with the timer.

Parameters :

newValue : float

The value to add to the timer.

getStableTime()[source]

Return how long the timer has been stable.

Returns :

float :

How long the values associated with the timer have been close enough to be considered stable. If the values are not stable, return -1.

getStats()[source]

Return the maximum and minimum values and the slope of the line.

Note that whenever a new value is added to the timer, if the new value is outside the stability range defined by previous values, the arrays are cleared and the maximum and minimum values are both set to the newly added value.

Returns :

float :

The maximum known value.

float :

The minimum known value.

float :

The slope of the line formed by the known values and the times at which the respective values were added, in units/s.

isFinished()[source]

Return whether the desired conditions have been met.

Returns :

bool :

Whether the desired conditions have been met. Return True if either the timeout has elapsed or the value has remained stable for the specified length of time. Otherwise, return False.

isStable()[source]

Return whether the values are stable.

Returns :

bool :

Whether the values associated with the specified timer are close enough to be considered stable.

isTimeoutElapsed()[source]

Return whether the timer has timed out.

Returns :

bool :

Whether the timer has timed out.

BufferedStabilityTimer

class src.tools.stability.BufferedStabilityTimer(stability, bufferSize, timeout=None)[source]

A timer for checking for stability, which keeps only new points.

Parameters :

stability : float

The largest separation between the maximum and minimum known values for which the timer may consider itself to be stable.

bufferSize : int

The maximum number of points to keep at any given time.

timeout : float

The maximum time in seconds to wait for the values to become stable.

Methods

addValue(newValue)[source]

Associate a new value with the timer.

Parameters :

newValue : float

The value to add to the timer.

getStats()[source]

Return the maximum and minimum values and the slope of the line.

Note that whenever a new value is added to the timer, if the new value is outside the stability range defined by previous values, the arrays are cleared and the maximum and minimum values are both set to the newly added value.

Returns :

float :

The maximum known value.

float :

The minimum known value.

float :

The slope of the line formed by the known values and the times at which the respective values were added, in units/s.

isBufferFull()[source]

Return whether the buffer is full.

Returns :

bool :

Whether the buffer is full.

isFinished()[source]

Return whether the desired conditions have been met.

Returns :

bool :

Whether the desired conditions have been met. Return True if either the timeout has elapsed or the value has remained stable for the specified length of time. Otherwise, return False.

isStable()[source]

Return whether the values are stable.

Returns :

bool :

Whether the values associated with the specified timer are close enough to be considered stable.

isTimeoutElapsed()[source]

Return whether the timer has timed out.

Returns :

bool :

Whether the timer has timed out.

Table Of Contents

Previous topic

The parsing module

Next topic

The general module

This Page