Version
2.1.1 (Default)
System Information
not applied
Description
Based on the docstring of the signal builders
|
def fm_modulator( |
|
bandwidth: float, |
|
sample_rate: float, |
|
num_samples: int, |
|
rng: np.random.Generator | None = None, |
|
) -> np.ndarray: |
|
"""Frequency Modulator (FM) signal generator. |
|
|
|
Generates FM signals using Carson's Rule for bandwidth calculation. |
|
|
|
Args: |
|
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. |
It defines as the 3-dB bandwidth, but does not say whether it is two-sided or one-sided. When not specified, one may understand that the author makes the bandwidth cover the full frequency span. In this case, for a baseband signal, the bandwidth would be within [-B/2, B/2] Hz. In this case, the Nyquist sampling theorem criterion for no aliasing would be
$$
f_s \geq B
$$
where $f_s$ is the sampling rate in Hz. However, in the same code you check
|
if bandwidth > sample_rate / 2: |
|
raise ValueError("bandwidth must be less than sample_rate/2") |
This is only consistent for one-side 3-dB bandwidth definition!
If you mean bandwidth B as the frequency for the range [-B, B] Hz, please, say that is a two-sided 3-dB bandwidth. Otherwise, your definition makes the bandwidth vague.
How to Reproduce the Bug
not applied
Version
2.1.1 (Default)
System Information
not applied
Description
Based on the docstring of the signal builders
torchsig/torchsig/signals/builders/fm.py
Lines 16 to 30 in 9b1949e
It defines as the 3-dB bandwidth, but does not say whether it is two-sided or one-sided. When not specified, one may understand that the author makes the bandwidth cover the full frequency span. In this case, for a baseband signal, the bandwidth would be within [-B/2, B/2] Hz. In this case, the Nyquist sampling theorem criterion for no aliasing would be
where$f_s$ is the sampling rate in Hz. However, in the same code you check
torchsig/torchsig/signals/builders/fm.py
Lines 51 to 52 in 9b1949e
This is only consistent for one-side 3-dB bandwidth definition!
If you mean bandwidth B as the frequency for the range [-B, B] Hz, please, say that is a two-sided 3-dB bandwidth. Otherwise, your definition makes the bandwidth vague.
How to Reproduce the Bug
not applied