From 6ae36e1bbea344c92f354ff0cde326029f6fe401 Mon Sep 17 00:00:00 2001 From: Rishi Juneja Date: Mon, 6 Aug 2012 20:51:31 -0700 Subject: [PATCH] Changed indentation and other stylistic issues --- sgfilter.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sgfilter.py b/sgfilter.py index 6dc933c..a3c8681 100644 --- a/sgfilter.py +++ b/sgfilter.py @@ -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]