File tree 3 files changed +40
-9
lines changed
3 files changed +40
-9
lines changed Original file line number Diff line number Diff line change 21
21
snippedCounts = hist_raw .Y
22
22
23
23
# process manager
24
- pm = pkd .core .SimpleProcessManager ()
25
-
26
- # smooth
27
- sg = pkd .core .SavitzkyGolaySmoother (31 )
28
- pm .append (sg )
29
-
30
- # peak finding
31
- pm .append (pkd .core .MovingAveragePeakFinder (400 ))
24
+ pm = pkd .core .PySimpleProcessManager (processes = [
25
+ pkd .core .SavitzkyGolaySmoother (31 ),
26
+ pkd .core .MovingAveragePeakFinder (400 )
27
+ ])
32
28
33
29
# process
34
30
processed_counts = pm .run (snippedCounts )
Original file line number Diff line number Diff line change 2
2
from PEAKINGDUCK .core import *
3
3
4
4
# python additional
5
- from peakingduck .core .smoothing import *
5
+ from peakingduck .core .smoothing import *
6
+ from peakingduck .core .process import *
Original file line number Diff line number Diff line change
1
+ # raw C++ bindings library
2
+ from PEAKINGDUCK .core import IProcessManager
3
+
4
+ """
5
+ Add other processes and/or process managers here.
6
+ """
7
+
8
+ class PySimpleProcessManager (IProcessManager ):
9
+ """
10
+ Instead of using the C++ SimpleProcessManager
11
+ we make a python native version to avoid
12
+ ref counting issues
13
+
14
+ Easy to extend also.
15
+ """
16
+ def __init__ (self , processes = None ):
17
+ self .processes = []
18
+ if processes :
19
+ self .processes = processes
20
+
21
+ def append (self , process ):
22
+ self .processes .append (process )
23
+
24
+ def __len__ (self ):
25
+ return len (self .processes )
26
+
27
+ def __item__ (self , i ):
28
+ return self .processes [i ]
29
+
30
+ def run (self , data ):
31
+ newdata = data
32
+ for p in self .processes :
33
+ newdata = p .go (newdata )
34
+ return newdata
You can’t perform that action at this time.
0 commit comments