Utilities#
Digital Down Converter (DDC)#
See also
User guide on post processing.
Digital down converter (DDC) function.
- console.utilities.ddc.filter_cic_fir_comp(signal, decimation, number_of_stages)[source]#
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 – 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 – Decimation factor, by default 100. Must be even, since decimation is performed in two steps.
number_of_stages – Number of CIC stages.
- Return type:
Downsampled signal
- Raises:
ValueError – Uneven decimation factor.
- console.utilities.ddc.filter_moving_average(signal, decimation: int = 100, overlap: int = 8)[source]#
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 – 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 – Decimation factor, by default 100
optional – Decimation factor, by default 100
overlap – 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
optional – 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
- Return type:
Downsampled signal
Quality Assessment#
Signal-to-noise ratio (SNR) calculation.
- console.utilities.snr.signal_to_noise_ratio(signal: ndarray, dwell_time: float, window_width: float | int = 3000) float [source]#
Calculate the signal to noise ratio in dB.
- Parameters:
signal – Centered spectrum of the acquired signal
dwell_time – Dwell-time of the acquired signal
window_width – Estimated window width of the signal in Hz
- Return type:
Signal to noise ratio in dB