[SciPy-Dev] Splines

denis denis-bz-py@t-online...
Mon Mar 18 12:17:20 CDT 2013


Charles R Harris <charlesr.harris <at> gmail.com> writes:


> On Wed, Mar 13, 2013 at 12:54 PM, denis <denis-bz-py <at> t-online.de> wrote:

> Chuck,
>   is "prefilter=True will filter out high frequencies in the data"
> not correct ?
> 
> No, I suspect it increases the high frequencies ;) For cubic splines
convolving the coefficients with [1/6, 2/3, 1/6] will reproduce the sample
values, so to get the spline coefficients you need to deconvolve what is
essentially a low pass filter.

Chuck,
  you're right; could spline_filter1d be buggy ?

    f .5  x [ 100 -100  100 -100  100 -100  100 -100  100 -100]
    np.convolve: [ 50 -33  33 -33  33 -33  33 -33  33 -50]
    ndimage.convolve: [ 50 -33  33 -33  33 -33  33 -33  33 -50]
    ndimage.spline order 2: [ 200 -200  200 -200  200 -200  200 -200  200 -200]
    ndimage.spline order 3: [ 300 -300  300 -300  300 -300  300 -300  300 -300]
    ndimage.spline order 4: [ 480 -480  480 -480  480 -480  480 -480  480 -480]

NI_SplineFilter1D in $scipysrc/ndimage/src/ni_interpolation.c has

   case 2:
        npoles = 1;
        pole[0] = sqrt(8.0) - 3.0;
        break;
    case 3:
        npoles = 1;
        pole[0] = sqrt(3.0) - 2.0;

beyond me,
spline_filter1d( ones ) is ok though.

cheers
  -- denis




More information about the SciPy-Dev mailing list