GM vehicle telemetry systems receive fixed-width sensor readings continuously. Given a finite stream for evaluation, identify readings where at least one sensor value falls outside a rolling statistical bound computed from the preceding readings.
For each reading, calculate the mean and population standard deviation for every sensor using up to the previous window_size readings. A value is anomalous when it is strictly less than mean - z_threshold * standard_deviation or strictly greater than mean + z_threshold * standard_deviation. Do not classify readings until at least window_size previous readings are available. Evaluate a reading before adding it to the rolling window.
If a sensor's previous-window standard deviation is zero, classify a different current value as anomalous and the same value as normal.
Implement detect_anomalies(samples, window_size, z_threshold). samples is a nonempty list of equal-length numeric lists. Return a list of zero-based indices for readings that are anomalous in at least one dimension. The input is processed in chronological order.
def detect_anomalies(samples, window_size, z_threshold):