Changeset 13382 for fact/tools/pyscripts/pyfact
- Timestamp:
- 04/18/12 20:00:26 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/pyfact.py
r13380 r13382 145 145 self.trigger_type = c_ushort() 146 146 #: 1D array with raw data 147 self.data = np.zeros( self.npix * self.nroi, np.int16 ) 147 self.data = np.zeros( self.npix * self.nroi, np.int16 ).reshape(self.npix ,self.nroi) 148 148 #: slice where drs readout started 149 149 self.start_cells = np.zeros( self.npix, np.int16 ) … … 171 171 trigger_offset_mean = calib_file.GetN('TriggerOffsetMean') 172 172 173 self.blm = np.zeros(baseline_mean, np.float32) 174 self.gm = np.zeros(gain_mean, np.float32) 175 self.tom = np.zeros(trigger_offset_mean, np.float32) 173 self.blm = np.zeros(baseline_mean, np.float32).reshape(self.npix , baseline_mean/self.npix) 174 self.gm = np.zeros(gain_mean, np.float32).reshape(self.npix , gain_mean/self.npix) 175 self.tom = np.zeros(trigger_offset_mean, np.float32).reshape(self.npix , trigger_offset_mean/self.npix) 176 176 177 177 self.Nblm = baseline_mean / self.npix … … 183 183 calib_file.SetPtrAddress('TriggerOffsetMean', self.tom) 184 184 calib_file.GetRow(0) 185 186 # make calibration constants double, so we never need to roll 187 self.blm = np.hstack((self.blm, self.blm)) 188 self.gm = np.hstack((self.gm, self.gm)) 189 self.tom = np.hstack((self.tom, self.tom)) 185 190 186 191 self.v_bsl = np.zeros(self.npix) # array of baseline values (all ZERO) … … 221 226 222 227 """ 223 228 blm = self.blm 229 gm = self.gm 230 tom = self.tom 231 224 232 to_mV = 2000./4096. 225 233 #: 2D array with amplitude calibrated dat in mV … … 227 235 228 236 # make 2D arrays: row = pixel, col = drs_slice 229 acal_data = np.reshape(acal_data, (self.npix, self.nroi) )230 blm = np.reshape(self.blm, (self.npix, self.Nblm) )231 tom = np.reshape(self.tom, (self.npix, self.Ntom) )232 gm = np.reshape(self.gm, (self.npix, self.Ngm) )237 #acal_data = np.reshape(acal_data, (self.npix, self.nroi) ) 238 #blm = np.reshape(self.blm, (self.npix, self.Nblm) ) 239 #tom = np.reshape(self.tom, (self.npix, self.Ntom) ) 240 #gm = np.reshape(self.gm, (self.npix, self.Ngm) ) 233 241 234 242 # double the calibration constants … … 237 245 238 246 for pixel in range( self.npix ): 247 #shortcuts 248 sc = self.start_cells[pixel] 249 roi = self.nroi 239 250 # rotate the pixel baseline mean to the Data startCell 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] 251 blm_pixel = blm[pixel,sc:sc+roi] 242 252 # rotate the pixel gain mean to the Data startCell 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] 253 gm_pixel = gm[pixel,sc:sc+roi] 245 254 # the 'trigger offset mean' does not need to be rolled 246 255 # on the contrary, it seems there is an offset in the DRS data, 247 256 # which is related to its distance to the startCell, not to its 248 257 # distance to the beginning of the physical pipeline in the DRS chip 249 tom_pixel = tom[pixel,0: self.nroi]258 tom_pixel = tom[pixel,0:roi] 250 259 251 260 acal_data[pixel,:] -= blm_pixel
Note:
See TracChangeset
for help on using the changeset viewer.