Digital Signal Processing (DSP)
Core digital signal processing utilities (optic.dsp.core)
|
Calculate the average power of x per mode. |
|
Calculate the total power of x. |
|
Perform FIR filtering and compensate for filter delay. |
|
Generate Root-Raised Cosine (RRC) filter coefficients. |
|
Generate Raised Cosine (RC) filter coefficients. |
|
Generate a pulse shaping filter. |
|
Interpolate signal to a given sampling rate. |
|
Quantize the input signal using a uniform quantizer with the specified precision. |
|
Calculate FIR coefficients of a lowpass filter. |
|
Decimate signal. |
|
Resample signal to a desired sampling rate. |
|
Upsample a signal by inserting zeros between samples. |
|
Symbol synchronizer. |
|
Find delay between x and y. |
|
Normalize the average power of each componennt of x. |
|
Generate complex circular Gaussian noise. |
|
Generate Gaussian noise. |
|
Generate realization of a random-walk phase-noise process. |
|
Calculate the sliding window moving average of a 2D NumPy array along each column. |
|
Apply a time delay to a signal sampled at fs samples per second using FFT/IFFT algorithms. |
|
Blockwise convolution in the frequency domain using the overlap-and-save FFT method. |
|
Frequency shift of a signal. |
|
Fast function to calculate the Mach-Zehnder modulator (MZM) model. |
|
Fast function to calculate the phase modulator (PM) model. |
|
Levinson-Durbin algorithm |
|
Estimate the autocorrelation coefficients of a signal x up to lag nTaps-1. |
|
Estimate the coefficients of a whitening filter of order nTaps using the Levinson-Durbin algorithm. |
- anorm(x)
Normalize the amplitude of each componennt of x.
- Parameters:
x (np.array) – Signal.
- Returns:
Signal x with each component normalized in amplitude.
- Return type:
np.array
- autocorr(x, nTaps)
Estimate the autocorrelation coefficients of a signal x up to lag nTaps-1.
- Parameters:
x (array-like) – The input signal for which to estimate the autocorrelation coefficients.
nTaps (int) – The number of autocorrelation coefficients to estimate (lags from 0 to nTaps-1).
- Returns:
r – An array of length nTaps containing the estimated autocorrelation coefficients, where r[k] is the autocorrelation at lag k.
- Return type:
np.ndarray
Notes
The autocorrelation coefficients are estimated using the unbiased estimator, which normalizes the sum of products by the number of terms that contribute to each lag. This provides a more accurate estimate of the autocorrelation, especially for larger lags.
References
[1] Gallager, R. G., Introduction to Random Signals and Applied Kalman Filtering. John Wiley & Sons, 2010.
- blockwiseFFTConv(x, h, NFFT=None, freqDomainFilter=False)
Blockwise convolution in the frequency domain using the overlap-and-save FFT method.
- Parameters:
x (ndarray) – Input signal.
h (ndarray) – Filter impulse response.
NFFT (int, optional) – FFT size to be used. Must be greater than the length of the filter. If None, it will be set to the next power of 2 greater than or equal to the length of the filter. Default is None.
freqDomainFilter (bool, optional) – If True, h is assumed to be the frequency response of the filter. If False, the FFT of h will be computed. Default is False.
- Returns:
y – The filtered output signal.
- Return type:
ndarray
- Raises:
ValueError – If NFFT is not greater than the length of the filter h.
- calcMZM(Ai, Vpi, u, Vb)
Fast function to calculate the Mach-Zehnder modulator (MZM) model.
- Parameters:
Ai (float) – Amplitude of the input signal.
Vpi (float) – Half-wave voltage of the MZM.
u (float) – DC bias voltage.
Vb (float) – Voltage applied to the MZM.
- Returns:
Output signal after modulation.
- Return type:
float
- calcPM(Ai, Vpi, u)
Fast function to calculate the phase modulator (PM) model.
- Parameters:
Ai (float) – Amplitude of the input signal.
Vpi (float) – Half-wave voltage of the PM.
u (float) – Driving voltage applied to the PM.
- Returns:
Output signal after modulation.
- Return type:
float
- clockSamplingInterp(x, inFs, outFs, jitter=0)
Interpolate signal to a given sampling rate.
- Parameters:
x (np.array) – Input signal.
inFs (float) – Sampling frequency of the input signal.
outFs (float) – Sampling frequency of the output signal.
jitter (float) – Standard deviation of the time jitter (jitter rms). Default is 0.
- Returns:
y – Resampled signal.
- Return type:
np.array
- decimate(Ei, param)
Decimate signal.
- Parameters:
Ei (np.array) – Input signal.
param (optic.utils.parameters object, optional) –
Parameters of the decimation process.
param.SpSin : samples per symbol of the input signal.
param.SpSout : samples per symbol of the output signal.
- Returns:
Eo – Decimated signal.
- Return type:
np.array
References
[1] P. S. R. Diniz, E. A. B. da Silva, e S. L. Netto, Digital Signal Processing: System Analysis and Design. Cambridge University Press, 2010.
- delaySignal(sig, delay, Fs=1, NFFT=1024)
Apply a time delay to a signal sampled at fs samples per second using FFT/IFFT algorithms.
- Parameters:
sig (ndarray) – The input signal.
delay (float) – The time delay to apply to the signal (in seconds).
Fs (float) – Sampling frequency of the signal (in samples per second). Default is 1.
NFFT (int, optional) – FFT size to be used. Must be greater than the length of the filter. If None, it will be set to the next power of 2 greater than or equal to the length of the filter. Default is None.
- Returns:
The delayed signal.
- Return type:
ndarray
- estimateWhiteningFilter(x, nTaps)
Estimate the coefficients of a whitening filter of order nTaps using the Levinson-Durbin algorithm.
- Parameters:
x (array-like) – The input signal from which to estimate the autocorrelation.
nTaps (int) – The order of the whitening filter (number of coefficients).
- Returns:
w – The coefficients of the whitening filter of length nTaps, where w[0] is the leading coefficient (usually 1).
- Return type:
np.ndarray
References
[1] Levinson, N., The Wiener RMS error criterion in filter design. Journal of Mathematics and Physics, 25(1-4), 261-278, 1947.
[2] Durbin, J., The fitting of time-series models. Review of the International Statistical Institute, 28(3), 233-244, 1960.
- finddelay(x, y)
Find delay between x and y.
- Parameters:
x (np.array) – Signal 1.
y (np.array) – Signal 2.
- Returns:
d – Delay between x and y, in samples.
- Return type:
int
- firFilter(h, x)
Perform FIR filtering and compensate for filter delay.
- Parameters:
h (np.array) – Coefficients of the FIR filter (impulse response, symmetric).
x (np.array) – Input signal.
- Returns:
y – Output (filtered) signal.
- Return type:
np.array
References
[1] P. S. R. Diniz, E. A. B. da Silva, e S. L. Netto, Digital Signal Processing: System Analysis and Design. Cambridge University Press, 2010.
- freqShift(x, deltaF, Fs)
Frequency shift of a signal.
- Parameters:
x (np.array) – Input signal.
deltaF (float) – Frequency shift (Hz).
Fs (float) – Sampling frequency (Hz).
- Returns:
y – Frequency shifted signal.
- Return type:
np.array
- gaussianComplexNoise(shapeOut, σ2=1.0, seed=None)
Generate complex circular Gaussian noise.
- Parameters:
shapeOut (tuple of int) – Shape of np.array to be generated.
σ2 (float, optional) – Variance of the noise (default is 1).
seed (int, optional) – Seed for the random number generator.
- Returns:
noise – Generated complex circular Gaussian noise.
- Return type:
np.array
- gaussianNoise(shapeOut, σ2=1.0, seed=None)
Generate Gaussian noise.
- Parameters:
shapeOut (tuple of int) – Shape of np.array to be generated.
σ2 (float, optional) – Variance of the noise (default is 1).
seed (int, optional) – Seed for the random number generator.
- Returns:
noise – Generated Gaussian noise.
- Return type:
np.array
- iqMixing(sig, param)
Add IQ mixing to a signal.
- Parameters:
sig (ndarray) – Input signal.
param (object, optional) –
Object containing parameters for IQ mixing.
- ampImbfloat, optional
Amplitude imbalance parameter in dB. Default is 0.
- phaseImbfloat, optional
Phase imbalance parameter (in radians). Default is 0.
- timeSkewfloat, optional
Skewness parameter for I component. Default is 0.
- Fsfloat, optional
Sampling frequency. Default is None.
- Returns:
IQ-mixed signal.
- Return type:
ndarray
- levinson(r, nTaps)
Levinson-Durbin algorithm
- Parameters:
r (array-like) – Autocorrelation coefficients of the signal, where r[0] is the zero-lag autocorrelation and r[k] is the autocorrelation at lag k.
nTaps (int) – The order of the whitening filter (number of coefficients to estimate).
- Returns:
a – The coefficients of the whitening filter of length nTaps, where a[0] is the leading coefficient (usually 1) and a[1], a[2], …, a[nTaps-1] are the estimated filter coefficients.
- Return type:
np.ndarray
Notes
The Levinson-Durbin algorithm is an efficient method for solving the Toeplitz system of equations that arises in linear prediction and filter design. The resulting coefficients can be used to design a whitening filter that decorrelates the input signal.
References
[1] Levinson, N., The Wiener RMS error criterion in filter design. Journal of Mathematics and Physics, 25(1-4), 261-278, 1947.
[2] Durbin, J., The fitting of time-series models. Review of the International Statistical Institute, 28(3), 233-244, 1960.
- lowPassFIR(fc, fs, N, typeF='rect')
Calculate FIR coefficients of a lowpass filter.
- Parameters:
fc (float) – Cutoff frequency.
fs (float) – Sampling frequency.
N (int) – Number of filter coefficients.
typeF (string, optional) – Type of response (‘rect’, ‘gauss’). The default is “rect”.
- Returns:
h – Filter coefficients.
- Return type:
np.array
References
[1] P. S. R. Diniz, E. A. B. da Silva, e S. L. Netto, Digital Signal Processing: System Analysis and Design. Cambridge University Press, 2010.
- movingAverage(x, N)
Calculate the sliding window moving average of a 2D NumPy array along each column.
- Parameters:
x (np.array) – Input 2D array with shape (M, N), where M is the number of samples and N is the number of columns.
N (int) – Size of the sliding window.
- Returns:
2D array containing the sliding window moving averages along each column.
- Return type:
np.array
Notes
The function pads the signal with zeros at both ends to compensate for the lag between the output of the moving average and the original signal.
- phaseNoise(lw, Nsamples, Ts, seed=None)
Generate realization of a random-walk phase-noise process.
- Parameters:
lw (scalar) – laser linewidth.
Nsamples (scalar) – number of samples to be draw.
Ts (scalar) – sampling period.
seed (int, optional) – Seed for the random number generator.
- Returns:
phi – realization of the phase noise process.
- Return type:
np.array
References
[1] M. Seimetz, High-Order Modulation for Optical Fiber Transmission. em Springer Series in Optical Sciences. Springer Berlin Heidelberg, 2009.
- pnorm(x)
Normalize the average power of each componennt of x.
- Parameters:
x (np.array) – Signal.
- Returns:
Signal x with each component normalized in power.
- Return type:
np.array
- pulseShape(param)
Generate a pulse shaping filter.
- Parameters:
param (core.parameter) –
Pulse shaping parameters: - param.pulseType : string (‘rect’,’nrz’,’rrc’,’rc’, ‘doubinary’)
Type of pulse shaping filter. The default is ‘rrc’.
- param.SpSint, optional
Number of samples per symbol of input signal. The default is 2.
- param.nFilterTapsint, optional
Number of filter coefficients. The default is 1024.
- param.rollOfffloat, optional
Rolloff of RRC filter. The default is 0.1.
- Returns:
filterCoeffs – Array of filter coefficients (normalized).
- Return type:
np.array
- quantizer(x, nBits=16, maxV=1, minV=-1)
Quantize the input signal using a uniform quantizer with the specified precision.
- Parameters:
x (np.array) – The input signal to be quantized.
nBits (int) – Number of bits used for quantization. The quantizer will have 2^nBits levels.
maxV (float, optional) – Maximum value for the quantizer’s full-scale range (default is 1).
minV (float, optional) – Minimum value for the quantizer’s full-scale range (default is -1).
- Returns:
The quantized output signal with the same shape as ‘x’, quantized using ‘nBits’ levels.
- Return type:
np.array
- rcFilterTaps(t, alpha, Ts)
Generate Raised Cosine (RC) filter coefficients.
- Parameters:
t (np.array) – Time values.
alpha (float) – RC roll-off factor.
Ts (float) – Symbol period.
- Returns:
coeffs – RC filter coefficients.
- Return type:
np.array
References
[1] Proakis, J. G., & Salehi, M. (2008). Digital Communications (5th Edition). McGraw-Hill Education.
- resample(Ei, param)
Resample signal to a desired sampling rate.
- Parameters:
Ei (np.array) – Input signal.
param (optic.utils.parameters object, optional) –
Parameters of the resampling process.
param.inFs : sampling rate of the input signal [default: 2].
param.outFs : sampling rate of the output signal [default: 2].
param.N : order of anti-aliasing filter [default: 501].
- Returns:
Eo – Resampled signal.
- Return type:
np.array
References
[1] P. S. R. Diniz, E. A. B. da Silva, e S. L. Netto, Digital Signal Processing: System Analysis and Design. Cambridge University Press, 2010.
- rrcFilterTaps(t, alpha, Ts)
Generate Root-Raised Cosine (RRC) filter coefficients.
- Parameters:
t (np.array) – Time values.
alpha (float) – RRC roll-off factor.
Ts (float) – Symbol period.
- Returns:
coeffs – RRC filter coefficients.
- Return type:
np.array
References
[1] Proakis, J. G., & Salehi, M. (2008). Digital Communications (5th Edition). McGraw-Hill Education.
- sigPow(x)
Calculate the average power of x per mode.
- Parameters:
x (np.array) – Signal.
- Returns:
Average power of x: P = mean(abs(x)**2).
- Return type:
scalar
- signalPower(x)
Calculate the total power of x.
- Parameters:
x (np.array) – Signal.
- Returns:
Total power of x: P = sum(abs(x)**2).
- Return type:
scalar
- symbolSync(rx, tx, SpS, mode='amp')
Symbol synchronizer.
- Parameters:
rx (np.array) – Received symbol sequence.
tx (np.array) – Transmitted symbol sequence.
SpS (int) – Samples per symbol of the received signal.
mode (string, optional) – Synchronization mode: “amp” (amplitude) or “real” (real part). The default is “amp”.
- Returns:
tx – Transmitted sequence synchronized to rx.
- Return type:
np.array
- upsample(x, factor)
Upsample a signal by inserting zeros between samples.
- Parameters:
x (np.array) – Input signal to upsample.
factor (int) – Upsampling factor. The signal will be upsampled by inserting factor - 1 zeros between each original sample.
- Returns:
xUp – The upsampled signal with zeros inserted between samples.
- Return type:
np.array
Notes
This function inserts zeros between the samples of the input signal to increase its sampling rate. The upsampling factor determines how many zeros are inserted between each original sample.
If the input signal is a 2D array, the upsampling is performed column-wise.
References
[1] P. S. R. Diniz, E. A. B. da Silva, e S. L. Netto, Digital Signal Processing: System Analysis and Design. Cambridge University Press, 2010.
DSP algorithms for equalization (optic.dsp.equalization)
|
Electronic chromatic dispersion compensation (EDC). |
|
General \(N \times N\) MIMO adaptive equalizer with several adaptive filtering algorithms available. |
|
Run the Manakov SSF digital backpropagation (symmetric, dual-pol.). |
|
Decision feedback adaptive equalizer (DFE) for SISO receivers. |
|
Decision-directed feedforward adaptive equalizer (FFE) for SISO receivers. |
|
Decision-directed Volterra equalizer implementation up to 3rd order for SISO receivers.. |
- dfe(x, dx, param)
Decision feedback adaptive equalizer (DFE) for SISO receivers.
- Parameters:
x (np.array) – Input signal to be equalized.
dx (np.array) – Desired (reference) signal.
param (optic.utils.parameters object) –
DFE parameters:
param.nTapsFF: number of feedforward taps [default: 5]
param.nTapsFB: number of feedback taps [default: 5]
param.SpS: samples per symbol [default: 1]
param.mu: step size [default: 0.0001]
param.nTrain: number of training symbols [default: 1000]
param.prec: precision [default: np.float32]
param.M: modulation order [default: 4]
param.constType: constellation type (‘pam’, ‘qam’, etc.) [default: ‘pam’]
param.f: initial feedforward coeffs [default: None]
param.b: initial feedback coeffs [default: None]
param.trainingMode: operation mode (‘data-aided’, ‘fulltime’) [default: ‘data-aided’]
param.preconvIters: number of pre-convergence iterations [default: 1]
- Returns:
yEq (np.array) – Equalized output signal.
f (np.array) – Final feedforward filter coefficients.
b (np.array) – Final feedback filter coefficients.
Notes
Training mode ‘data-aided’ uses the known training symbols for adaptation, while ‘fulltime’ continues to adapt using decision-directed mode even after the training phase.
Pre-convergence iterations can help the algorithm to converge better by restarting the adaptation process after the initial training phase.
References
[1] Proakis, J. G., & Salehi, M. (2008). Digital Communications (5th Edition). McGraw-Hill Education.
- edc(Ei, param)
Electronic chromatic dispersion compensation (EDC).
- Parameters:
Ei (np.array) – Input optical field.
param (optic.utils.parameters object) –
Parameters of the optical channel.
param.L: total fiber length [km][default: 50 km]
param.D: chromatic dispersion parameter [ps/nm/km][default: 16 ps/nm/km]
param.Fc: carrier frequency [Hz] [default: 193.1e12 Hz]
param.Fs: sampling frequency [Hz] [default: []]
param.Rs: symbol rate [baud] [default: 32e9]
param.NfilterCoeffs: number of filter coefficients [default: []]
param.Nfft: FFT size [default: []]
- Returns:
CD compensated signal.
- Return type:
np.array
References
[1] S. J. Savory, “Digital coherent optical receivers: Algorithms and subsystems”, IEEE Journal on Selected Topics in Quantum Electronics, vol. 16, nº 5, p. 1164–1179, set. 2010, doi: 10.1109/JSTQE.2010.2044751.
[2] K. Kikuchi, “Fundamentals of Coherent Optical Fiber Communications”, J. Lightwave Technol., JLT, vol. 34, nº 1, p. 157–179, jan. 2016.
- ffe(x, dx, param)
Decision-directed feedforward adaptive equalizer (FFE) for SISO receivers.
- Parameters:
x (np.array) – Input signal to be equalized.
dx (np.array) – Desired (reference) signal.
param (optic.utils.parameters object) –
FFE parameters:
param.nTaps: number of feedforward taps [default: 5]
param.mu: step size [default: 0.0001]
param.SpS: samples per symbol [default: 1]
param.nTrain: number of training symbols [default: 1000]
param.prec: precision [default: np.float32]
param.M: modulation order [default: 4]
param.constType: constellation type (‘pam’, ‘qam’, etc.) [default: ‘pam’]
param.f: initial feedforward coeffs [default: None]
param.trainingMode: operation mode (‘data-aided’, ‘fulltime’) [default: ‘data-aided’]
param.preconvIters: number of pre-convergence iterations [default: 1]
- Returns:
yEq (np.array) – Equalized output signal.
f (np.array) – Final feedforward filter coefficients.
Notes
Training mode ‘data-aided’ uses the known training symbols for adaptation, while ‘fulltime’ continues to adapt using decision-directed mode even after the training phase.
Pre-convergence iterations can help the algorithm to converge better by restarting the adaptation process after the initial training phase.
References
[1] S. Haykin, “Adaptive Filter Theory,” 5th ed., Pearson, 2013.
- manakovDBP(Ei, param)
Run the Manakov SSF digital backpropagation (symmetric, dual-pol.).
- Parameters:
Ei (np.array) – Input optical signal field.
param (optic.utils.parameters object) –
Physical/simulation parameters of the optical channel.
param.Ltotal: total fiber length [km][default: 400 km]
param.Lspan: span length [km][default: 80 km]
param.hz: step-size for the split-step Fourier method [km][default: 0.5 km]
param.alpha: fiber attenuation parameter [dB/km][default: 0.2 dB/km]
param.D: chromatic dispersion parameter [ps/nm/km][default: 16 ps/nm/km]
param.gamma: fiber nonlinear parameter [1/W/km][default: 1.3 1/W/km]
param.Fc: carrier frequency [Hz] [default: 193.1e12 Hz]
param.Fs: simulation sampling frequency [samples/second][default: None]
param.prec: numerical precision [default: np.complex128]
param.amp: ‘edfa’, ‘ideal’, or ‘None. [default:’edfa’]
param.maxIter: max number of iter. in the trap. integration [default: 10]
param.tol: convergence tol. of the trap. integration.[default: 1e-5]
param.nlprMethod: adap step-size based on nonl. phase rot. [default: True]
param.maxNlinPhaseRot: max nonl. phase rot. tolerance [rad][default: 2e-2]
param.prgsBar: display progress bar? bolean variable [default:True]
param.saveSpanN: specify the span indexes to be outputted [default:[]]
param.returnParameters: bool, return channel parameters [default: False]
- Returns:
Ech (np.array) – Optical signal after nonlinear backward propagation.
param (parameter object (struct)) – Object with physical/simulation parameters used in the split-step alg.
References
[1] E. Ip e J. M. Kahn, “Compensation of dispersion and nonlinear impairments using digital backpropagation”, Journal of Lightwave Technology, vol. 26, nº 20, p. 3416–3425, 2008, doi: 10.1109/JLT.2008.927791.
[2] E. Ip, “Nonlinear compensation using backpropagation for polarization-multiplexed transmission”, Journal of Lightwave Technology, vol. 28, nº 6, p. 939–951, mar. 2010, doi: 10.1109/JLT.2010.2040135.
- mimoAdaptEqualizer(x, param=None, dx=None)
General \(N \times N\) MIMO adaptive equalizer with several adaptive filtering algorithms available.
- Parameters:
x (np.array) – Input array.
dx (np.array, optional) – Syncronized exact symbol sequence corresponding to the received input array x.
param (optic.utils.parameters object, optional) –
Parameter object containing the following attributes:
numIter : int, number of pre-convergence iterations [default: 1]
nTaps : int, number of filter taps [default: 15]
mu : float or list of floats, step size parameter(s) [default: [1e-3]]
lambdaRLS : float, RLS forgetting factor [default: 0.99]
SpS : int, samples per symbol [default: 2]
H : np.array, coefficient matrix [default: []]
L : int or list of ints, length of the output of the training section [default: []]
Hiter : list, history of coefficient matrices [default: []]
storeCoeff : bool, flag indicating whether to store coefficient matrices [default: False]
runWL: bool, flag indicating whether to run the equalizer in the widely-linear mode [default: False]
alg : str or list of strs, specifying the equalizer algorithm(s) [default: [‘nlms’]]
constType : str, constellation type [default: ‘qam’]
M : int, modulation order [default: 4]
prgsBar : bool, flag indicating whether to display progress bar [default: True]
returnResults : bool, flag indicating whether to return all results [default: False]
prec: data type, precision of the computations [default: np.complex64]
- Returns:
yEq (np.array) – Equalized output array.
H (np.array) – Coefficient matrix.
errSq (np.array) – Squared absolute error array.
Hiter (list) – History of coefficient matrices.
Notes
Algorithms available: ‘cma’, ‘rde’, ‘nlms’, ‘dd-lms’, ‘da-rde’, ‘rls’, ‘dd-rls’, ‘static’.
References
[1] P. S. R. Diniz, Adaptive Filtering: Algorithms and Practical Implementation. Springer US, 2012.
[2] S. J. Savory, “Digital coherent optical receivers: Algorithms and subsystems”, IEEE Journal on Selected Topics in Quantum Electronics, vol. 16, nº 5, p. 1164–1179, set. 2010, doi: 10.1109/JSTQE.2010.2044751.
[3] K. Kikuchi, “Fundamentals of Coherent Optical Fiber Communications”, J. Lightwave Technol., JLT, vol. 34, nº 1, p. 157–179, jan. 2016.
[4] E. P. Da Silva e D. Zibar, “Widely Linear Equalization for IQ Imbalance and Skew Compensation in Optical Coherent Receivers”, Journal of Lightwave Technology, vol. 34, nº 15, p. 3577–3586, ago. 2016, doi: 10.1109/JLT.2016.2577716.
- volterra(x, dx, param)
Decision-directed Volterra equalizer implementation up to 3rd order for SISO receivers..
- Parameters:
x (np.array) – Input signal to be equalized.
dx (np.array) – Desired (reference) signal.
param (optic.utils.parameters object) –
Volterra equalizer parameters:
param.n1Taps: number of taps of linear part [default: 5]
param.n2Taps: number of taps of quadratic part [default: 3]
param.n3Taps: number of taps of cubic part [default: 2]
param.h: list of initial filter coefficients [default: None]
param.SpS: samples per symbol [default: 1]
param.mu: step size [default: 0.001]
param.nTrain: number of training symbols [default: 1000]
param.order: Volterra series order (2 for quadratic) [default: 2]
param.prec: precision [default: np.float32]
param.M: modulation order [default: 4]
param.constType: constellation type (‘pam’, ‘qam’, etc.) [default: ‘pam’]
param.trainingMode: operation mode (‘data-aided’, ‘fulltime’) [default: ‘data-aided’]
param.preconvIters: number of pre-convergence iterations [default: 1
- Returns:
yEq (np.array) – Equalized output signal.
h (list of np.array) – Final Volterra filter coefficients [h1, h2, h3].
Notes
Training mode ‘data-aided’ uses the known training symbols for adaptation, while ‘fulltime’ continues to adapt using decision-directed mode even after the training phase.
Pre-convergence iterations can help the algorithm to converge better by restarting the adaptation process after the initial training phase.
References
[1] Diniz, P. R., da Silva, E. A. B., & Netto, S. L. (2010). Adaptive Filtering: Algorithms and Practical Implementation. Springer Science & Business Media.
DSP algorithms for carrier phase and frequency recovery (optic.dsp.carrierRecovery)
Blind phase search (BPS) algorithm |
|
Decision-directed Phase-locked Loop (DDPLL) algorithm |
|
Viterbi & Viterbi carrier phase recovery algorithm. |
|
Estimate the frequency offset (FO) with the 4th-power method. |
|
Carrier phase recovery function (CPR) |
- bps(Ei, N, constSymb, B)
Blind phase search (BPS) algorithm
- Parameters:
Ei (complex-valued np.array) – Received constellation symbols.
N (int) – Half of the 2*N+1 average window.
constSymb (complex-valued np.array) – Complex-valued constellation.
B (int) – number of test phases.
- Returns:
phaseEst – Time-varying estimated phase-shifts.
- Return type:
real-valued np.array
References
[1] T. Pfau, S. Hoffmann, e R. Noé, “Hardware-efficient coherent digital receiver concept with feedforward carrier recovery for M-QAM constellations”, Journal of Lightwave Technology, vol. 27, nº 8, p. 989–999, 2009, doi: 10.1109/JLT.2008.2010511.
- cpr(Ei, param=None, symbTx=None)
Carrier phase recovery function (CPR)
- Parameters:
Ei (complex-valued np.array) – received constellation symbols.
param (optic.utils.parameter object, optional) –
Configuration parameters [default: None].
param.alg: CPR algorithm to be used [‘bps’, ‘bpsGPU’, ‘ddpll’, or ‘viterbi’] [default: ‘bps’].
param.shapingFactor: shaping factor, for probabilistic shaped QAM with MB dististribution.[default: 0]
param.constType: constellation type [‘qam’ or ‘psk’]. [default: ‘qam’]
param.M: constellation order. [default: 4]
param.returnPhases: whether to return the estimated phase shifts along with the output signal. [default: False]
BPS params:
param.N: length of BPS the moving average window. [default: 35]
param.B: number of BPS test phases. [default: 64]
DDPLL params:
param.tau1: DDPLL loop filter param. 1. [default: 1/2*pi*10e6]
param.tau2: DDPLL loop filter param. 2. [default: 1/2*pi*10e6]
param.Kv: DDPLL loop filter gain. [default: 0.1]
param.Ts: symbol period. [default: 1/32e9]
param.pilotInd: indexes of pilot-symbol locations.
Viterbi params:
param.N: length of the moving average window. [default: 35]
symbTx (complex-valued np.array, optional) – Transmitted symbol sequence. [default: None]
- Returns:
Eo (complex-valued np.array) – Phase-compensated signal.
phaseEst (real-valued np.array) – Time-varying estimated phase-shifts.
References
[1] T. Pfau, S. Hoffmann, e R. Noé, “Hardware-efficient coherent digital receiver concept with feedforward carrier recovery for M-QAM constellations”, Journal of Lightwave Technology, vol. 27, nº 8, p. 989–999, 2009, doi: 10.1109/JLT.2008.2010511.
[2] S. J. Savory, “Digital coherent optical receivers: Algorithms and subsystems”, IEEE Journal on Selected Topics in Quantum Electronics, vol. 16, nº 5, p. 1164–1179, set. 2010, doi: 10.1109/JSTQE.2010.2044751.
[3] H. Meyer, Digital Communication Receivers: Synchronization, Channel estimation, and Signal Processing, Wiley 1998. Section 5.8 and 5.9.
- ddpll(Ei, Ts, Kv, tau1, tau2, constSymb, symbTx, pilotInd)
Decision-directed Phase-locked Loop (DDPLL) algorithm
- Parameters:
Ei (complex-valued np.array) – Received constellation symbols.
Ts (float scalar) – Symbol period.
Kv (float scalar) – Loop filter gain.
tau1 (float scalar) – Loop filter parameter 1.
tau2 (float scalar) – Loop filter parameter 2.
constSymb (complex-valued np.array) – Complex-valued ideal constellation symbols.
symbTx (complex-valued np.array) – Transmitted symbol sequence.
pilotInd (int np.array) – Indexes of pilot-symbol locations.
- Returns:
phaseEst – Time-varying estimated phase-shifts.
- Return type:
real-valued np.array
References
[1] H. Meyer, Digital Communication Receivers: Synchronization, Channel estimation, and Signal Processing, Wiley 1998. Section 5.8 and 5.9.
- fourthPowerFOE(Ei, Fs, plotSpec=False)
Estimate the frequency offset (FO) with the 4th-power method.
- Parameters:
Ei (np.array) – Input signal.
Fs (float) – Sampling frequency.
plotSpec (bool, optional) – Whether to plot the spectrum. Default is False.
- Returns:
The output signal after applying frequency offset correction.
The estimated frequency offset.
- Return type:
np.array, float
References
[1] S. J. Savory, “Digital coherent optical receivers: Algorithms and subsystems”, IEEE Journal on Selected Topics in Quantum Electronics, vol. 16, nº 5, p. 1164–1179, set. 2010, doi: 10.1109/JSTQE.2010.2044751.
- viterbi(Ei, N=35, M=4)
Viterbi & Viterbi carrier phase recovery algorithm.
- Parameters:
Ei (np.array) – Input signal.
N (int, optional) – Size of the moving average window.
M (int, optional) – M-th power order.
- Returns:
Estimated phase error.
- Return type:
np.array, float
References
[1] S. J. Savory, “Digital coherent optical receivers: Algorithms and subsystems”, IEEE Journal on Selected Topics in Quantum Electronics, vol. 16, nº 5, p. 1164–1179, set. 2010, doi: 10.1109/JSTQE.2010.2044751.
DSP algorithms for clock and timming recovery (optic.dsp.clockRecovery)
Calculate the timing error using the Gardner timing error detector. |
|
Modified Gardner timing error detector for Nyquist pulses. |
|
Perform cubic interpolation using the Farrow structure. |
|
Perform clock recovery using Gardner's algorithm with a loop PI filter. |
|
Calculate the clock drift in parts per million (ppm) from t_nco values. |
- calcClockDrift(t_nco_values)
Calculate the clock drift in parts per million (ppm) from t_nco values.
- Parameters:
t_nco_values (np.array) – An array containing the relative time delay values provided to the NCO.
- Returns:
The clock deviation in parts per million (ppm).
- Return type:
float
- gardnerClockRecovery(Ei, param=None)
Perform clock recovery using Gardner’s algorithm with a loop PI filter.
- Parameters:
Ei (numpy.np.array) – Input array representing the received signal.
param (core.parameter) –
Clock recovery parameters:
param.kp : Proportional gain for the loop filter. [default: 1e-3]
param.ki : Integral gain for the loop filter. [default: 1e-6]
param.isNyquist: is the pulse shape a Nyquist pulse? [default: True]
param.returnTiming: return estimated timing values. [default: False]
param.lpad: length of zero padding at the end of the input vector. [default: 1]
param.maxPPM: maximum clock rate expected deviation in PPM. [default: 500]
- Returns:
Tuple containing the recovered signal (Eo) and the timing values.
- Return type:
tuple
- gardnerTED(x)
Calculate the timing error using the Gardner timing error detector.
- Parameters:
x (numpy.np.array) – Input array of size 3 representing a segment of the received signal.
- Returns:
Gardner timing error detector (TED) value.
- Return type:
float
- gardnerTEDnyquist(x)
Modified Gardner timing error detector for Nyquist pulses.
- Parameters:
x (numpy.np.array) – Input array of size 3 representing a segment of the received signal.
- Returns:
Gardner timing error detector (TED) value.
- Return type:
float
- interpolator(x, t)
Perform cubic interpolation using the Farrow structure.
- Parameters:
x (numpy.np.array) – Input array of size 4 representing the values for cubic interpolation.
t (float) – Interpolation parameter.
- Returns:
y – Interpolated signal value.
- Return type:
float
Signal synchronization functions (optic.dsp.synchronization)
|
Synchronize data sequences with a given reference sequence. |
- syncDataSequences(rx, tx, param)
Synchronize data sequences with a given reference sequence.
- Parameters:
rx (np.array) – Received signal.
tx (np.array) – Reference signal (or symbols).
param (optic.utils.parameters object, optional) –
Parameters of the synchronization process.
param.SpS : samples per symbol of the received signal. [default: 1]
param.reference : type of reference used for synchronization (‘signal’,’symbols’) [default: ‘signal’]
param.syncMode : use either the real part or the amplitude of the signal to syncronize [detault: ‘amp’]
param.pulseType : type of pulse shaping filter. [default: ‘rrc’]
param.rollOff : rolloff of RRC filter. [default: 0.01]
param.nFilterTaps : number of filter coefficients. [default: 1024]
param.constType : type of constellation [Default: ‘pam’]
param.M : modulation order. [default: 4]
- Returns:
tx_ (np.array) – Synchronized transmitted signal.
symb (np.array) – Detected transmitted symbols.
Notes
Signals rx and tx must have the same number of columns (modes).
If param.reference is set to ‘signal’, rx and tx should be sampled at the same rate.