Changeset 13367


Ignore:
Timestamp:
04/17/12 17:14:11 (13 years ago)
Author:
neise
Message:
ZeroXing supports also Xings at different levels, so one can set the zero-level to another level
File:
1 edited

Legend:

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

    r13333 r13367  
    104104
    105105
    106     def __call__(self, data):
     106    def __call__(self, data, zero_level = 0):
    107107        all_hits = []
    108108        for pix_data in data:
    109109            hits = []
    110110            for i in range( data.shape[1]-1 ):
     111                dat = pix_data[i] - zero_level
     112                next_dat = pix_data[i+1] - zero_level
    111113                if ( self.slope > 0 ):
    112                     if ( pix_data[i] > 0 ):
     114                    if ( dat > 0 ):
    113115                        continue
    114116                else:
    115                     if ( pix_data[i] < 0):
     117                    if ( dat < 0):
    116118                        continue
    117                 if ( pix_data[i] * pix_data[i+1] <= 0 ):
     119                if ( dat * next_dat <= 0 ):
    118120                    # interpolate time of zero crossing with
    119121                    # 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] + i
     122                    a = (next_dat - dat) / ((i+1) - i)
     123                    time = -1.0/a * dat + i
    122124                    hits.append(time)
    123125            all_hits.append(hits)
Note: See TracChangeset for help on using the changeset viewer.