torchsig.signals.builders.constellation.constellation_modulator

torchsig.signals.builders.constellation.constellation_modulator(class_name: str, pulse_shape_name: str, bandwidth: float, sample_rate: float, num_samples: int, alpha_rolloff: float | None = None, rng=Generator(PCG64) at 0x7694C485E180) ndarray[source]

Modulator for constellation-based signals (QAM/PSK/ASK/OOK).

Parameters:
  • class_name (str) – The modulation to create, ex: ‘qpsk’.

  • pulse_shape_name (str) – Pulse shaping filter selection, ‘rectangular’ or ‘srrc’ (square-root raised cosine).

  • bandwidth (float) – The desired 3 dB bandwidth of the signal. Must be in the same units as sample_rate and within the bounds 0 < bandwidth < sample_rate.

  • sample_rate (float) – The sampling rate for the IQ signal. The sample rate can use a normalized value of 1, or it can use a practical sample rate such as 10 MHz. However, it must use the same units as the bandwidth parameter.

  • num_samples (int) – The number of IQ samples to produce.

  • alpha_rolloff (float, optional) – The alpha-rolloff value for the SRRC filter. This is a pass through to constellation_baseband_modulator(). If pulse_shape_name == ‘recantangular’ then this value is ignored. If pulse_shape_name == ‘srrc’ then this value must be defined, and within the range 0 < alpha_rolloff < 1. Defaults to None.

  • rng (optional) – Seedable random number generator for reproducibility.

Raises:

ValueError – Raises ValueError if the number of samples produced is incorrect.

Returns:

Returns the constellation-modulated IQ samples at the appropriate center frequency and bandwidth.

Return type:

np.ndarray