Changeset 13380


Ignore:
Timestamp:
04/18/12 17:07:40 (13 years ago)
Author:
neise
Message:
new option in RawData.__init__() one can set do_calibration=False. and the amplitude calibration comes without np.roll() ... thx to TPK for the idea
File:
1 edited

Legend:

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

    r13375 r13380  
    8383                user_action_calib=lambda acal_data, data, blm, tom, gm, scells, nroi: None,
    8484                baseline_file_name='',
    85                 return_dict = None):
     85                return_dict = None,
     86                do_calibration = True):
    8687        """ initialize object
    8788       
     
    107108            print 'and some time later, the option will not be supported anymore'
    108109            return_dict = False
    109 
    110110        self.return_dict = return_dict
    111111       
     112        self.do_calibration = do_calibration
     113
    112114        self.data_file_name = data_file_name
    113115        self.calib_file_name = calib_file_name
     
    198200            raise StopIteration
    199201        else:
    200             self.calibrate_drs_amplitude()
     202            if self.do_calibration == True:
     203                self.calibrate_drs_amplitude()
    201204
    202205        #print 'nevents = ', self.nevents, 'event_id = ', self.event_id.value
     
    229232        gm  = np.reshape(self.gm,  (self.npix, self.Ngm) )
    230233       
     234        # double the calibration constants
     235        blm = np.hstack((blm,blm))
     236        gm = np.hstack((gm,gm))
     237       
    231238        for pixel in range( self.npix ):
    232239            # rotate the pixel baseline mean to the Data startCell
    233             blm_pixel = np.roll( blm[pixel,:], -self.start_cells[pixel] )
     240            #blm_pixel = np.roll( blm[pixel,:], -self.start_cells[pixel] )
     241            blm_pixel = blm[pixel, self.start_cells[pixel]:self.start_cells[pixel]+self.nroi]
    234242            # rotate the pixel gain mean to the Data startCell
    235             gm_pixel = np.roll( gm[pixel,:], -self.start_cells[pixel] )
     243            #gm_pixel = np.roll( gm[pixel,:], -self.start_cells[pixel] )
     244            gm_pixel = gm[pixel, self.start_cells[pixel]:self.start_cells[pixel]+self.nroi]
    236245            # the 'trigger offset mean' does not need to be rolled
    237246            # on the contrary, it seems there is an offset in the DRS data,
    238247            # which is related to its distance to the startCell, not to its
    239248            # distance to the beginning of the physical pipeline in the DRS chip
    240             tom_pixel = tom[pixel,:]
     249            tom_pixel = tom[pixel,0:self.nroi ]
    241250           
    242             acal_data[pixel,:] -= blm_pixel[0:self.nroi]
    243             acal_data[pixel,:] -= tom_pixel[0:self.nroi]
    244             acal_data[pixel,:] /= gm_pixel[0:self.nroi]
     251            acal_data[pixel,:] -= blm_pixel
     252            acal_data[pixel,:] -= tom_pixel
     253            acal_data[pixel,:] /= gm_pixel
    245254           
    246255        self.acal_data = acal_data * 1907.35
Note: See TracChangeset for help on using the changeset viewer.