Index: fact/tools/pyscripts/pyfact/drs_spikes.py
===================================================================
--- fact/tools/pyscripts/pyfact/drs_spikes.py	(revision 13012)
+++ fact/tools/pyscripts/pyfact/drs_spikes.py	(revision 13014)
@@ -17,5 +17,5 @@
     """
     
-    def __init__(self, threshold=10., 
+    def __init__(self, threshold=7., 
                  single_pattern=np.array( [-0.5, 1.0, -0.5]) ,
                  double_pattern=np.array([-1., 1., 1., -1.]), 
@@ -42,22 +42,25 @@
         doubles = []
 
-        cc = candidates = np.where(a > self.threshold)
-        print 'candidates: ', candidates[0]-1
+        # a spike in the first or last channel is considered as a filter artefact
+        candidates = np.where(a[1:-2] > self.threshold)
+        # candidates = np.where(a[1:1022] > self.threshold)
+        cc = candidates[0]
+        #print 'cc: ', cc
         #: find single spikes
         p = self.single_pattern * np.sign( self.single_pattern )
-        for i, can in enumerate( zip(a[cc[0]-1], a[cc[0]], a[cc[0]+1]) ):
-            print 'can : p', can, p
+        for i, can in enumerate( zip(a[cc], a[cc+1], a[cc+2]) ):
+            #print 'can : p', can, p
             can = can * np.sign(self.single_pattern)
             if all(can > p):
-                singles.append(candidates[0][i] - 1)
+                singles.append(cc[i])
 
         #: find double spikes
         p = self.double_pattern * np.sign( self.double_pattern )
-        for i, can in enumerate( zip(a[cc[0]-1], a[cc[0]], 
-                                     a[cc[0]+1], a[cc[0]+2]) ):
-            print 'can : p', can, p
+        for i, can in enumerate( zip(a[cc], a[cc+1], a[cc+2], a[cc+3]) ):
+            #print 'data:  ', [data[0,cc[i]+k] for k in range(3)]
+            #print 'can : p', can, p
             can = can * np.sign(self.double_pattern)
             if all(can > p):
-                doubles.append(candidates[0][i] - 1)
+                doubles.append(cc[i])
 
         if self.debug:
