Renamed shelve to shelf, added some comments.
This commit is contained in:
parent
d51d3f7d37
commit
200ee69e2a
@ -37,6 +37,10 @@ static inline void capsule_cleanup(PyObject *capsule) {
|
|||||||
* @param data pointer to data, assumes d* for data
|
* @param data pointer to data, assumes d* for data
|
||||||
* @param transfer_ownership If set to true, the created Numpy array will be
|
* @param transfer_ownership If set to true, the created Numpy array will be
|
||||||
* responsible for freeing the data.
|
* responsible for freeing the data.
|
||||||
|
* @param F_contiguous It set to true, the data is assumed to be column-major
|
||||||
|
* ordered in memory (which means we can find element d[r,c] by d[n_cols*r+c],
|
||||||
|
* if set to false. Data is assumed to be row-major ordered (which means we
|
||||||
|
* find element d[r,c] by d[n_rows*c+r]
|
||||||
*
|
*
|
||||||
* @return Numpy array
|
* @return Numpy array
|
||||||
*/
|
*/
|
||||||
|
@ -17,17 +17,12 @@
|
|||||||
#include "lasp_pyarray.h"
|
#include "lasp_pyarray.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a numpy array from a buffer of floating point data
|
* @brief Create a Numpy array from a dmat structure
|
||||||
*
|
*
|
||||||
* @param data Pointer
|
* @param mat Pointer to the dmat
|
||||||
* @param n_rows Number of columns in the data
|
|
||||||
* @param n_cols Number of rows in the data
|
|
||||||
* @param transfer_ownership If set to true, the created Numpy array will
|
* @param transfer_ownership If set to true, the created Numpy array will
|
||||||
* obtain ownership of the data and calls free() on destruction.
|
* obtain ownership of the data and calls free() on destruction. The dmat will
|
||||||
* @param F_contiguous It set to true, the data is assumed to be column-major
|
* have the foreign_data flag set, such that it won't free the data.
|
||||||
* ordered in memory (which means we can find element d[r,c] by d[n_cols*r+c],
|
|
||||||
* if set to false. Data is assumed to be row-major ordered (which means we
|
|
||||||
* find element d[r,c] by d[n_rows*c+r]
|
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ class DaqChannel:
|
|||||||
if 'highpass' in meta:
|
if 'highpass' in meta:
|
||||||
self._highpass = meta['highpass']
|
self._highpass = meta['highpass']
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
logging.debug('No JSON data found in DaqChannel {self.channel_name}')
|
logging.debug(f'No JSON data found in DaqChannel {self.channel_name}')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def qty(self):
|
def qty(self):
|
||||||
|
@ -23,7 +23,7 @@ y[n] = 1/ba[3] * ( ba[0] * x[n] + ba[1] * x[n-1] + ba[2] * x[n-2] +
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
__all__ = ['peaking', 'biquadTF', 'notch', 'lowpass', 'highpass',
|
__all__ = ['peaking', 'biquadTF', 'notch', 'lowpass', 'highpass',
|
||||||
'highshelve', 'lowshelve']
|
'highshelf', 'lowshelf']
|
||||||
|
|
||||||
from numpy import array, cos, pi, sin, sqrt
|
from numpy import array, cos, pi, sin, sqrt
|
||||||
from scipy.interpolate import interp1d
|
from scipy.interpolate import interp1d
|
||||||
@ -53,9 +53,9 @@ def peaking(fs, f0, Q, gain):
|
|||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def notch(fs, f0, Q):
|
def notch(fs, f0, Q, gain=None):
|
||||||
"""
|
"""
|
||||||
Notch filter
|
Notch filter, parameter gain not used
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
fs: Sampling frequency [Hz]
|
fs: Sampling frequency [Hz]
|
||||||
@ -73,9 +73,9 @@ def notch(fs, f0, Q):
|
|||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def lowpass(fs, f0, Q):
|
def lowpass(fs, f0, Q, gain=None):
|
||||||
"""
|
"""
|
||||||
Second order low pass filter
|
Second order low pass filter, parameter gain not used
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
fs: Sampling frequency [Hz]
|
fs: Sampling frequency [Hz]
|
||||||
@ -93,9 +93,9 @@ def lowpass(fs, f0, Q):
|
|||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def highpass(fs, f0, Q):
|
def highpass(fs, f0, Q, gain=None):
|
||||||
"""
|
"""
|
||||||
Second order high pass filter
|
Second order high pass filter, parameter gain not used
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
fs: Sampling frequency [Hz]
|
fs: Sampling frequency [Hz]
|
||||||
@ -114,7 +114,7 @@ def highpass(fs, f0, Q):
|
|||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def highshelve(fs, f0, Q, gain):
|
def highshelf(fs, f0, Q, gain):
|
||||||
"""
|
"""
|
||||||
High shelving filter
|
High shelving filter
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ def highshelve(fs, f0, Q, gain):
|
|||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def lowshelve(fs, f0, Q, gain):
|
def lowshelf(fs, f0, Q, gain):
|
||||||
"""
|
"""
|
||||||
Low shelving filter
|
Low shelving filter
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ def lowshelve(fs, f0, Q, gain):
|
|||||||
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
return array([b0/a0, b1/a0, b2/a0, a0/a0, a1/a0, a2/a0])
|
||||||
|
|
||||||
|
|
||||||
def biquadTF(fs, freq, ba):
|
def biquadTF(fs, freq, sos):
|
||||||
"""
|
"""
|
||||||
Computes the transfer function of the biquad.
|
Computes the transfer function of the biquad.
|
||||||
|
|
||||||
@ -171,6 +171,6 @@ def biquadTF(fs, freq, ba):
|
|||||||
|
|
||||||
TODO: This code is not yet tested
|
TODO: This code is not yet tested
|
||||||
"""
|
"""
|
||||||
freq2, h = sosfreqz(ba, worN=freq, fs=fs)
|
freq2, h = sosfreqz(sos, worN=freq.size, fs=fs)
|
||||||
interpolator = interp1d(freq2, h, kind='quadratic')
|
interpolator = interp1d(freq2, h, kind='quadratic')
|
||||||
return interpolator(freq)
|
return interpolator(freq)
|
||||||
|
Loading…
Reference in New Issue
Block a user