A robot actuator endurance test can end because the fixture reaches its planned cutoff or because the actuator reaches the failure criterion. Both outcomes give useful information about operating time. A run that stops while the actuator is still operating contributes a lower bound on its time to failure. Record it as right-censored at its last confirmed operating time. The status flag determines how the run contributes to an estimated survival curve.
Work through five synthetic runs
Two actuators fail at 2 and 4 hours. Three other units are still working when observation ends at 3, 5, and 6 hours. At hour 2, five units are being followed and one fails, so the estimated survival falls from 1 to 4/5. At hour 3, a unit leaves observation without a failure. That changes how many units are followed at the next event. At hour 4, three units are still being followed and one fails, so the estimate is multiplied by 2/3.
import numpy as np
from scipy.stats import CensoredData, ecdf
runs = CensoredData(
uncensored=[2.0, 4.0], right=[3.0, 5.0, 6.0]
)
survival = ecdf(runs).sf
hours = [2, 3, 4, 5, 6]
expected = [4/5, 4/5, 8/15, 8/15, 8/15]
np.testing.assert_allclose(survival.evaluate(hours), expected)
The fixture returned 0.8 at hours 2 and 3, then about 0.5333 at hours 4 through 6. The two later observation cutoffs leave the estimate unchanged. They also leave no units under observation after hour 6, so the flat tail has limited support. In this dataset the curve never reaches 0.5 during the observation period, and a median time to failure cannot be read from it.
Keep the cutoff reason in the log
Save the failure criterion, duration, event flag, and reason observation ended for each unit. A planned cutoff can be straightforward to classify. A test stopped in response to rising temperature or worsening noise deserves review because the reason for the stop may be related to the risk of failure. In a chart, use marks for observation cutoffs and show the number of units still followed alongside the curve.
SciPy uses the Kaplan-Meier estimator for right-censored data in ecdf. The NIST engineering handbook describes the same calculation using the number of units still operating just before each failure. A five-run fixture is enough to test that the reporting pipeline preserves those denominators when importing bench records.
Sources
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ecdf.html
https://www.itl.nist.gov/div898/handbook/apr/section2/apr215.htm