ddc
ddc
Digital down converter (DDC) function.
filter_moving_average
Decimate data using a moving average filter.
\(kernel = e^{\frac{-1}{1 - x^2}} * \sin{2.073 * \pi \ x} / x, \; x = -1, ..., 1\)
Parameters:
-
signal(ndarray) –Unprocessed raw signal to be decimated and filtered. Input signal shape is supposed to be [averages, coils, phase encoding, readout]. Downsampling is applied to the readout dimension.
-
decimation(int, default:100) –Decimation factor, by default 100
-
overlap(int, default:8) –Overlap factor of the kernel. If 2, kernel is applied every kernel_size/2, if 4 every kerne_size/4 and so on. By default 4
Returns:
-
Downsampled signal–
Source code in src/console/utilities/ddc.py
filter_cic_fir_comp
Decimate data using CIC filter and FIR compensation.
Two stage decimation: (1) CIC decimation by decimation/2 rate (2) FIR decimation by factor 2
The signal size after decimation can be determined by
signal.shape[-1] // decimation
The number of decimated samples after the first stage depends output sample size. Any left over samples in CIC decimation stage are truncated.
Parameters:
-
signal(ndarray) –Unprocessed raw signal to be decimated and filtered. Input signal shape is supposed to be [averages, coils, phase encoding, readout]. Downsampling is applied to the readout dimension.
-
decimation(int) –Decimation factor, by default 100. Must be even, since decimation is performed in two steps.
-
number_of_stages(int) –Number of CIC stages.
Returns:
-
Downsampled signal–
Raises:
-
ValueError–Uneven decimation factor.