Changeset 12952 for fact/tools/pyscripts/pyfact/extractor.py
- Timestamp:
- 02/28/12 17:51:32 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/extractor.py
r12951 r12952 6 6 import numpy as np 7 7 import matplotlib.pyplot as plt 8 import * from fir_filter8 #import * from fir_filter 9 9 10 10 class GlobalMaxFinder(object): 11 12 13 14 11 """ Pulse Extractor 12 Finds the global maximum in the given window. 13 (Best used with filtered data) 14 """ 15 15 16 def __init__(self, range=(30,250), name = 'GlobalMaxFinder'):16 def __init__(self, min=30, max=250 , name = 'GlobalMaxFinder'): 17 17 """ initialize search Window 18 18 19 19 """ 20 self.min = range[0]21 self.max = range[1]20 self.min = min 21 self.max = max 22 22 self.name = name 23 23 … … 30 30 s = self.name + '\n' 31 31 s += 'window:\n' 32 s += '(min,max) = (' + s elf.min + ',' + self.max+ ')\n'32 s += '(min,max) = (' + str(self.min) + ',' + str(self.max) + ')\n' 33 33 return s 34 34 35 35 36 36 class FixedWindowIntegrator(object): 37 38 37 """ Integrates in a given intergration window 38 """ 39 39 40 def __init__(self, range=(55,105), name = 'FixedWindowIntegrator'):40 def __init__(self, min=55, max=105 , name = 'FixedWindowIntegrator'): 41 41 """ initialize integration Window 42 42 """ 43 self.min = range[0]44 self.max = range[1]43 self.min = min 44 self.max = max 45 45 self.name = name 46 46 … … 54 54 s = self.name + '\n' 55 55 s += 'window:\n' 56 s += '(min,max) = (' + s elf.min + ',' + self.max+ ')\n'57 return s 56 s += '(min,max) = (' + str(self.min) + ',' + str(self.max) + ')\n' 57 return s 58 58 59 59 class ZeroXing(object): … … 65 65 if (slope >= 0): 66 66 self.slope = 1 # search for rising edge crossing 67 el seif (slope < 0):67 elif (slope < 0): 68 68 self.slope = -1 # search for falling edge crossing 69 69 self.name = name … … 72 72 def __call__(self, data): 73 73 all_hits = [] 74 for pix_data in data 74 for pix_data in data: 75 75 hits = [] 76 76 for i in range( data.shape[1] ): … … 98 98 return s 99 99 100 101 102 if __name__ == '__main__': 103 """ test the extractors """ 104 105 gmf = GlobalMaxFinder((12,40)) 106 print gmf 107 fwi = FixedWindowIntegrator(1,3) 108 print fwi 109 zx = ZeroXing() 110 print zx
Note:
See TracChangeset
for help on using the changeset viewer.