mqr.spc.rules.

limits#

mqr.spc.rules.limits()#

Rule monitoring when a process violates control limits.

This function is an alarm rule that triggers an alarm any time the statistic is outside the upper or lower control limits.

This is a rule and can be used directly in mqr.plot.spc.alarms or combine.

Returns:
Callable[(ControlStatistic, ControlParams), pandas.Series[bool]]

A function taking a control statistic and the params used to create them, and returning a series with True marking alarms.

Examples

This function can be passed directly to the plotting routines. This example overlays alarms on an X-bar chart.

data = pd.DataFrame({
    'Xbar': np.array([9, 10, 9, 13, 12, 10])
#                               ^^ (>UCL)
})

params = mqr.spc.XBarParams(centre=10, sigma=1)
stat = params.statistic(data)
rule = mqr.spc.rules.limits()

fig, ax = plt.subplots(figsize=(7, 3))
mqr.plot.spc.chart(stat, params, ax=ax)
mqr.plot.spc.alarms(stat, params, rule, ax=ax)

(Source code, png, pdf)

../../_images/mqr-spc-rules-limits-1.png