[SciPy-user] savitzky golay filtering

Travis Oliphant oliphant@ee.byu....
Sat Feb 17 19:47:38 CST 2007

Christian Kristukat wrote:
> Hi,
> Meesters, Christian wrote:
>> Hi
>> I wanted to do a Savitzky Golay filtering on my data and came aross this piece of code:
>> http://www.dalkescientific.com/writings/NBN/data/savitzky_golay.py
>> Well, translating the necessary bits into current numpy/scipy code is driving me crazy. Can somebody give me a hint on the "M = ..."-line, please?

You can always import from numpy.oldnumeric
and numpy.oldnumeric.linear_algebra


import numpy as N

B = N.mat(B)
M = (B.T*B).I * B.T
return M.A  # if you want an array returned.

But, probably what you really want is to replace the whole line with

M = N.linalg.pinv(B)


More information about the SciPy-user mailing list