python - gaussian filter on irregularly spaced (x,y) series? -
is there easy way in python apply gaussian filter set of points (x,y), or more (x,f(x)) not regularly spaced along x-axis? in response request clarification on mean, maybe better way describe i'm looking "gaussian-weighted average", fgwa(xj), of series of points (xi,f(xi)) each point in provided series (xi,f(xi)) sum taken on provided points such that
fgwa(xj) = σi [ e-[(xj-xi)/σ]^2 * f(xi) ] / σi [ exp-[(xj-xi)/σ]^2 ]
(note - if points in (xi,f(xi)) happen evenly spaced, believe end result of above definition same "scipy.ndimage.filters.gaussian_filter1d" does). there nice, already-optimized, numpy or scipy way this?
this looks nadaraya-watson kernel regression, , 1 available python implementation in statsmodels package.
you can similar kernel smoothing operation pandas rolling window.
Comments
Post a Comment