Changeset 13028 for fact/tools


Ignore:
Timestamp:
03/09/12 10:23:42 (13 years ago)
Author:
neise
Message:
added class WindowIntegrator, which integrate around a give position in a given window
File:
1 edited

Legend:

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

    r12986 r13028  
    4141        pass
    4242
     43
     44class WindowIntegrator(object):
     45    """ Integrates in a given intergration window around the given position
     46    """
     47   
     48    def __init__(self, min=13, max=23 , name = 'WindowIntegrator'):
     49        """ initialize integration Window
     50        """
     51        self.min = min
     52        self.max = max
     53        self.name = name
     54       
     55    def __call__(self, data, pos):
     56        integral = np.empty( data.shape[0] )
     57        for pixel in range( data.shape[0] ):
     58            integral[pixel] = data[pixel, (pos[pixel]-self.min):(pos[pixel]+self.max)].sum()
     59        return integral
     60
     61    def __str__(self):
     62        s = self.name + '\n'
     63        s += 'window:\n'
     64        s += '(min,max) = (' + str(self.min) + ',' + str(self.max) + ')'
     65        return s   
    4366
    4467class FixedWindowIntegrator(object):
Note: See TracChangeset for help on using the changeset viewer.