From 1ceb347602a35e26ae29bf44ed53554d076925cb Mon Sep 17 00:00:00 2001 From: Darius Arnold Date: Sat, 26 Aug 2017 17:26:35 +0200 Subject: [PATCH] [bugfix] avoid indexing an empty array when there are no NaNs at start of CF --- pylot/core/pick/charfuns.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylot/core/pick/charfuns.py b/pylot/core/pick/charfuns.py index 7cf16708..a6fb5841 100644 --- a/pylot/core/pick/charfuns.py +++ b/pylot/core/pick/charfuns.py @@ -299,8 +299,9 @@ class HOScf(CharacteristicFunction): # remove NaN's with first not-NaN-value, # so autopicker doesnt pick discontinuity at start of the trace ind = np.where(~np.isnan(LTA))[0] - first = ind[0] - LTA[:first] = LTA[first] + if ind.size: + first = ind[0] + LTA[:first] = LTA[first] self.cf = LTA self.xcf = x