Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

holtWintersAbberation: list index out of range #211

Open
Dieterbe opened this issue Jan 19, 2017 · 0 comments
Open

holtWintersAbberation: list index out of range #211

Dieterbe opened this issue Jan 19, 2017 · 0 comments

Comments

@Dieterbe
Copy link
Contributor

Hi all, I have a series which renders fine, and all other holtwinters functions work fine
(see https://snapshot.raintank.io/dashboard/snapshot/fXMjSfEzZd4dwC0mO7LNTDM5CR3R1x7N)
but When I use holtWintersAbberation(<series>,3) (or pass 1 or 2 as arg, same outcome) I get the below:

Traceback (most recent call last):&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py&#34;, line 1988, in wsgi_app&#10;    response = self.full_dispatch_request()&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py&#34;, line 1641, in full_dispatch_request&#10;    rv = self.handle_user_exception(e)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py&#34;, line 1544, in handle_user_exception&#10;    reraise(exc_type, exc_value, tb)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py&#34;, line 1639, in full_dispatch_request&#10;    rv = self.dispatch_request()&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/flask/app.py&#34;, line 1625, in dispatch_request&#10;    return self.view_functions[rule.endpoint](**req.view_args)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/app.py&#34;, line 416, in render&#10;    series_list = evaluateTarget(context, target, data_store)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/evaluator.py&#34;, line 73, in evaluateTarget&#10;    result = evaluateTokens(requestContext, tokens, data_store)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/evaluator.py&#34;, line 105, in evaluateTokens&#10;    replacements)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/evaluator.py&#34;, line 139, in evaluateTokens&#10;    ret = func(requestContext, *args, **kwargs)&#10;  File &#34;/usr/share/python/graphite/local/lib/python2.7/site-packages/graphite_api/functions.py&#34;, line 2600, in holtWintersAberration&#10;    elif upperBand[i] is not None and series[i] &gt; upperBand[i]:&#10;IndexError: list index out of range&#10;
			

I have marked the offending line 2600 below:

def holtWintersAberration(requestContext, seriesList, delta=3):
    """
    Performs a Holt-Winters forecast using the series as input data and plots
    the positive or negative deviation of the series data from the forecast.
    """
    results = []
    for series in seriesList:
        confidenceBands = holtWintersConfidenceBands(requestContext, [series],
                                                     delta)
        lowerBand = confidenceBands[0]
        upperBand = confidenceBands[1]
        aberration = list()
        for i, actual in enumerate(series):
            if series[i] is None:
                aberration.append(0)
            elif upperBand[i] is not None and series[i] > upperBand[i]: <-- line 2600
                aberration.append(series[i] - upperBand[i])
            elif lowerBand[i] is not None and series[i] < lowerBand[i]:
                aberration.append(series[i] - lowerBand[i])
            else:
                aberration.append(0)

        newName = "holtWintersAberration(%s)" % series.name
        results.append(TimeSeries(newName, series.start, series.end,
                                  series.step, aberration))
    return results
	
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant