- Timestamp:
- 04/17/12 17:14:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/extractor.py
r13333 r13367 104 104 105 105 106 def __call__(self, data ):106 def __call__(self, data, zero_level = 0): 107 107 all_hits = [] 108 108 for pix_data in data: 109 109 hits = [] 110 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 111 113 if ( self.slope > 0 ): 112 if ( pix_data[i]> 0 ):114 if ( dat > 0 ): 113 115 continue 114 116 else: 115 if ( pix_data[i]< 0):117 if ( dat < 0): 116 118 continue 117 if ( pix_data[i] * pix_data[i+1]<= 0 ):119 if ( dat * next_dat <= 0 ): 118 120 # interpolate time of zero crossing with 119 121 # linear polynomial: y = ax + b 120 a = ( pix_data[i+1] - pix_data[i]) / ((i+1) - i)121 time = -1.0/a * pix_data[i]+ i122 a = (next_dat - dat) / ((i+1) - i) 123 time = -1.0/a * dat + i 122 124 hits.append(time) 123 125 all_hits.append(hits)
Note:
See TracChangeset
for help on using the changeset viewer.