From 2ed883864cb1a9061603f35d5ad29210048f2fd3 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 1 Jun 2010 12:50:16 -0400 Subject: [PATCH] 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. --- hooke/plugin/flatfilt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.26.2