Index: /fact/tools/pyscripts/pyfact/pyfact_rename.py
===================================================================
--- /fact/tools/pyscripts/pyfact/pyfact_rename.py	(revision 12986)
+++ /fact/tools/pyscripts/pyfact/pyfact_rename.py	(revision 12987)
@@ -119,9 +119,11 @@
     def next(self):
         """ used by __iter__ """
-        if self.event_id.value == self.nevents:
+
+        if self.data_file.GetNextRow() == False:
             raise StopIteration
         else:
-            self.data_file.GetNextRow()
             self.calibrate_drs_amplitude()
+
+        #print 'nevents = ', self.nevents, 'event_id = ', self.event_id.value
         return self.acal_data, self.start_cells, self.trigger_type.value
 
@@ -158,101 +160,4 @@
         self.acal_data = acal_data * 1907.35
 
-        
-    def filter_sliding_average(self, window_size=4):
-        """ sliding average filter
-
-        using:
-            self.acal_data
-        filling array:
-            self.data_saverage_out
-
-        """
-
-        #scipy.signal.lfilter(b, a, x, axis=-1, zi=None)
-        data_saverage_out = self.acal_data.copy()
-        b = np.ones( window_size )
-        a = np.zeros( window_size )
-        a[0] = len(b)
-        data_saverage_out[:,:] = signal.lfilter(b, a, data_saverage_out[:,:])
-
-        #: data output of sliding average filter
-        self.data_saverage_out = data_saverage_out
-
-        
-    def filter_CFD(self, length=10, ratio=0.75):
-        """ constant fraction discriminator (implemented as FIR)
-        
-        using:
-            self.data_saverage_out
-        filling array:
-            self.data_CFD_out
-
-        """
-        
-        if self.data_saverage_out == None:
-            print """error pyfact.filter_CFD was called without
-            prior call to filter_sliding_average
-            variable self.data_saverage_out is needed
-            """
-            
-        data_CFD_out = self.data_saverage_out.copy()
-        b = np.zeros(length)
-        a = np.zeros(length)
-        b[0] = -1. * ratio
-        b[length-1] = 1.
-        a[0] = 1.
-        data_CFD_out[:,:] = signal.lfilter(b, a, data_CFD_out[:,:])
-        
-        #: data output of the constant fraction discriminator
-        self.data_CFD_out = data_CFD_out
- 
-    def find_peak(self, min=30, max=250):
-        """ find maximum in search window
-        
-        using: 
-            self.data_saverage_out
-        filling arrays:
-            self.pulse_time_of_maximum
-            self.pulse_amplitude
-
-        """
-
-        if self.data_saverage_out == None:
-            print """error pyfact.find_peakMax was called without \
-            prior call to filter_sliding_average
-            variable self.data_saverage_out is needed"""
-            pass
-
-        pulse_time_of_maximum = np.argmax( self.data_saverage_out[:,min:max], 
-                                          1)
-        pulse_amplitude = np.max( self.data_saverage_out[:,min:max], 1)
-        self.pulse_time_of_maximum = pulse_time_of_maximum
-        self.pulse_amplitude = pulse_amplitude
-
-    def sum_around_peak(self, left=13, right=23):
-        """ integrate signal in gate around Peak
-
-        using:
-            self.pulse_time_of_maximum
-            self.acal_data
-        filling array:
-            self.pulse_integral_simple
-            
-        """
-        
-        if self.pulse_time_of_maximum == None:
-            print """error pyfact.sum_around_peak was called \
-            without prior call of find_peak
-            variable self.pulse_time_of_maximum is needed"""
-            pass
-
-        # find left and right limit and sum the amplitudes in the range
-        pulse_integral_simple = np.empty(self.npix)
-        for pixel in range(self.npix):
-            min = self.pulse_time_of_maximum[pixel]-left
-            max = self.pulse_time_of_maximum[pixel]+right
-            pulse_integral_simple[pixel] = self.acal_data[pixel,min:max].sum()
-        
-        self.pulse_integral_simple = pulse_integral_simple
         
     def baseline_read_values(self, file, bsl_hist='bsl_sum/hplt_mean'):
