X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fnew%2Futils.py;h=a688928cda22d96142f3d43ac5a744a41de7f7d9;hp=83f4f6249b9d78fb2a9a6055ebb629d2fd01d790;hb=0e8d8a59fd6b8477b17a9222a5cfb0d94d24ff22;hpb=6928c2b1620e5d020a19e944f416df6a1f4b85ad diff --git a/resources/tools/presentation/new/utils.py b/resources/tools/presentation/new/utils.py index 83f4f6249b..a688928cda 100644 --- a/resources/tools/presentation/new/utils.py +++ b/resources/tools/presentation/new/utils.py @@ -211,17 +211,19 @@ def archive_input_data(spec): def classify_anomalies(data): """Process the data and return anomalies and trending values. - Gathers data into groups with common trend value. - Decorates first value in the group to be an outlier, regression, - normal or progression. + Gather data into groups with average as trend value. + Decorate values within groups to be normal, + the first value of changed average as a regression, or a progression. :param data: Full data set with unavailable samples replaced by nan. :type data: pandas.Series :returns: Classification and trend values :rtype: 2-tuple, list of strings and list of floats """ - bare_data = [sample for _, sample in data.iteritems() - if not np.isnan(sample)] + # Nan mean something went wrong. + # Use 0.0 to cause that being reported as a severe regression. + bare_data = [0.0 if np.isnan(sample) else sample + for _, sample in data.iteritems()] # TODO: Put analogous iterator into jumpavg library. groups = BitCountingClassifier.classify(bare_data) groups.reverse() # Just to use .pop() for FIFO.