Skip to content

Commit

Permalink
Rename to_complex_bb() to to_complex_baseband()
Browse files Browse the repository at this point in the history
Fixes #352
  • Loading branch information
mhostetter committed May 24, 2024
1 parent e6ea109 commit b9984ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/sdr/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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]$");
Expand All @@ -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]$");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b9984ff

Please sign in to comment.