From a6906bb620497e69bdc8197d44bf385a2fb4b6ce Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Sat, 11 Sep 2021 15:54:00 +0200 Subject: [PATCH] Some extra comments --- lasp/wrappers.pyx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lasp/wrappers.pyx b/lasp/wrappers.pyx index 8d7d350..3c2698f 100644 --- a/lasp/wrappers.pyx +++ b/lasp/wrappers.pyx @@ -430,7 +430,9 @@ cdef extern from "lasp_sosfilterbank.h": cdef class SosFilterBank: cdef: c_Sosfilterbank* fb + us nsections def __cinit__(self,const us filterbank_size, const us nsections): + self.nsections = 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 for 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, - &sos[0, 0],False) + &sos[0, 0],False # No copying + ) Sosfilterbank_setFilter(self.fb,filter_no, coefs) def __dealloc__(self):