[SciPy-dev] Linear filter

Claes Hagström claes.hagstrom at swipnet.se
Sun Dec 28 10:15:39 CST 2003


Hi!

About a year ago I noted that the linear filter (signal.lfilter) had a bug 
when filtering 3D matrices:
	http://www.scipy.net/pipermail/scipy-user/2002-March/000201.html

Working in Unix I made a fix in the sigtoolsmodule.c RawFilter code:


   while (num_loops--) {
     filt(ptrb, ptra, ptrX, ptrY, ptrVf, filt_size, len, stride_X, 
stride_Y);
     incr = increment(loop_index, ndims, max_index);  /* Returns number of 
N-D indices incremented. */
     k = ndims - incr;

     if (num_loops > 0) {
     /* Adjust index array and move pointers to right place for next 
iteration */
       if ( k==0 && ndims==2 ) {

	ptrX -= loop_strides_X[1]*(max_index[1]-1);        /* Stride information 
*/
	ptrY -= loop_strides_Y[1]*(max_index[1]-1);	/* 20020304 */
       }
       ptrX += loop_strides_X[k];         /* Stride information */
       ptrY += loop_strides_Y[k];

which I think fixes the problem for the 3D case
I now increasingly work in windows, so I wonder if  you would consider 
fixing the problem
I haven't been able to compile the fix and make it work in windows yet.

Claes Hagström





-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/



More information about the Scipy-dev mailing list