- Timestamp:
- 03/20/12 09:27:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/pyfact.py
r13155 r13156 29 29 def __init__(self, data_file_name, calib_file_name, 30 30 user_action_calib=lambda acal_data, data, blm, tom, gm, scells, nroi: None, 31 baseline_file_name=''): 31 baseline_file_name='', 32 return_dict = None): 32 33 """ initialize object 33 34 34 35 open data file and calibration data file 35 36 get basic information about the data in data_file_name … … 39 40 calib_file_name : fits or fits.gz file containing DRS calibration data 40 41 baseline_file_name : npy file containing the baseline values 41 42 """ 43 42 """ 43 # manual implementation of default value, but I need to find out 44 # if the user of this class is aware of the new option 45 if return_dict == None: 46 print 'Warning: Rawdata.__init__() has a new option "return_dict"' 47 print 'the default value of this option is False, so nothing changes for you at the moment.' 48 print 49 print 'you probably want, to get a dictionary out of the next() method anyway' 50 print ' so please change your scripts and set this option to True, for the moment' 51 print 'e.g. like this: run = RawData(data_filename, calib_filename, return_dict = True)' 52 print "after a while, the default value, will turn to True .. so you don't have to give the option anymore" 53 print 'and some time later, the option will not be supported anymore' 54 return_dict = False 55 56 self.return_dict = return_dict 57 44 58 self.data_file_name = data_file_name 45 59 self.calib_file_name = calib_file_name … … 115 129 116 130 self.v_bsl = np.zeros(self.npix) # array of baseline values (all ZERO) 117 self.data_saverage_out = None118 self.pulse_time_of_maximum = None119 self.pulse_amplitude = None120 131 121 132 def __iter__(self): … … 136 147 137 148 #print 'nevents = ', self.nevents, 'event_id = ', self.event_id.value 138 139 return self.acal_data, self.start_cells, self.trigger_type.value 149 if self.return_dict: 150 return self.__dict__ 151 else: 152 return self.acal_data, self.start_cells, self.trigger_type.value 140 153 141 154 def next_event(self): … … 165 178 # rotate the pixel baseline mean to the Data startCell 166 179 blm_pixel = np.roll( blm[pixel,:], -self.start_cells[pixel] ) 167 tom_pixel = tom[pixel,:]180 # rotate the pixel gain mean to the Data startCell 168 181 gm_pixel = np.roll( gm[pixel,:], -self.start_cells[pixel] ) 182 # the 'trigger offset mean' does not need to be rolled 183 # on the contrary, it seems there is an offset in the DRS data, 184 # which is related to its distance to the startCell, not to its 185 # distance to the beginning of the physical pipeline in the DRS chip 186 tom_pixel = tom[pixel,:] 187 169 188 acal_data[pixel,:] -= blm_pixel[0:self.nroi] 170 189 acal_data[pixel,:] -= tom_pixel[0:self.nroi]
Note:
See TracChangeset
for help on using the changeset viewer.