Changeset 13014 for fact/tools/pyscripts/pyfact
- Timestamp:
- 03/08/12 11:24:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/drs_spikes.py
r13012 r13014 17 17 """ 18 18 19 def __init__(self, threshold= 10.,19 def __init__(self, threshold=7., 20 20 single_pattern=np.array( [-0.5, 1.0, -0.5]) , 21 21 double_pattern=np.array([-1., 1., 1., -1.]), … … 42 42 doubles = [] 43 43 44 cc = candidates = np.where(a > self.threshold) 45 print 'candidates: ', candidates[0]-1 44 # a spike in the first or last channel is considered as a filter artefact 45 candidates = np.where(a[1:-2] > self.threshold) 46 # candidates = np.where(a[1:1022] > self.threshold) 47 cc = candidates[0] 48 #print 'cc: ', cc 46 49 #: find single spikes 47 50 p = self.single_pattern * np.sign( self.single_pattern ) 48 for i, can in enumerate( zip(a[cc [0]-1], a[cc[0]], a[cc[0]+1]) ):49 print 'can : p', can, p51 for i, can in enumerate( zip(a[cc], a[cc+1], a[cc+2]) ): 52 #print 'can : p', can, p 50 53 can = can * np.sign(self.single_pattern) 51 54 if all(can > p): 52 singles.append(c andidates[0][i] - 1)55 singles.append(cc[i]) 53 56 54 57 #: find double spikes 55 58 p = self.double_pattern * np.sign( self.double_pattern ) 56 for i, can in enumerate( zip(a[cc [0]-1], a[cc[0]],57 a[cc[0]+1], a[cc[0]+2]) ):58 print 'can : p', can, p59 for i, can in enumerate( zip(a[cc], a[cc+1], a[cc+2], a[cc+3]) ): 60 #print 'data: ', [data[0,cc[i]+k] for k in range(3)] 61 #print 'can : p', can, p 59 62 can = can * np.sign(self.double_pattern) 60 63 if all(can > p): 61 doubles.append(c andidates[0][i] - 1)64 doubles.append(cc[i]) 62 65 63 66 if self.debug:
Note:
See TracChangeset
for help on using the changeset viewer.