-def _evaluate_results(trimmed_data, window=10):
- """Evaluates if the sample value is regress, normal or progress compared to
- previous data within the window.
- We use the intervals defined as:
- - regress: less than trimmed moving median - 3 * stdev
- - normal: between trimmed moving median - 3 * stdev and median + 3 * stdev
- - progress: more than trimmed moving median + 3 * stdev
- where stdev is trimmed moving standard deviation.
-
- :param trimmed_data: Full data set with the outliers replaced by nan.
- :param window: Window size used to calculate moving average and moving stdev.
- :type trimmed_data: pandas.Series
- :type window: int
- :returns: Evaluated results.
- :rtype: list
- """
-
- if len(trimmed_data) > 2:
- win_size = trimmed_data.size if trimmed_data.size < window else window
- results = [0.66, ]
- tmm = trimmed_data.rolling(window=win_size, min_periods=2).median()
- tmstd = trimmed_data.rolling(window=win_size, min_periods=2).std()
-
- first = True
- for build_nr, value in trimmed_data.iteritems():
- if first:
- first = False
- continue
- if (np.isnan(value)
- or np.isnan(tmm[build_nr])
- or np.isnan(tmstd[build_nr])):
- results.append(0.0)
- elif value < (tmm[build_nr] - 3 * tmstd[build_nr]):
- results.append(0.33)
- elif value > (tmm[build_nr] + 3 * tmstd[build_nr]):
- results.append(1.0)
- else:
- results.append(0.66)
- else:
- results = [0.0, ]
- try:
- tmm = np.median(trimmed_data)
- tmstd = np.std(trimmed_data)
- if trimmed_data.values[-1] < (tmm - 3 * tmstd):
- results.append(0.33)
- elif (tmm - 3 * tmstd) <= trimmed_data.values[-1] <= (
- tmm + 3 * tmstd):
- results.append(0.66)
- else:
- results.append(1.0)
- except TypeError:
- results.append(None)
- return results
-
-
-def _generate_trending_traces(in_data, build_info, moving_win_size=10,