torchsig.signals.builders.constellation.constellation_modulator

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

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

Parameters:
  • constellation_name – The modulation to create (e.g., ‘qpsk’).

  • pulse_shape_name – Pulse shaping filter selection (‘rectangular’ or ‘srrc’).

  • bandwidth – Desired 3 dB bandwidth of the signal (Hz).

  • sample_rate – Sampling rate for the IQ signal (Hz).

  • num_samples – Number of IQ samples to produce.

  • alpha_rolloff – The alpha-rolloff value for the SRRC filter (0 < alpha_rolloff < 1).

  • rng – Random number generator for reproducibility. If None, creates a new default generator.

Returns:

Constellation-modulated IQ samples at the appropriate bandwidth.

Return type:

np.ndarray

Raises:
  • ValueError – If bandwidth or sample_rate are not positive.

  • ValueError – If bandwidth exceeds sample_rate/2.

  • ValueError – If num_samples is not positive.

  • ValueError – If the number of samples produced is incorrect.