Changeset 14468 for fact/tools/pyscripts/pyfact/extractor.py
- Timestamp:
- 10/05/12 17:11:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/extractor.py
r13367 r14468 106 106 def __call__(self, data, zero_level = 0): 107 107 all_hits = [] 108 for pix_data in data: 109 hits = [] 110 for i in range( data.shape[1]-1 ): 111 dat = pix_data[i] - zero_level 112 next_dat = pix_data[i+1] - zero_level 108 if data.ndim == 2: 109 for pix_data in data: 110 hits = [] 111 for i in range( data.shape[1]-1 ): 112 dat = pix_data[i] - zero_level 113 next_dat = pix_data[i+1] - zero_level 114 if ( self.slope > 0 ): 115 if ( dat > 0 ): 116 continue 117 else: 118 if ( dat < 0): 119 continue 120 if ( dat * next_dat <= 0 ): 121 # interpolate time of zero crossing with 122 # linear polynomial: y = ax + b 123 a = (next_dat - dat) / ((i+1) - i) 124 time = -1.0/a * dat + i 125 hits.append(time) 126 all_hits.append(hits) 127 128 if data.ndim == 1: 129 for i in range( data.shape[0]-1 ): 130 dat = data[i] - zero_level 131 next_dat = data[i+1] - zero_level 113 132 if ( self.slope > 0 ): 114 133 if ( dat > 0 ): … … 122 141 a = (next_dat - dat) / ((i+1) - i) 123 142 time = -1.0/a * dat + i 124 hits.append(time)125 all_hits.append(hits)143 all_hits.append(time) 144 126 145 return all_hits 127 146
Note:
See TracChangeset
for help on using the changeset viewer.