signals#

Signal objects

signals#

QAMPy signal objects for the basic API. The signal objects are numpy ndarray subclasses that contain additional attributes and modules that define signals, such as sampling- and symbol-rate, the bits for generating the object etc..

In general signal objects can be manipulated like numpy arrays, and most operations preserve signal objects, therefore one should check if the returned objects are signal objects.

Warning

Some numpy functions preserve the subclass object type but do not pass the attributes and methods, np.concatenate does this.

class qampy.signals.PRBSBits(N, nmodes=1, seed=[None, None], order=[15, 23])#

Returns an 2-D array-object of random bits with shape (nmodes, N) Bits are integers 0,1 generated via a external XOR PRBS shift register

Parameters:
  • N (int) – length of the bit sequence

  • nmodes (int) – number of modes/polarizations

  • seed (tuple(int,..), optional) – seeds for the PRBS generator. If the list is shorter than nmodes, than choose random seeds

  • order (tuple(int,...), optional) – PRBS patter order, can be one of 7, 15, 23 and 31. One for each mode should be given. Otherwise we choose one from 15 and 23 (due to performance reasons)

__seed#

tuple(int, …) tuple of ints for the PRBS seed, per mode

__order#

tuple(int,…) tuple of ints for the PRBS order per mode

class qampy.signals.QPSKfromBERT(N, nmodes=1, fb=1, prbsorders=((15,), (15,)), prbsshifts=(0, 0), prbsinvert=(False, False), dtype=np.complex128)#

A QPSK signal where I and Q are generated from either delayed data and data_bar ports or two independent ports of a bit error rate tester.

Parameters:
  • N (int) – number of symbols in signal

  • nmodes (int) – number of modes/polarizations

  • fb (float, optional) – symbol rate

  • prbsorders (tuple(tuple(int),tuple(int)), optional) – orders of the PRBS patterns,

  • prbsshifts (tuple(int, int), optional) – optional delay of the I and Q PRBS patterns

  • prbsinvert (tuple(bool, bool), optional) – wether one of the two patterns is inverted, this is needed if a data_bar port is used

  • dtype (np.dtype, optional) – dtype of the signal, must be one of np.complex128 or np.complex64

class qampy.signals.RandomBits(N, nmodes=1, seed=None)#

Returns an 2-D array-object of random bits with shape (nmodes, N) Bits are integers 0,1 generated via np.random.randint.

Parameters:
  • N (int) – length of the bit sequence

  • nmodes (int) – number of modes/polarizations

  • seed (int, optional) – seed for the numerical number generator

__seed#

float seed to the random number generator

__rand_state#

np.random.RandomState object of the random state

class qampy.signals.ResampledQAM(M, N, fb=1, fs=1, resamplekwargs={'beta': 0.1}, **kwargs)#

Convenience object to provide a SiggnalQAMGrayCoded object with different sampling rate than the symbol rate.

Parameters:
  • M (int) – QAM order

  • N (int) – number of symbols per polarization

  • fb (float, optional) – symbol rate

  • fs (float, optional) – sampling rate

  • **kwargs – kword arguments to pass to SignalQAMGrayCoded class

Return type:

resampled signal

classmethod from_symbol_array(array, fs, **kwargs)#

Generate signal from a given symbol array.

Parameters:
  • symbs (subclass of SignalBase) – symbol array to base on

  • M (int, optional) – QAM order (default: None means deduce from np.unique(symbs), Note that this is errorprone especially for short sequences)

  • fb (float, optional) – symbol rate

  • dtype (np.dtype, optional) – dtype for the signal. The default of None means use the dtype from symbols

Returns:

output – output signal based on symbol array

Return type:

SignalQAMGrayCoded

class qampy.signals.SignalBase#
cal_ber(signal_rx=None, synced=False, verbose=False)#

Calculate the bit-error-rate for the received signal compared to transmitted symbols or bits. Currently does not check for correct polarization.

Parameters:
  • signal_rx (array_like) – received signal to demodulate and calculate BER of

  • bits_tx (array_like, optional) – transmitted bit sequence to compare against.

  • symbols_tx (array_like, optional) – transmitted bit sequence to compare against.

  • synced (bool, optional) – whether signal_tx and symbol_tx are synchronised.

  • verbose (bool, optional) – return the vector of symbol errors

Note

If neither bits_tx or symbols_tx are given, we use the self.symbols_tx

Returns:

  • ber (array_like) – bit-error-rate in linear units per dimension

  • if verbose is True also return

  • errs (array_like) – bit errors

  • tx_synced (array_like) – synchronized transmitter bits

cal_evm(signal_rx=None, synced=False, blind=False)#

Calculate the Error Vector Magnitude of the input signal either blindly or against a known symbol sequence, after _[1]. The EVM here is normalised to the average symbol power, not the peak as in some other definitions. Currently does not check for correct polarization.

Parameters:
  • synced

  • signal_rx (array_like) – input signal to measure the EVM offset

  • blind (bool, optional) – calculate the blind EVM (make symbol decisions without taking into account symbol errors). For low SNRs this will underestimate the real EVM, because detection errors are not counted.

  • symbols_tx (array_like, optional) – known symbol sequence. If this is None self.symbols_tx will be used unless blind is True.

Returns:

evm – RMS EVM per dimension

Return type:

array_like

References

…[1] Shafik, R. “On the extended relationships among EVM, BER and SNR as performance metrics”. In Conference on Electrical and Computer Engineering (p. 408) (2006).

Retrieved from http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4178493

Note

The to calculate the EVM in dB from the RMS EVM we need calculate 10 log10(EVM**2). This differs from some defintions of EVM, e.g. on wikipedia.

cal_gmi(signal_rx=None, synced=False, snr=None, llr_minmax=False)#

Calculate the generalized mutual information for the received signal.

Parameters:
  • signal_rx (array_like) – equalised input signal

  • symbols_tx (array_like) – transmitted symbols (default:None use self.symbols_tx of the modulator)

  • synced (bool, optional) – wether input and outputs are synchronized

  • snr (float, optional) – estimate of SNR in dB, if not given use the signal to estimate

  • llr_minmax (bool, optional) – use minmax method for log-likelyhood ratio calculation, much faster but more unaccurate (we do not minimize over s)

Returns:

  • gmi (array_like) – generalized mutual information per mode

  • gmi_per_bit (array_like) – generalized mutual information per transmitted bit per mode

cal_mi(signal_rx=None, synced=False, snr=None, fast=True)#

Calculate the mutual information for the received signal.

Parameters:
  • signal_rx (array_like) – equalised input signal

  • symbols_tx (array_like) – transmitted symbols (default:None use self.symbols_tx of the modulator)

  • synced (bool, optional) – wether input and outputs are synchronized

  • snr (float, optional) – estimate of SNR in dB, if not given use the signal to estimate

  • fast (bool, optional) – use fast calculation method

Returns:

mi – generalized mutual information per mode

Return type:

array_like

cal_ser(signal_rx=None, synced=False, verbose=False)#

Calculate the symbol error rate of the received signal.Currently does not check for correct polarization.

Parameters:
  • signal_rx (array_like) – Received signal (2D complex array)

  • symbols_tx (array_like, optional) – symbols at the transmitter for comparison against signal.

  • bits_tx (array_like, optional) – bitstream at the transmitter for comparison against signal.

  • synced (bool, optional) – whether signal_tx and symbol_tx are synchronised.

  • verbose (bool, optional) – return the vector of symbol errors

Note

If neither symbols_tx or bits_tx are given use self.symbols_tx

Returns:

  • SER (array_like) – symbol error rate per dimension

  • if verbose is True also return

  • errs (array_like) – symbol errors

  • symbols_tx (array_like) – synchronized transmitted symbols

est_snr(signal_rx=None, synced=False, symbols_tx=None, verbose=False)#

Estimate the SNR of a given input signal, using known symbols.

Parameters:
  • signal_rx (array_like) – input signal

  • symbols_tx (array_like, optional) – known transmitted symbols (default: None means that self.symbols_tx are used)

  • synced (bool, optional) – whether the signal and symbols are synchronized already

  • verbose (bool, optional) – return estimate noise and signal powers

Returns:

snr – snr estimate per dimension

Return type:

array_like

normalize_and_center(symbol_based=False, synced=False)#

Normalize and center the signal

Parameters:
  • symbol_based (bool, optional) – Estimate signal power based on symbols instead of overall average power. This is necessary at low SNRs <0, because otherwise we normalise to noise power. (default: use the fast mean power normalisation)

  • synced (bool, optional) – wether the signal is synchronized only has an effect for symbol based estimation

class qampy.signals.SignalPSKGrayCoded(M, N, nmodes=1, fb=1, bitclass=<class 'qampy.signals.RandomBits'>, dtype=<class 'numpy.complex128'>, **kwargs)#
class qampy.signals.SignalQAMGrayCoded(M, N, nmodes=1, fb=1, bitclass=<class 'qampy.signals.RandomBits'>, dtype=<class 'numpy.complex128'>, **kwargs)#
property Nbits#

Number of bits per symbol

demodulate(symbols)#

Decode array of input symbols to bits according to the coding of the modulator.

Parameters:

symbols (array_like) – array of complex input symbols

Note

Unlike the other functions this function does not always return a 2D array.

Returns:

outbits – for i in range(signal.shape[0]): outsyms[i] = make_decision(utils.normalise_and_center(signal[i]), self.coded_symbols) array of booleans representing bits with same number of dimensions as symbols

Return type:

array_like

classmethod from_bit_array(bits, M, fb=1, dtype=<class 'numpy.complex128'>)#

Generate a signal array from a given bit array.

Parameters:
  • bits (PRBSBits or RandomBits) – 2-D bitarray

  • M (int) – QAM order

  • fb (float, optional) – symbol rate

  • dtype (np.dtype, optional) – dtype of the signal, must be one of np.complex128 or np.complex64

Returns:

output – output signal based on symbol array

Return type:

SignalQAMGrayCoded

classmethod from_symbol_array(symbs, M=None, fb=1, dtype=None)#

Generate signal from a given symbol array.

Parameters:
  • symbs (subclass of SignalBase) – symbol array to base on

  • M (int, optional) – QAM order (default: None means deduce from np.unique(symbs), Note that this is errorprone especially for short sequences)

  • fb (float, optional) – symbol rate

  • dtype (np.dtype, optional) – dtype for the signal. The default of None means use the dtype from symbols

Returns:

output – output signal based on symbol array

Return type:

SignalQAMGrayCoded

make_decision(signal=None, verbose=False)#

Make symbol decisions based on the input field. Decision is made based on difference from constellation points

Parameters:

signal (array_like) – 2D array of the input signal

Returns:

symbols – 2d array of the detected symbols

Return type:

array_like

modulate(data)#

Modulate a bit sequence into QAM symbols

Parameters:

data (array_like) – 1D array of bits represented as bools. If the len(data)%self.M != 0 then we only encode up to the nearest divisor

Returns:

outdata – 1D array of complex symbol values. Normalised to energy of 1

Return type:

array_like

class qampy.signals.SignalWithPilots(M, frame_len, pilot_seq_len, pilot_ins_rat, nframes=1, pilot_scale=1, Mpilots=4, dataclass=<class 'qampy.signals.SignalQAMGrayCoded'>, nmodes=1, dtype=<class 'numpy.complex128'>, **kwargs)#
SignalWithPilots(M, frame_len, pilot_seq_len, pilot_ins_rat, nframes=1, pilot_scale=1, Mpilots=4,

dataclass=SignalQAMGrayCoded, nmodes=1, dtype=np.complex128, **kwargs):

Pilot-based signal consisting of a pilot sequence at the beginning and evenly spaced phase pilots starting one symbol after the pilot sequence. Pilots are placed in the same position for all modes.

Parameters:
  • M (int) – QAM order of the data payload

  • frame_length (int) – overall length of the signal comprised of the pilot sequence, the phase pilots and the data payload. Note that subframes = (frame_length - pilot_seq_len)/pilot_ins_rat must be an integer

  • pilot_seq_len (int) – number of pilots at the beginning of the frame

  • pilot_ins_rat (int) – phase pilots are spaced every pilot_ins_symbol starting at the first symbol after the pilot sequence

  • nframes (int, optional) – how often to repeat the overall frame

  • pilot_scale (float, optional) – factor by which to multiply the pilots for power scaling

  • Mpilots (int, optional) – QAM order of the pilots in the sequence and the phase pilots

  • dataclass (SignaBase subclass, optional) – class of the data signal array

  • nmodes (int, optional) – number of spatial modes

  • dtype (np.dtype, optional) – numpy dtype currently np.complex128 and np.complex64 are supported

  • **kwargs – keyword arguments to pass to the pilot and data generation classes

Returns:

pilot-based signal of shape (nmodes, frame_len*nframes)

Return type:

SignalWithPilots

pilots#

single array consisting of pilotsequence and phase pilots

Type:

SignalQAMGrayCoded

pilots_seq#

the pilot sequence

Type:

SignalQAMGrayCoded

ph_pilots#

the phase pilots

Type:

SignalQAMGrayCoded

symbols#

data symbols

Type:

SignalBase subclass object

frame_len#

length of the full sequence frame

Type:

int

nframes#

number of frames in the signal

Type:

int

pilot_scale#

the scaling factor for the pilot amplitude

Type:

float

cal_ber(frames=None, synced=True, signal_rx=None, verbose=False)#

Calculate Bit Error Rate on the data payload.

Parameters:
  • frames (array_like, optional) – which frames to calculate the ber for (default: None estimate for all frames in signal)

  • synced (bool, optional) – if the signal is synced or not by default this is true for pilot signals, however if no phase tracker is run it is possible that modes are rotated in the IQ-plane, which would result in errors

  • signal_rx (SignalBase object, optional) – signal on which to measure SER. Default: None -> calculate SER on self

  • verbose (bool, optional) – return the vector of symbol errors

Returns:

BER – BER per mode

Return type:

array_like

cal_evm(frames=None, synced=True, signal_rx=None, blind=False)#

Calculate Error Vector Magnitude on the data payload.

Parameters:
  • frames (array_like, optional) – which frames to calculate the evm for (default: None estimate for all frames in signal)

  • synced (bool, optional) – if the signal is synced or not by default this is true for pilot signals, however if no phase tracker is run it is possible that modes are rotated in the IQ-plane, which would result in errors

  • signal_rx (SignalBase object, optional) – signal on which to measure SER. Default: None -> calculate SER on self

  • blind (bool, optional) – perform blind EVM calculation without knowledge of transmitted symbols. Note that this significantly underestimates the real EVM at low SNRs.

Returns:

EVM – EVM per mode

Return type:

array_like

cal_gmi(frames=None, synced=True, snr=None, signal_rx=None, use_pilot_snr=False)#

Calculate Generalised Mutual Information on the data payload

Parameters:
  • frames (array_like, optional) – which frames to calculate the gmi for (default: None estimate for all frames in signal)

  • synced (bool, optional) – if the signal is synced or not by default this is true for pilot signals, however if no phase tracker is run it is possible that modes are rotated in the IQ-plane, which would result in errors

  • snr (float, optional) – Estimate of the signal SNR, if not given use the data to calculate

  • signal_rx (SignalBase object, optional) – signal on which to measure SER. Default: None -> calculate SER on self

  • use_pilot_snr (bool, optional) – use the pilots to calculate the SNR instead of the data

Returns:

  • GMI (array_like) – GMI per mode

  • gmi_per_bit (array_like) – generalized mutual information per transmitted bit per mode

cal_ser(frames=None, synced=True, signal_rx=None, verbose=False)#

Calculate Symbol Error Rate on the data payload.

Parameters:
  • frames (array_like, optional) – which frames to calculate the ser for (default: None estimate for all frames in signal)

  • synced (bool, optional) – if the signal is synced or not by default this is true for pilot signals, however if no phase tracker is run it is possible that modes are rotated in the IQ-plane, which would result in errors

  • signal_rx (SignalBase object, optional) – signal on which to measure SER. Default: None -> calculate SER on self

  • verbose (bool, optional) – return the vector of symbol errors

Returns:

SER – SER per mode

Return type:

array_like

est_snr(frames=None, synced=True, signal_rx=None, symbols_tx=None, use_pilots=False)#

Estimate SNR using known symbols.

Parameters:
  • frames (array_like or None, optional) – which frames to estimate SNR for (default: None estimate for all frames in signal)

  • synced (bool, optional) – if the signal is synced or not by default this is true for pilot signals, however if no phase tracker is run it is possible that modes are rotated in the IQ-plane, which would result in errors

  • signal_rx (SignalBase object, optional) – signal on which to measure SER. Default: None -> calculate SER on self

  • symbols_tx (array_like, optional) – symbols to use in SNR estimation, default: None use self.symbols

  • use_pilots (bool, optional) – use the pilots for SNR estimation

Returns:

SNR – estimated SNR per mode

Return type:

array_like

extract_pilots(frames=None)#

Get pilots. Note this only works on signal sampled at the symbol rate and assumes that the signal is already aligned so that it starts with the pilot sequence.

Parameters:

frames (array_like, optional) – which frames to get the pilots for (default: None get for all frames in signal)

Returns:

outdata – the recovered data symbols

Return type:

SignalBase object

classmethod from_symbol_array(payload, frame_len, pilot_seq_len, pilot_ins_rat, pilots=None, pilot_idx=None, nframes=1, pilot_scale=1, payload_is_frame=False, pilot_class=<class 'qampy.signals.SignalQAMGrayCoded'>, pilot_kwargs={'M': 4}, payload_class=<class 'qampy.signals.SignalQAMGrayCoded'>, payload_kwargs={}, **kwargs)#

Generate a pilot-bases signal from a provided payload symbol signal object.

Parameters:
  • payload (SignalBase subclasss or ndarray) – The payload symbols needs to be long enough to fill one frame. If it is longer than required the data will be truncated

  • frame_length (int) – overall length of the signal comprised of the pilot sequence, the phase pilots and the data payload.

  • pilot_seq_len (int) – number of pilots at the beginning of the frame

  • pilot_ins_rat (int) – phase pilots are spaced every pilot_ins_symbol starting at the first symbol after the pilot sequence

  • pilots (SignalBase subclass or ndarray, optional) – use pilot signal object if given, otherwise generate pilots. If given the number of modes for the pilots needs to be one or the same as that of the data. If it is one pilots we extend along that dimension.

  • pilot_idx (array_like, optional) – indices of the pilots. If this is given pilot_seq_len and pilot_ins_rat are ignored (default: None, means use pilot_seq_len and pilot_ins_rat instead)

  • nframes (int, optional) – how often to repeat the overall frame

  • pilot_scale (float, optional) – factor by which to multiply the pilots for power scaling

  • payload_is_frame (bool, optional) – if True this indicates that the payload contains payload data and pilots

  • pilot_class (signal_object_class, optional) – class of the pilot object. This needs to be subclass of the SignalBase. This will only have an effect if the given pilots are not given or are a numpy array

  • pilot_args (dict, optional) – arguments to generate pilot object if they are arrays

  • payload_class (signal_object_class, optional) – class of the payload object. This needs to be a subclass of SignalBase

  • payload_args (dict, optional) – argument to generate payload object if they are arrays

  • kwargs – keyword arguments passed to both payload and pilot objects

Returns:

pilot-based signal of shape (nmodes, frame_len*nframes)

Return type:

signal

get_data(frames=None)#

Get data payload by removing the pilots. Note this only works on signal sampled at the symbol rate and assumes that the signal is already aligned so that it starts with the pilot sequence.

Parameters:

frames (array_like, optional) – which frames to get the data for

Returns:

outdata – the recovered data symbols

Return type:

SignalBase object

sync2frame(returntaps=False, usepilots=-1, **kwargs)#

Synchronize the signal to the pilot frame, by finding the offsets into the frame where the sequence starts. This function rearranges the modes according to the found syncs. After the sync, there will be a shift_factors attribute which contains the shifts to the pilot sequence.

Parameters:
  • returntaps (bool, optional) – wether to return the equaliser taps

  • **kwargs

    arguments to be passed to the equaliser, the defaults are:

    {“adaptive_stepsize”: True, “Niter”: 10, “method”: “cma”, “Ntaps”:17, “mu”: 5e-3}

class qampy.signals.SymbolOnlySignal(M, N, symbols nmodes=1, fb=1, dtype=np.complex128)#

2-D array subclass of ndarray representing signal for a given arbitrary symbol array, without a mapping to bits. This method can be used for example to create signals which use an arbitrary modulation format without specifying how this maps to bits.

Parameters:
  • M (int) – QAM order

  • N (int) – number of symbols per mode

  • symbols (array_like) – symbol alphabet to choice symbols from

  • nmodes (int, optional) – number of modes/polarizations

  • fb (float, optional) – symbol rate

  • dtype (numpy dtype, optional) – dtype of the array. Should be either np.complex128 (default) for double precision or np.complex64

Note that the below attributes are read-only and should not be adjusted manually.

fb#

float symbol rate of the signal

fs#

float sampling rate

M#

int QAM order

coded_symbols#

array_like the symbol alphabet

bits#

array_like the bit sequence that is modulated to the signal

symbol#

array_like the base symbols that the signal is based on, this will always be inherited in operations. Signal quality measurements such as SER are comparing against this sequence

cal_ber(signal_rx=None)#

Calculate the bit-error-rate for the received signal compared to transmitted symbols or bits. Currently does not check for correct polarization.

Parameters:
  • signal_rx (array_like) – received signal to demodulate and calculate BER of

  • bits_tx (array_like, optional) – transmitted bit sequence to compare against.

  • symbols_tx (array_like, optional) – transmitted bit sequence to compare against.

  • synced (bool, optional) – whether signal_tx and symbol_tx are synchronised.

  • verbose (bool, optional) – return the vector of symbol errors

Note

If neither bits_tx or symbols_tx are given, we use the self.symbols_tx

Returns:

  • ber (array_like) – bit-error-rate in linear units per dimension

  • if verbose is True also return

  • errs (array_like) – bit errors

  • tx_synced (array_like) – synchronized transmitter bits

cal_gmi(signal_rx=None, snr=None)#

Calculate the generalized mutual information for the received signal.

Parameters:
  • signal_rx (array_like) – equalised input signal

  • symbols_tx (array_like) – transmitted symbols (default:None use self.symbols_tx of the modulator)

  • synced (bool, optional) – wether input and outputs are synchronized

  • snr (float, optional) – estimate of SNR in dB, if not given use the signal to estimate

  • llr_minmax (bool, optional) – use minmax method for log-likelyhood ratio calculation, much faster but more unaccurate (we do not minimize over s)

Returns:

  • gmi (array_like) – generalized mutual information per mode

  • gmi_per_bit (array_like) – generalized mutual information per transmitted bit per mode

demodulate(symbols)#

Decode array of input symbols to bits according to the coding of the modulator.

Parameters:

symbols (array_like) – array of complex input symbols

Note

Unlike the other functions this function does not always return a 2D array.

Returns:

outbits – for i in range(signal.shape[0]): outsyms[i] = make_decision(utils.normalise_and_center(signal[i]), self.coded_symbols) array of booleans representing bits with same number of dimensions as symbols

Return type:

array_like

est_snr(signal_rx=None)#

Estimate the SNR of a given input signal, using known symbols.

Parameters:
  • signal_rx (array_like) – input signal

  • symbols_tx (array_like, optional) – known transmitted symbols (default: None means that self.symbols_tx are used)

  • synced (bool, optional) – whether the signal and symbols are synchronized already

  • verbose (bool, optional) – return estimate noise and signal powers

Returns:

snr – snr estimate per dimension

Return type:

array_like

classmethod from_bit_array(bits, M, fb=1)#

Generate a signal array from a given bit array.

Parameters:
  • bits (PRBSBits or RandomBits) – 2-D bitarray

  • M (int) – QAM order

  • fb (float, optional) – symbol rate

  • dtype (np.dtype, optional) – dtype of the signal, must be one of np.complex128 or np.complex64

Returns:

output – output signal based on symbol array

Return type:

SignalQAMGrayCoded

classmethod from_symbol_array(symbs, coded_symbols=None, fb=1)#

Generate signal from a given symbol array.

Parameters:
  • symbs (subclass of SignalBase) – symbol array to base on

  • coded_symbols (array_like, optional) – symbol alphabet, this is needed for making decisions. If None use np.unique(symbs) to deduce (error-prone)

  • fb (float, optional) – symbol rate

Returns:

output – output signal based on symbol array

Return type:

SymbolOnlySignal

make_decision(signal=None)#

Make symbol decisions based on the input field. Decision is made based on difference from constellation points

Parameters:

signal (array_like) – 2D array of the input signal

Returns:

symbols – 2d array of the detected symbols

Return type:

array_like

modulate(data)#

Modulate a bit sequence into QAM symbols

Parameters:

data (array_like) – 1D array of bits represented as bools. If the len(data)%self.M != 0 then we only encode up to the nearest divisor

Returns:

outdata – 1D array of complex symbol values. Normalised to energy of 1

Return type:

array_like

class qampy.signals.TDHQAMSymbols(M, N, fr=0.5, power_method='dist', M1class=<class 'qampy.signals.SignalQAMGrayCoded'>, M2class=<class 'qampy.signals.SignalQAMGrayCoded'>, **kwargs)#
TDHQAMSymbols(M, N, fr=0.5, power_method=”dist”,

M1class=SignalQAMGrayCoded, M2class=SignalQAMGrayCoded, **kwargs)

Time-domain hybrid QAM (TDHQAM) modulator with two QAM-orders.

Parameters:
  • M (tuple(int, int)) – QAM orders of the two QAM components

  • fr (float, optional) – fraction of the second format of the overall frame length

  • power_method (string, optional) – method to calculate the power ratio of the different orders, currently on “dist” is implemented

  • M1class (SignalBase subclass, optional) – Class of the first QAM signal subpart

  • M2class (SignalBase subclass, optional) – Class of the second QAM signal subpart

Return type:

time-domain hybrid signal array

fr#

fraction of the second format of the overall frame length

Type:

float

powratio#

power ratio of P(M1)/P(M2)

Type:

float

f_M#

total frame length

Type:

int

f_M1#

number of M1 symbols in total frame

Type:

int

f_M2#

number of M2 symbols in total frame

Type:

int

M#

tuple of the two QAM orders

Type:

tuple(int, int)

symbols_M1#

the M1 symbol array

Type:

SignalBase subclass object

symbols_M2#

the M2 symbol array

Type:

SignalBase subclass object

fb#

symbol rate

Type:

float

fs#

sampling rate

Type:

float

static calculate_power_ratio(M1symbols, M2symbols, method='dist')#

Calculate the power ratio between the two QAM orders

Parameters:
  • M1symbols (SignalBase subclass object) – M1 symbol array

  • M2symbols (SignalBase subclass object) – M2 symbol arrayM1symbols

  • method (str) – method to calculate power ratio calculation currently only “dist” which spaces constellation points at equal distance is supported

Returns:

ratio – the ratio of M2 power over M1

Return type:

float

classmethod from_symbol_arrays(syms_M1, syms_M2, fr, power_method='dist')#

Generate a TDHQAM signal from two symbol arrays

Parameters:
  • syms_M1 (SignalBase subclass object) – M1 symbol array

  • syms_M2 (SignalBase subclass object) – M2 symbol array

  • fr (float) – fraction of M2 symbols over total frame length

  • power_method (str, optional) – power ratio calculation currently only “dist” which spaces constellation points at equal distance is supported

Returns:

signal – output time-domain hybrid QAM signal

Return type:

SignalBase subclass object