Chung-Kennedy Filter

This returns a wave which is filtered according to the method of Chung & Kennedy, J. Neurocience Methods, 1991.

function /wave ChungKennedy(w,mm,kk,pp[,pis])
    wave w // Data.  
    variable mm // Analysis window length.  
    variable kk // Number of filters.  
    variable pp // An exponent.  
    wave pis // The weights (pi_i) for the filters.  Has length kk.  
   
    if(paramisdefault(pis))
        make /free/n=(kk) pis = 1
    endif
   
    variable n = numpnts(w)
    make /free/n=(n,kk*2) estimates
    estimates[][0,kk] = mean(w,pnt2x(w,p-2^(q+1)),pnt2x(w,p-1)) // Forwards.  
    estimates[][kk,] = mean(w,pnt2x(w,p+1),pnt2x(w,p+2^(q+1-kk))) // Backwards.  
   
    make /free/n=(n,kk*2) weights
    make /free/n=(n,kk,mm) forwards = (w[p-r]-estimates[p-r][q])^2
    make /free/n=(n,kk,mm) backwards = (w[p+r]-estimates[p+r][q+kk])^2
    matrixop /free forwards = powR(sumbeams(forwards),-pp)
    matrixop /free backwards = powR(sumbeams(backwards),-pp)
    weights[][0,kk] = forwards[p][q]*pis[q]
    weights[][kk,] = backwards[p][q-kk]*pis[q-kk]
   
    // Normalize.  
    matrixop /free sums = sumrows(weights)
    weights /= sums[p]
   
    matrixop /free result = sumrows(estimates * weights)
    return result
end
Thanks! But see

Biophys J. 2008 January 1; 94(1): 306–319.
Published online 2007 September 7. doi: 10.1529/biophysj.107.110601
PMCID: PMC2134886
A Comparison of Step-Detection Methods: How Well Can You Do?

Brian C. Carter,* Michael Vershinin,† and Steven P. Gross*†


http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2134886/

for a discussion of different methods.

John Bechhoefer
Department of Physics
Simon Fraser University
Burnaby, BC, Canada

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More