From b9984ff7b4dc6f4293217c49379e743adb254c77 Mon Sep 17 00:00:00 2001 From: mhostetter Date: Thu, 23 May 2024 22:32:33 -0400 Subject: [PATCH] Rename `to_complex_bb()` to `to_complex_baseband()` Fixes #352 --- src/sdr/_signal.py | 12 ++++++------ ..._to_complex_bb.py => test_to_complex_baseband.py} | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) rename tests/dsp/{test_to_complex_bb.py => test_to_complex_baseband.py} (79%) diff --git a/src/sdr/_signal.py b/src/sdr/_signal.py index 55dbfe32d..f23e20352 100644 --- a/src/sdr/_signal.py +++ b/src/sdr/_signal.py @@ -90,7 +90,7 @@ def mix( @export -def to_complex_bb(x_r: npt.NDArray[np.float64]) -> npt.NDArray[np.complex128]: +def to_complex_baseband(x_r: npt.NDArray[np.float64]) -> npt.NDArray[np.complex128]: r""" Converts a real passband signal to a complex baseband signal. @@ -118,12 +118,12 @@ def to_complex_bb(x_r: npt.NDArray[np.float64]) -> npt.NDArray[np.complex128]: ); \ x_r = sdr.awgn(x_r, snr=30) - @savefig sdr_to_complex_bb_1.png + @savefig sdr_to_complex_baseband_1.png plt.figure(); \ sdr.plot.time_domain(x_r[0:100], sample_rate=sample_rate); \ plt.title("Time-domain signal $x_r[n]$"); - @savefig sdr_to_complex_bb_2.png + @savefig sdr_to_complex_baseband_2.png plt.figure(); \ sdr.plot.periodogram(x_r, fft=2048, sample_rate=sample_rate); \ plt.title("Periodogram of $x_r[n]$"); @@ -134,15 +134,15 @@ def to_complex_bb(x_r: npt.NDArray[np.float64]) -> npt.NDArray[np.complex128]: .. ipython:: python - x_c = sdr.to_complex_bb(x_r); \ + x_c = sdr.to_complex_baseband(x_r); \ sample_rate /= 2 - @savefig sdr_to_complex_bb_3.png + @savefig sdr_to_complex_baseband_3.png plt.figure(); \ sdr.plot.time_domain(x_c[0:50], sample_rate=sample_rate); \ plt.title("Time-domain signal $x_c[n]$"); - @savefig sdr_to_complex_bb_4.png + @savefig sdr_to_complex_baseband_4.png plt.figure(); \ sdr.plot.periodogram(x_c, fft=2048, sample_rate=sample_rate); \ plt.title("Periodogram of $x_c[n]$"); diff --git a/tests/dsp/test_to_complex_bb.py b/tests/dsp/test_to_complex_baseband.py similarity index 79% rename from tests/dsp/test_to_complex_bb.py rename to tests/dsp/test_to_complex_baseband.py index c3da6dafa..4d907dee0 100644 --- a/tests/dsp/test_to_complex_bb.py +++ b/tests/dsp/test_to_complex_baseband.py @@ -8,8 +8,8 @@ def test_exceptions(): with pytest.raises(ValueError): # x_r must be 1D x_r = np.zeros((2, 2), dtype=float) - sdr.to_complex_bb(x_r) + sdr.to_complex_baseband(x_r) with pytest.raises(ValueError): # x_r must be real x_r = np.zeros(4, dtype=complex) - sdr.to_complex_bb(x_r) + sdr.to_complex_baseband(x_r)