Esempio n. 1
0
 def test_add_modal_delay(self, dtype):
     s = signals.SignalQAMGrayCoded(16,
                                    2**16,
                                    fb=10e9,
                                    nmodes=2,
                                    dtype=dtype)
     s2 = cimpairments.add_modal_delay(s, [0, 1000])
     assert s.dtype == s2.dtype
Esempio n. 2
0
def simulate_transmission(sig,
                          snr=None,
                          freq_off=None,
                          lwdth=None,
                          dgd=None,
                          theta=np.pi / 3.731,
                          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 : array_like
        signal with transmission impairments applied
    """
    if roll_frame_sync:
        if not (sig.nframes > 1):
            warnings.warn(
                "Only single frame present, discontinuity introduced")
        sig = np.roll(sig, sig.pilots.shape[1], axis=-1)
    if lwdth is not None:
        sig = apply_phase_noise(sig, lwdth)
    if freq_off is not None:
        sig = add_carrier_offset(sig, freq_off)
    if snr is not None:
        sig = change_snr(sig, snr)
    if modal_delay is not None:
        sig = add_modal_delay(sig, modal_delay)
    if dispersion is not None:
        sig = add_dispersion(sig, D, 1)
    if dgd is not None:
        sig = apply_PMD(sig, theta, dgd)
    return sig
Esempio n. 3
0
def simulate_transmission(sig, snr=None, freq_off=None, lwdth=None, dgd=None, theta=np.pi/3.731, modal_delay=None):
    """
    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)
    Returns
    -------
    signal : array_like
        signal with transmission impairments applied
    """
    if lwdth is not None:
        sig = apply_phase_noise(sig, lwdth)
    if freq_off is not None:
        sig = add_carrier_offset(sig, freq_off)
    if snr is not None:
        sig = change_snr(sig, snr)
    if modal_delay is not None:
        sig = add_modal_delay(sig, modal_delay)
    if dgd is not None:
        sig = apply_PMD(sig, theta, dgd)
    return sig