From 04ae64a47238d395bedbe0ac1c5c6449d4e53a95 Mon Sep 17 00:00:00 2001 From: csrichter Date: Mon, 5 Dec 2016 18:02:33 +0100 Subject: [PATCH] max_freq: fixed indexerror if max_indices array empty --- python/max_freq.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/max_freq.py b/python/max_freq.py index 144c228..033c0a3 100644 --- a/python/max_freq.py +++ b/python/max_freq.py @@ -63,9 +63,10 @@ class max_freq(gr.sync_block): #max_indices=[[421, 428, 429, 430, 431, 432, 433, 434, 436, 437, 438, 831, 832, 837, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851,852, 853, 854, 855, 856, 857]] max_indices=np.where(numbers>threshold) station_indices=[] - - last_index=max_indices[0][0] - #last_index=0 + try: + last_index=max_indices[0][0] + except IndexError: + last_index=0 count=1#counts number of consecutive maximums threshold_reached=False