Index: fact/tools/pyscripts/pyfact/pyfact_rename.py
===================================================================
--- fact/tools/pyscripts/pyfact/pyfact_rename.py	(revision 13119)
+++ fact/tools/pyscripts/pyfact/pyfact_rename.py	(revision 13121)
@@ -27,6 +27,7 @@
     """
 
-    def __init__(self, data_file_name,
-                 calib_file_name, baseline_file_name=''):
+    def __init__(self, data_file_name, calib_file_name, 
+	    	 user_action_calib=lambda acal_data, data, blm, tom, gm, scells, nroi: None,
+	    	 baseline_file_name=''):
         """ initialize object
 
@@ -44,4 +45,6 @@
         self.calib_file_name = calib_file_name
         self.baseline_file_name = baseline_file_name
+	    
+	self.user_action_calib = user_action_calib
         
         # baseline correction: True / False
@@ -133,4 +136,5 @@
 
         #print 'nevents = ', self.nevents, 'event_id = ', self.event_id.value
+	
         return self.acal_data, self.start_cells, self.trigger_type.value
 
@@ -161,9 +165,21 @@
             # rotate the pixel baseline mean to the Data startCell
             blm_pixel = np.roll( blm[pixel,:], -self.start_cells[pixel] )
+            tom_pixel = np.roll( tom[pixel,:], -self.start_cells[pixel] )
+            gm_pixel = np.roll( gm[pixel,:], -self.start_cells[pixel] )
             acal_data[pixel,:] -= blm_pixel[0:self.nroi]
-            acal_data[pixel,:] -= tom[pixel, 0:self.nroi]
-            acal_data[pixel,:] /= gm[pixel,  0:self.nroi]
+            acal_data[pixel,:] -= tom_pixel[0:self.nroi]
+            acal_data[pixel,:] /= gm_pixel[0:self.nroi]
             
         self.acal_data = acal_data * 1907.35
+	
+	#print 'blm _pyfact', blm[0,0:20] 
+	#t = np.roll( blm[0,:], -self.start_cells[0] )
+	#print 'blm _pyfact', t[0:20]
+	#print 'start_pyfact: ', self.start_cells[0]
+	#print 'acal _pyfact: ', self.acal_data[0,0:10] 
+	#t = np.roll( gm[0,:], -self.start_cells[0] )
+	#print 'gm _pyfact: ', t[0:10] 
+	self.user_action_calib( self.acal_data, 
+		np.reshape(self.data, (self.npix, self.nroi) ), blm, tom, gm, self.start_cells, self.nroi)
 
         
@@ -289,6 +305,8 @@
     """ test for function __iter__ """
 
-    data_file_name = '/data00/fact-construction/raw/2011/11/24/20111124_111.fits.gz'
-    calib_file_name = '/data00/fact-construction/raw/2011/11/24/20111124_111.drs.fits.gz'
+#    data_file_name = '/data00/fact-construction/raw/2011/11/24/20111124_111.fits.gz'
+#    calib_file_name =     data_file_name = 
+    data_file_name =  '/home/luster/win7/FACT/data/raw/20120114/20120114_028.fits.gz'
+    calib_file_name = '/home/luster/win7/FACT/data/raw/20120114/20120114_022.drs.fits.gz'
     run = RawData( data_file_name, calib_file_name )
 
