File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 9
9
Alternatively you can use scipy.signal.butter, which should yield the same results.
10
10
"""
11
11
12
+
12
13
# All calls to filter creators must have keyword arguments
13
14
def safe_checks (filter_creator ):
14
15
def safe_filter_creator (** kwargs ):
15
- if not isinstance (kwargs [' frequency' ], int ) or kwargs [' frequency' ] <= 0 :
16
- raise ValueError (' Frequency must be a positive integer.' )
17
- if not isinstance (kwargs [' samplerate' ], int ) or kwargs [' samplerate' ] <= 0 :
18
- raise ValueError (' Samplerate must be a positive integer.' )
19
- if not (0 < kwargs [' frequency' ] < kwargs [' samplerate' ] / 2 ):
20
- raise ValueError (' Frequency must be less than half of the samplerate.' )
21
- if kwargs [' q_factor' ] <= 0 :
22
- raise ValueError (' Q factor must be positive.' )
16
+ if not isinstance (kwargs [" frequency" ], int ) or kwargs [" frequency" ] <= 0 :
17
+ raise ValueError (" Frequency must be a positive integer." )
18
+ if not isinstance (kwargs [" samplerate" ], int ) or kwargs [" samplerate" ] <= 0 :
19
+ raise ValueError (" Samplerate must be a positive integer." )
20
+ if not (0 < kwargs [" frequency" ] < kwargs [" samplerate" ] / 2 ):
21
+ raise ValueError (" Frequency must be less than half of the samplerate." )
22
+ if kwargs [" q_factor" ] <= 0 :
23
+ raise ValueError (" Q factor must be positive." )
23
24
return filter_creator (** kwargs )
25
+
24
26
return safe_filter_creator
25
27
26
28
You can’t perform that action at this time.
0 commit comments