Ignore:
Timestamp:
02/28/12 17:51:32 (13 years ago)
Author:
neise
Message:
now it does at least compile...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/pyfact/extractor.py

    r12951 r12952  
    66import numpy as np
    77import matplotlib.pyplot as plt
    8 import * from fir_filter
     8#import * from fir_filter
    99
    1010class GlobalMaxFinder(object):
    11         """ Pulse Extractor
    12             Finds the global maximum in the given window.
    13             (Best used with filtered data)
    14         """
     11    """ Pulse Extractor
     12        Finds the global maximum in the given window.
     13        (Best used with filtered data)
     14    """
    1515   
    16     def __init__(self, range=(30,250) , name = 'GlobalMaxFinder'):
     16    def __init__(self, min=30, max=250 , name = 'GlobalMaxFinder'):
    1717        """ initialize search Window
    1818       
    1919        """
    20         self.min = range[0]
    21         self.max = range[1]
     20        self.min = min
     21        self.max = max
    2222        self.name = name
    2323       
     
    3030        s = self.name + '\n'
    3131        s += 'window:\n'
    32         s += '(min,max) = (' + self.min + ',' + self.max + ')\n'
     32        s += '(min,max) = (' + str(self.min) + ',' + str(self.max) + ')\n'
    3333        return s
    3434
    3535
    3636class FixedWindowIntegrator(object):
    37         """ Integrates in a given intergration window
    38         """
     37    """ Integrates in a given intergration window
     38    """
    3939   
    40     def __init__(self, range=(55,105) , name = 'FixedWindowIntegrator'):
     40    def __init__(self, min=55, max=105 , name = 'FixedWindowIntegrator'):
    4141        """ initialize integration Window
    4242        """
    43         self.min = range[0]
    44         self.max = range[1]
     43        self.min = min
     44        self.max = max
    4545        self.name = name
    4646       
     
    5454        s = self.name + '\n'
    5555        s += 'window:\n'
    56         s += '(min,max) = (' + self.min + ',' + self.max + ')\n'
    57         return s
     56        s += '(min,max) = (' + str(self.min) + ',' + str(self.max) + ')\n'
     57        return s   
    5858
    5959class ZeroXing(object):
     
    6565        if (slope >= 0):
    6666            self.slope = 1  # search for rising edge crossing
    67         else if (slope < 0):
     67        elif (slope < 0):
    6868            self.slope = -1 # search for falling edge crossing
    6969        self.name = name
     
    7272    def __call__(self, data):
    7373        all_hits = []
    74         for pix_data in data
     74        for pix_data in data:
    7575            hits = []
    7676            for i in range( data.shape[1] ):
     
    9898        return s
    9999
     100
     101
     102if __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.