impairments#
Transceiver and transmission impairment simulation.
Functions for the simulation of transmission and transceiver impairments.
- qampy.impairments.add_carrier_offset(sig, fo)#
Add frequency offset to signal
- Parameters:
sig (array_like) – signal input array
df (float) – frequency offset
- Returns:
signal – signal with added offset
- Return type:
array_like
- qampy.impairments.add_dispersion(sig, D, L, wl0=1.55e-06)#
Add dispersion to a signal
- Parameters:
sig (signal_object) – signal to operate on
D (float) – Dispersion parameter in s/m/m
L (float) – Length of the dispersion in m
wl0 (float, optional) – Centre wavelength in m
- Returns:
sig_out – output signal with added dispersion
- Return type:
signal_object
- qampy.impairments.apply_PMD(field, theta, t_dgd)#
Apply PMD to a given input field
- Parameters:
field (SignalObject) – input dual polarisation optical field (first axis is polarisation)
theta (float) – angle of the principle axis to the observed axis
t_dgd (float) – differential group delay between the polarisation axes
- Returns:
out – new dual polarisation field with PMD
- Return type:
SignalObject
- qampy.impairments.apply_phase_noise(signal, df)#
Add phase noise from local oscillators, based on a Wiener noise process.
- Parameters:
signal (array_like) – single polarisation signal
df (float) – combined linewidth of local oscillators in the system
- Returns:
out – output signal with phase noise
- Return type:
array_like
- qampy.impairments.change_snr(sig, snr)#
Change the SNR of a signal assuming that the input signal is noiseless
- Parameters:
sig (array_like) – the signal to change
snr (float) – the desired signal to noise ratio in dB
- Returns:
sig – output signal with given SNR
- Return type:
array_like
- qampy.impairments.sim_DAC_response(sig, enob=5, clip_rat=1, quant_bits=0, **dac_params)#
Function to simulate DAC response, including quantization noise (ENOB) and frequency response.
- Parameters:
sig (array_like) – Input signal
enob (float, optional) – Effective number of bits of the DAC (i.e. 6 bits.) modelled as AWGN. If enob=0 only quantize. If both enob and quant_bits are given, quantize first and then add enob noise.
clip_rat (float, optional) – Ratio of signal left after clipping. (i.e. clip_rat=0.8 means 20% of the signal is clipped) (default 1: no clipping)
quant_bits (float, optional) – Number of bits in the quantizer, only applied if not =0. (Default: don’t qpply quantization)
dac_params (dict, optional) – Parameters for the DAC response check apply_DAC_filter for the keyword parameters. If this is empty than do not apply the DAC response
- Returns:
filter_sig – Quantized, clipped and filtered output signal
- Return type:
array_like
- qampy.impairments.sim_mod_response(sig, dcbias=1, gfactr=1, cfactr=0, dcbias_out=0.5, gfactr_out=1)#
Simulate IQ modulator response.
- Parameters:
rfsig (array_like) – complex version of the I (real part) and Q (imaginary part) of the signal
dcsig (complex or float, optional) – DC bias for I (real) and Q (imaginary) channel. If dcsig is real use the same DC bias for I and Q
vpi (complex or float, optional) – Vpi of the MZM (zero-power point) in I (real) and Q (imaginary) channel. If vpi is real use the same Vpi for both.
gfactr (complex or float, optional) – Split imbalance and path dependent loss of I (real) and Q (imaginary) MZM. An ideal MZM with infinite extinction ratio has gfactor=1. If gfactr is real use the same value for both I and Q.
cfactr (complex or float, optional) – Chirp factors of I (real) and (Q) channel MZMs, caused by the asymmetry in the electrode design of the MZM. cfactr = 0 for ideal MZM.
prms_outer (array_like, optional) – DCBias, Vpi and gain factor of the outer MZM.
- Returns:
e_out – Output signal of IQ modulator. (i.e. Here assume that input laser power is 0 dBm)
- Return type:
array_like
- qampy.impairments.sim_tx_response(sig, enob=6, tgt_v=1, clip_rat=1, quant_bits=0, dac_params={'ch': None, 'cutoff': 18000000000.0, 'fn': None}, **mod_prms)#
Simulate a realistic transmitter possibly including quantization, noise due to limited ENOB, and DAC frequency response
- Parameters:
sig (array_like) – Input signal used for transmission
enob (float, optional) – efficient number of bits for DAC. If enob=0 only use quantizer. Unit: bits
tgt_v (float, optional) – target Voltage as fraction of Vpi
clip_rat (float, optional) – Ratio of signal left after clipping. (i.e. clip_rat=0.8 means 20% of the signal is clipped) (default 1: no clipping)
quant_bits (float, optional) – Number of bits in the quantizer, only applied if not =0. (Default: don’t qpply quantization)
dac_params (dict, optional) – parameters to pass to the DAC filter
mod_prms (dict, optional) – parameters to pass to the modulator
- Returns:
e_out – Signal with TX impairments
- Return type:
array_like
- qampy.impairments.simulate_transmission(sig, snr=None, freq_off=None, lwdth=None, dgd=None, theta=0.8420242973974251, modal_delay=None, dispersion=None, roll_frame_sync=False)#
Convenience function to simulate impairments on signal at once
- Parameters:
sig (array_like) – input signal
snr (flaat, optional) – desired signal-to-noise ratio of the signal. (default: None, don’t change SNR)
freq_off (float, optional) – apply a carrier offset to signal (default: None, don’t apply offset)
lwdth (float) – linewidth of the transmitter and LO lasers (default: None, infinite linewidth)
dgd (float) – first-order PMD (differential group delay) (default: None, do not apply PMD)
theta (float) – rotation angle to principle states of polarization
modal_delay (array_like, optional) – add a delay given in N samples to the signal (default: None, do not add delay)
dispersion (float, optional) – dispersion in s/m
- Returns:
signal – signal with transmission impairments applied
- Return type:
array_like