Some extra comments

This commit is contained in:
Anne de Jong 2021-09-11 15:54:00 +02:00
parent c98b10b83a
commit a6906bb620

View File

@ -430,7 +430,9 @@ cdef extern from "lasp_sosfilterbank.h":
cdef class SosFilterBank: cdef class SosFilterBank:
cdef: cdef:
c_Sosfilterbank* fb c_Sosfilterbank* fb
us nsections
def __cinit__(self,const us filterbank_size, const us nsections): def __cinit__(self,const us filterbank_size, const us nsections):
self.nsections = nsections
self.fb = Sosfilterbank_create(0, filterbank_size,nsections) self.fb = Sosfilterbank_create(0, filterbank_size,nsections)
@ -441,11 +443,18 @@ cdef class SosFilterBank:
filter_no: Filter number of the filterbank to set the filter_no: Filter number of the filterbank to set the
filter for filter for
sos: Second axis are the filter coefficients, first axis sos: Second axis are the filter coefficients, first axis
is the section is the section, second axis are the coefficients for that section.
Storage is in agreement with specification from Scipy: first axis
is the section, second axis are the coefficients for that section.
""" """
if sos.shape[0] != self.nsections:
raise RuntimeError('Invalid number of sections in filter data, should be {self.nsections.}')
elif sos.shape[1] != 6:
raise RuntimeError('Illegal number of filter coefficients in section. Should be 6.')
cdef dmat coefs = dmat_foreign_data(sos.size,1, cdef dmat coefs = dmat_foreign_data(sos.size,1,
&sos[0, 0],False) &sos[0, 0],False # No copying
)
Sosfilterbank_setFilter(self.fb,filter_no, coefs) Sosfilterbank_setFilter(self.fb,filter_no, coefs)
def __dealloc__(self): def __dealloc__(self):