cbadc.digital_estimator.parallel_digital_estimator.ParallelEstimator
- class cbadc.digital_estimator.parallel_digital_estimator.ParallelEstimator(analog_system: AnalogSystem, digital_control: DigitalControl, eta2: float, K1: int, K2: int = 0, stop_after_number_of_iterations: int = 9223372036854775808, Ts: float = None, mid_point: bool = False, downsample: int = 1, solver_type: FilterComputationBackend = FilterComputationBackend.mpmath, modulation_frequency: float = None)[source]
Bases:
BatchEstimatorParallelized batch estimator implementation.
The parallel estimator estimates a filtered version \(\hat{\mathbf{u}}(t)\) (shaped by
signal_transfer_function()) of the input signal \(\mathbf{u}(t)\) from a sequence of control signals \(\mathbf{s}[k]\).Specifically, the parallel estimator is a modified version of the default estimator
cbadc.digital_estimator.BatchEstimatorwhere the the filter matrices are diagonalized enabling a more efficient and possible parallelizable filter implementation. The estimate is computed as\(\hat{\mathbf{u}}(k T)[\ell] = \sum_{n=0}^N f_w[n] \cdot \overrightarrow{\mathbf{m}}[k][n] + b_w[n] \cdot \overleftarrow{\mathbf{m}}[k][n]\)
where
\(\overrightarrow{\mathbf{m}}[k][n] = f_a[n] \cdot \overrightarrow{\mathbf{m}}[k-1][n] + \sum_{m=0}^{M-1} f_b[n, m] \cdot \mathbf{s}[k-1][m]\)
and
\(\overleftarrow{\mathbf{m}}[k][n] = b_a \cdot \overrightarrow{\mathbf{m}}[k+1][n] + \sum_{m=0}^{M-1} b_b[n, m] \cdot \mathbf{s}[k][m]\).
Furthermore, \(f_a, b_a \in \mathbb{R}^{N}\), \(f_b, b_b \in \mathbb{R}^{N \times M}\), and \(f_w, b_w \in \mathbb{R}^{L \times N}\) are the precomputed filter coefficient formed from the filter coefficients as in
cbadc.digital_estimator.BatchEstimator.- Parameters
analog_system (
cbadc.analog_system.AnalogSystem) – an analog system (necessary to compute the estimators filter coefficients).digital_control (
cbadc.digital_control.DigitalControl) – a digital control (necessary to determine the corresponding DAC waveform).eta2 (float) – the \(\eta^2\) parameter determines the bandwidth of the estimator.
K1 (int) – batch size.
K2 (int, optional) – lookahead size, defaults to 0.
stop_after_number_of_iterations (int) – determine a max number of iterations by the iterator, defaults to \(2^{63}\).
Ts (float, optional) – the sampling time, defaults to the time period of the digital control.
mid_point (bool, optional) – set samples in between control updates, i.e., \(\hat{u}(kT + T/2)\), defaults to False.
downsample (int, optional) – set a downsampling factor compared to the control signal rate, defaults to 1, i.e., no downsampling.
solver_type (
cbadc.digital_estimator._filter_coefficients.FilterComputationBackend) – determine which solver type to use when computing filter coefficients.
- analog_system
analog system as in
cbadc.analog_system.AnalogSystemor from derived class.- Type
cbadc.analog_system.AnalogSystem
- digital_control
digital control as in
cbadc.digital_control.DigitalControlor from derived class.- Type
cbadc.digital_control.DigitalControl
- control_signal
a iterator suppling control signals as
cbadc.digital_control.DigitalControl.- Type
cbadc.digital_control.DigitalControl
- number_of_iterations
number of iterations until iterator raises
StopIteration.- Type
int
- downsample
The downsampling factor compared to the rate of the control signal.
- Type
int, optional
- mid_point
estimated samples shifted in between control updates, i.e., \(\hat{u}(kT + T/2)\).
- Type
bool
- K1
number of samples per estimate batch.
- Type
int
- K2
number of lookahead samples per computed batch.
- Type
int
- Ts
spacing between samples in seconds.
- Type
float
- Af
The Af matrix
- Type
array_like, shape=(N, N), readonly
- Ab
The Ab matrix
- Type
array_like, shape=(N, N), readonly
- Bf
The Bf matrix
- Type
array_like, shape=(N, M), readonly
- Bb
The Bb matrix
- Type
array_like, shape=(N, M), readonly
- WT
The W matrix transposed.
- Type
array_like, shape=(L, N), readonly
- f_a
The \(f_a\) vector.
- Type
array_like, shape=(N), readonly
- b_a
The \(b_a\) vector.
- Type
array_like, shape=(N), readonly
- f_b
The \(f_b\) matrix.
- Type
array_like, shape=(N, M), readonly
- b_b
The \(b_b\) matrix.
- Type
array_like, shape=(N, M), readonly
- f_w
The \(f_w\) matrix.
- Type
array_like, shape=(L, N), readonly
- b_w
The \(b_w\) matrix.
- Type
array_like, shape=(L, N), readonly
- solver_type
The solver used for computing the filter coefficients.
- Type
cbadc.digital_estimator._filter_coefficients.FilterComputationBackend
- Yields
array_like, shape=(L,) – an input estimate sample \(\hat{\mathbf{u}}(t)\)
Methods
__init__(analog_system, digital_control, ...)Compute the control signal transfer function at the angular frequencies of the omega array.
Demodulate the received signal.
Return the lag of the filter.
general_transfer_function(omega)Compute the general transfer functions from additive sources into each state varible
max_harmonic_estimate(BW, SFDR)max_transfer_function_peak(BW)noise_transfer_function(omega)Compute the noise transfer function (NTF) at the angular frequencies of the omega array.
save(filename)Pickle object for later use.
set_iterator(control_signal_sequence)Set iterator of control signals
signal_transfer_function(omega)Compute the signal transfer function (STF) at the angular frequencies of the omega array.
warm_up([samples])Warm up filter by population control signals.
white_noise_balance(BW[, max])See the magnitude difference between different noise contributions.
white_noise_sensitivities(BW, target_snr[, ...])Compute per node white noise sensitivity
- control_signal_transfer_function(omega: ndarray)
Compute the control signal transfer function at the angular frequencies of the omega array.
Specifically, computes
\(\begin{pmatrix}\hat{u}_1(\omega) / s_1(\omega) & \dots & \hat{u}_1(\omega) / s_M(\omega) \\ \vdots & \ddots & \vdots \\ \hat{u}_L(\omega) / s_1(\omega) & \dots & \hat{u}_L(\omega) / s_M(\omega) \end{pmatrix}= \mathbf{G}( \omega)^\mathsf{H} \left( \mathbf{G}( \omega)\mathbf{G}( \omega)^\mathsf{H} + \eta^2 \mathbf{I}_N \right)^{-1} \bar{\mathbf{G}}( \omega)\)
for each angular frequency in omega where where \(\bar{\mathbf{G}}( \omega)= \mathbf{C}^\mathsf{T} \left(\mathbf{A} - i \omega \mathbf{I}_N\right)^{-1} \mathbf{\Gamma} \in\mathbb{R}^{N \times M}\) is the transfer function from the control signals to the output and \(\mathbf{I}_N\) represents a square identity matrix.
- Parameters
omega (array_like, shape=(K,)) – an array_like object containing the angular frequencies for evaluation.
- Returns
return STF evaluated at K different angular frequencies.
- Return type
array_like, shape=(L, M, K)
- demodulate() ndarray
Demodulate the received signal.
- Returns
Demodulated signal.
- Return type
np.ndarray
- filter_lag()
Return the lag of the filter.
As the filter computes the estimate as
K2 |u_hat[k]
- Returns
The filter lag.
- Return type
int
- general_transfer_function(omega: ndarray)
- Compute the general transfer functions from additive sources into each state varible
to the estimates.
- Parameters
omega (array_like, shape=(K,)) – an array_like object containing the angular frequencies for evaluation.
- Returns
return transfer function from each state N to each input estimate L for each frequency K.
- Return type
array_like, shape=(L, N, K)
- noise_transfer_function(omega: ndarray)
Compute the noise transfer function (NTF) at the angular frequencies of the omega array.
Specifically, computes
\(\text{NTF}( \omega) = \mathbf{G}( \omega)^\mathsf{H} \left( \mathbf{G}( \omega)\mathbf{G}( \omega)^\mathsf{H} + \eta^2 \mathbf{I}_N \right)^{-1}\)
for each angular frequency in omega where where \(\mathbf{G}(\omega)\in\mathbb{R}^{N \times L}\) is the ATF matrix of the analog system and \(\mathbf{I}_N\) represents a square identity matrix.
- Parameters
omega (array_like, shape=(K,)) – an array_like object containing the angular frequencies for evaluation.
- Returns
return NTF evaluated at K different angular frequencies.
- Return type
array_like, shape=(L, N_tilde, K)
- save(filename: str)
Pickle object for later use.
Uses
cbadc.utilities.pickle_load()to save object for later use.- Parameters
filename (str) – filename to save object to.
- set_iterator(control_signal_sequence: Iterator[ndarray])
Set iterator of control signals
- Parameters
control_signal_sequence (iterator) – a iterator which outputs a sequence of control signals.
- signal_transfer_function(omega: ndarray)
Compute the signal transfer function (STF) at the angular frequencies of the omega array.
Specifically, computes
\(\text{STF}( \omega) = \mathbf{G}( \omega)^\mathsf{H} \left( \mathbf{G}( \omega)\mathbf{G}( \omega)^\mathsf{H} + \eta^2 \mathbf{I}_N \right)^{-1} \mathbf{G}( \omega)\)
for each angular frequency in omega where where \(\mathbf{G}(\omega)\in\mathbb{R}^{N \times L}\) is the ATF matrix of the analog system and \(\mathbf{I}_N\) represents a square identity matrix.
- Parameters
omega (array_like, shape=(K,)) – an array_like object containing the angular frequencies for evaluation.
- Returns
return STF evaluated at K different angular frequencies.
- Return type
array_like, shape=(L, K)
- warm_up(samples=0)
Warm up filter by population control signals.
Effectively removes the filter lag.
- Parameters
samples (int, optional) – number of warmup samples, defaults to filter_lag
- white_noise_balance(BW: ndarray, max=True)
See the magnitude difference between different noise contributions.
- Parameters
BW (array_like, shape=(2,)) – the upper and lower bandwidth ranges as (BW_low, BW_high).
max (bool, optional) – If to take the max value of the transferfunction or the squared integrated, defaults to True.
- Returns
white noise balance.
- Return type
array_like, shape=(L, N)
- white_noise_sensitivities(BW: ndarray, target_snr: float, input_power: float = 0.5, max=True, spectrum=False) ndarray
Compute per node white noise sensitivity
- Parameters
BW (array_like, shape=(2,)) – the upper and lower bandwidth ranges as (BW_low, BW_high).
target_snr (float) – the target SNR expressed in a linear scale.
input_power (float, optional) – the input power expressed in a linear scale, defaults to 1/2.
max (bool, optional) – If to take the max value of the transferfunction or the squared integrated, defaults to True.
spectrum (bool, optional) – express the returned noise variance as a power spectral density, i.e., V^2/Hz, for states representing voltages. Defaults to False.
- Returns
admissable noise power to align with SNR requirement.
- Return type
array_like, shape=(L, N)