From: W. Trevor King Date: Tue, 1 Jun 2010 16:50:16 +0000 (-0400) Subject: Don't die when flat-filtering curves shorter than blind window. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2ed883864cb1a9061603f35d5ad29210048f2fd3;p=hooke.git Don't die when flat-filtering curves shorter than blind window. This will probably only happen if the user uses an absurdly large blind window by mistake, but that shouldn't crash Hooke. --- diff --git a/hooke/plugin/flatfilt.py b/hooke/plugin/flatfilt.py index 6637eb8..1a49972 100644 --- a/hooke/plugin/flatfilt.py +++ b/hooke/plugin/flatfilt.py @@ -123,7 +123,8 @@ class FlatPeaksCommand (Command): def _run(self, hooke, inqueue, outqueue, params): z_data,d_data,params = self._setup(params) start_index = 0 - while z_data[start_index] < params['blind window']: + while (start_index < len(z_data) + and z_data[start_index] < params['blind window']): start_index += 1 median = medfilt(d_data[start_index:], params['median window']) deriv = diff(median)