Skip to content

Commit

Permalink
Changed indentation and other stylistic issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishi Juneja committed Aug 7, 2012
1 parent 57fe6d3 commit 6ae36e1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions sgfilter.py
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]

0 comments on commit 6ae36e1

Please sign in to comment.