diff --git a/lasp/c/lasp_sp_lowpass.c b/lasp/c/lasp_sp_lowpass.c index bc617ae..2242d0f 100644 --- a/lasp/c/lasp_sp_lowpass.c +++ b/lasp/c/lasp_sp_lowpass.c @@ -50,7 +50,9 @@ vd SPLowpass_filter(SPLowpass* lp, fsTRACE(15); dbgassert(lp && input,NULLPTRDEREF); - us input_size = input->size; + assert_vx(input); + us input_size = input->n_rows; + if(input_size == 0) { return vd_alloc(0); } diff --git a/lasp/c/lasp_sp_lowpass.h b/lasp/c/lasp_sp_lowpass.h index c2e9801..1229968 100644 --- a/lasp/c/lasp_sp_lowpass.h +++ b/lasp/c/lasp_sp_lowpass.h @@ -11,7 +11,7 @@ #ifndef LASP_SP_LOWPASS_H #define LASP_SP_LOWPASS_H #include "lasp_types.h" -#include "lasp_math.h" +#include "lasp_mat.h" typedef struct SPLowpass_s SPLowpass; diff --git a/lasp/wrappers.pyx b/lasp/wrappers.pyx index 185f403..f59c68f 100644 --- a/lasp/wrappers.pyx +++ b/lasp/wrappers.pyx @@ -207,7 +207,7 @@ cdef class AvPowerSpectra: def __cinit__(self,us nfft, us nchannels, d overlap_percentage, - us window=Window.rectangular, + us window=Window.hann, d[:] weighting = np.array([])): @@ -266,11 +266,13 @@ cdef class AvPowerSpectra: result = np.empty((self.nfft//2+1,nchannels,nchannels), dtype = NUMPY_COMPLEX_TYPE, order='F') + cdef c[::1,:,:] result_view = result + cdef cmat res = cmat_foreign_data(self.nfft//2+1, nchannels*nchannels, &result_view[0,0,0], - True) + False) # Copy result cmat_copy(&res,result_ptr) @@ -374,14 +376,15 @@ cdef class SPLowpass: SPLowpass_free(self.lp) def filter_(self,d[:] input_): - # cdef vd input_vd = vd_foreign(input_.size,&input_[0]) - # cdef dmat output = FilterBank_filter(self.fb,&input_vd) + cdef vd input_vd = dmat_foreign_data(input_.shape[0],1, + &input_[0],False) + + cdef dmat output = SPLowpass_filter(self.lp,&input_vd) # # Steal the pointer from output - # result = dmat_to_ndarray(&output,True) + result = dmat_to_ndarray(&output,True) - # dmat_free(&output) - # vd_free(&input_vd) + dmat_free(&output) + vd_free(&input_vd) - # return result - pass + return result