torchsig.signals.builders.am.am_modulator

torchsig.signals.builders.am.am_modulator(am_mode: str, bandwidth: float, sample_rate: float, num_samples: int, rng: Generator | None = None) ndarray[source]

Amplitude Modulator (AM) signal generator.

Generates AM signals in various modes (DSB, DSB-SC, LSB, USB).

Parameters:
  • am_mode – Mode of the AM signal (‘dsb’, ‘dsb-sc’, ‘lsb’, ‘usb’).

  • 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.

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

Returns:

AM modulated signal at the appropriate bandwidth.

Return type:

np.ndarray

Raises:
  • ValueError – If bandwidth is not positive or exceeds sample_rate/2.

  • ValueError – If am_mode is not one of the supported modes.

Examples

>>> rng = np.random.default_rng(42)
>>> dsb_signal = am_modulator('dsb', 1000, 10000, 1000, rng)
>>> dsb_sc_signal = am_modulator('dsb-sc', 1000, 10000, 1000, rng)