-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed indentation and other stylistic issues
- Loading branch information
Rishi Juneja
committed
Aug 7, 2012
1 parent
57fe6d3
commit 6ae36e1
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import numpy as np | ||
|
||
def sgfilter1d(degree, window_size): | ||
if not isinstance(degree, int) or degree < 0: | ||
raise ValueError("Degree of polynomial must be positive integers") | ||
if not isinstance(window_size, int) or window_size % 2 == 0 or window_size < 0 : | ||
raise ValueError("Window size must be positive odd integer") | ||
if window_size < degree + 2: | ||
raise ValueError("Degree to high for half width") | ||
A = np.mat([[n ** i for i in range(degree + 1)] for n in range(-(window_size - 1)/2, (window_size - 1)/2 + 1)]) | ||
Ainv = np.linalg.pinv(A) | ||
return Ainv[0] | ||
if not isinstance(degree, int) or degree < 0: | ||
raise ValueError("Degree of polynomial must be positive integers") | ||
if not isinstance(window_size, int) or window_size % 2 == 0 or window_size < 0 : | ||
raise ValueError("Window size must be positive odd integer") | ||
if window_size < degree + 2: | ||
raise ValueError("Degree to high for half width") | ||
A = np.array([[n ** i for i in xrange(degree + 1)] for n in xrange(-(window_size - 1)/2, (window_size - 1)/2 + 1)]) | ||
Ainv = np.linalg.pinv(A) | ||
return Ainv[0] |