Changed default window for AvPowerSpectra to Hann. Bugfix in AvPowerSpectra. Finished and tseted SPLowpass.

This commit is contained in:
Anne de Jong 2018-04-01 19:06:50 +02:00 committed by Anne de Jong
parent e4f4f1a4e8
commit 3823d51074
3 changed files with 16 additions and 11 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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