Changeset 13121


Ignore:
Timestamp:
03/15/12 21:41:30 (13 years ago)
Author:
lusterma
Message:
bug fix in drs calibration
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/pyfact/pyfact_rename.py

    r13076 r13121  
    2727    """
    2828
    29     def __init__(self, data_file_name,
    30                  calib_file_name, baseline_file_name=''):
     29    def __init__(self, data_file_name, calib_file_name,
     30                 user_action_calib=lambda acal_data, data, blm, tom, gm, scells, nroi: None,
     31                 baseline_file_name=''):
    3132        """ initialize object
    3233
     
    4445        self.calib_file_name = calib_file_name
    4546        self.baseline_file_name = baseline_file_name
     47           
     48        self.user_action_calib = user_action_calib
    4649       
    4750        # baseline correction: True / False
     
    133136
    134137        #print 'nevents = ', self.nevents, 'event_id = ', self.event_id.value
     138       
    135139        return self.acal_data, self.start_cells, self.trigger_type.value
    136140
     
    161165            # rotate the pixel baseline mean to the Data startCell
    162166            blm_pixel = np.roll( blm[pixel,:], -self.start_cells[pixel] )
     167            tom_pixel = np.roll( tom[pixel,:], -self.start_cells[pixel] )
     168            gm_pixel = np.roll( gm[pixel,:], -self.start_cells[pixel] )
    163169            acal_data[pixel,:] -= blm_pixel[0:self.nroi]
    164             acal_data[pixel,:] -= tom[pixel, 0:self.nroi]
    165             acal_data[pixel,:] /= gm[pixel,  0:self.nroi]
     170            acal_data[pixel,:] -= tom_pixel[0:self.nroi]
     171            acal_data[pixel,:] /= gm_pixel[0:self.nroi]
    166172           
    167173        self.acal_data = acal_data * 1907.35
     174       
     175        #print 'blm _pyfact', blm[0,0:20]
     176        #t = np.roll( blm[0,:], -self.start_cells[0] )
     177        #print 'blm _pyfact', t[0:20]
     178        #print 'start_pyfact: ', self.start_cells[0]
     179        #print 'acal _pyfact: ', self.acal_data[0,0:10]
     180        #t = np.roll( gm[0,:], -self.start_cells[0] )
     181        #print 'gm _pyfact: ', t[0:10]
     182        self.user_action_calib( self.acal_data,
     183                np.reshape(self.data, (self.npix, self.nroi) ), blm, tom, gm, self.start_cells, self.nroi)
    168184
    169185       
     
    289305    """ test for function __iter__ """
    290306
    291     data_file_name = '/data00/fact-construction/raw/2011/11/24/20111124_111.fits.gz'
    292     calib_file_name = '/data00/fact-construction/raw/2011/11/24/20111124_111.drs.fits.gz'
     307#    data_file_name = '/data00/fact-construction/raw/2011/11/24/20111124_111.fits.gz'
     308#    calib_file_name =     data_file_name =
     309    data_file_name =  '/home/luster/win7/FACT/data/raw/20120114/20120114_028.fits.gz'
     310    calib_file_name = '/home/luster/win7/FACT/data/raw/20120114/20120114_022.drs.fits.gz'
    293311    run = RawData( data_file_name, calib_file_name )
    294312
Note: See TracChangeset for help on using the changeset viewer.