Skip to content

Commit

Permalink
Standardize use of :func:
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Jul 28, 2024
1 parent d709388 commit b9c02b0
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/sdr/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def hexdump(
Arguments:
data: The data to display. Each element is considered one byte. Use :func:`sdr.pack()`
or :func:`sdr.unpack()` to convert data with variable bits per element.
or :func:`sdr.unpack` to convert data with variable bits per element.
width: The number of bytes per line.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion src/sdr/_filter/_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(
window: The SciPy window definition. See :func:`scipy.signal.windows.get_window` for details.
If `None`, no window is applied.
streaming: Indicates whether to use streaming mode. In streaming mode, previous inputs are
preserved between calls to :meth:`~sdr.Differentiator.__call__()`.
preserved between calls to :meth:`~sdr.Differentiator.__call__`.
Examples:
See the :ref:`fir-filters` example.
Expand Down
8 changes: 4 additions & 4 deletions src/sdr/_filter/_polyphase.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def __init__(
interpolation: The interpolation rate $P$.
taps: The prototype filter design specification.
- `"kaiser"`: The prototype filter is designed using :func:`~sdr.multirate_fir()`
- `"kaiser"`: The prototype filter is designed using :func:`sdr.multirate_fir`
with arguments `interpolation` and 1.
- `"linear"`: The prototype filter is designed to linearly interpolate between samples.
The filter coefficients are a length-$2P$ linear ramp $\frac{1}{P} [0, ..., P-1, P, P-1, ..., 1]$.
Expand Down Expand Up @@ -818,7 +818,7 @@ def __init__(
decimation: The decimation rate $Q$.
taps: The prototype filter design specification.
- `"kaiser"`: The prototype filter is designed using :func:`~sdr.multirate_fir()`
- `"kaiser"`: The prototype filter is designed using :func:`sdr.multirate_fir`
with arguments 1 and `decimation`.
- `npt.ArrayLike`: The prototype filter feedforward coefficients $h[n]$.
Expand Down Expand Up @@ -1004,7 +1004,7 @@ def __init__(
decimation: The decimation rate $Q$.
taps: The prototype filter design specification.
- `"kaiser"`: The prototype filter is designed using :func:`~sdr.multirate_fir()`
- `"kaiser"`: The prototype filter is designed using :func:`sdr.multirate_fir`
with arguments `interpolation` and `decimation`.
- `"linear"`: The prototype filter is designed to linearly interpolate between samples.
The filter coefficients are a length-$2P$ linear ramp $\frac{1}{P} [0, ..., P-1, P, P-1, ..., 1]$.
Expand Down Expand Up @@ -1210,7 +1210,7 @@ def __init__(
channels: The number of channels $C$.
taps: The prototype filter design specification.
- `"kaiser"`: The prototype filter is designed using :func:`~sdr.multirate_fir()`
- `"kaiser"`: The prototype filter is designed using :func:`sdr.multirate_fir`
with arguments 1 and `rate`.
- `npt.ArrayLike`: The prototype filter feedforward coefficients $h[n]$.
Expand Down
2 changes: 1 addition & 1 deletion src/sdr/_link_budget/_path_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def free_space_path_loss(
(think dipole) is a function of frequency as well. So, as the frequency increases, the physical size of the
isotropic antenna decreases. But what if the size of the antenna was fixed across frequency, as is the case
with a parabolic dish antenna? You'll note that the gain of a parabolic dish antenna is also proportional to
the square of the frequency, see :func:`parabolic_antenna()`.
the square of the frequency, see :func:`sdr.parabolic_antenna`.
It turns out that if omnidirectional antennas are used at both the transmitter and receiver, the total path
loss increases with frequency. But if a parabolic reflector is used at one end, the total path loss is
Expand Down
6 changes: 3 additions & 3 deletions src/sdr/_sequence/_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@ def gold_code(
length: The length $n = 2^m - 1$ of the Gold code/sequence.
index: The index $i$ in $[-2, n)$ of the Gold code.
poly1: The primitive polynomial of degree $m$ over $\mathrm{GF}(2)$ for the first $m$-sequence. If `None`,
a preferred pair is found using :func:`sdr.preferred_pairs()`.
a preferred pair is found using :func:`sdr.preferred_pairs`.
poly2: The primitive polynomial of degree $m$ over $\mathrm{GF}(2)$ for the second $m$-sequence. If `None`,
a preferred pair is found using :func:`sdr.preferred_pairs()`.
a preferred pair is found using :func:`sdr.preferred_pairs`.
verify: Indicates whether to verify that the provided polynomials are a preferred pair using
:func:`sdr.is_preferred_pair()`.
:func:`sdr.is_preferred_pair`.
output: The output format of the Gold code/sequence.
- `"binary"` (default): The Gold code with binary values of 0 and 1.
Expand Down
16 changes: 8 additions & 8 deletions src/sdr/_simulation/_channel_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def bsc(
Arguments:
x: The input sequence $x$ with $x_i \in \{0, 1\}$.
p: The probability $p$ of a bit flip.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
Returns:
The output sequence $y$ with $y_i \in \{0, 1\}$.
Expand Down Expand Up @@ -63,7 +63,7 @@ def bec(
Arguments:
x: The input sequence $x$ with $x_i \in \{0, 1\}$.
p: The probability $p$ of a bit erasure.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
Returns:
The output sequence $y$ with $y_i \in \{0, 1, e\}$. Erasures $e$ are represented by -1.
Expand Down Expand Up @@ -109,7 +109,7 @@ def dmc(
$\mathcal{X} = \{0, 1, \ldots, m-1\}$.
Y: The output alphabet $\mathcal{Y}$ of size $n$. If `None`, it is assumed that
$\mathcal{Y} = \{0, 1, \ldots, n-1\}$.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
Returns:
The output sequence $y$ with $y_i \in \mathcal{Y}$.
Expand Down Expand Up @@ -176,7 +176,7 @@ def __init__(self, seed: int | None = None):
Creates a new channel.
Arguments:
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
"""
self._rng: np.random.Generator # Will be set in self.reset()

Expand All @@ -187,7 +187,7 @@ def reset(self, seed: int | None = None):
Resets the channel with a new seed.
Arguments:
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
"""
self._rng = np.random.default_rng(seed)

Expand Down Expand Up @@ -287,7 +287,7 @@ def __init__(self, p: float, seed: int | None = None):
Arguments:
p: The transition probability $p$ of the BSC channel.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
"""
self._p = verify_scalar(p, float=True, inclusive_min=0, inclusive_max=1)

Expand Down Expand Up @@ -418,7 +418,7 @@ def __init__(self, p: float, seed: int | None = None):
Arguments:
p: The erasure probability $p$ of the BEC channel.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
"""
self._p = verify_scalar(p, float=True, inclusive_min=0, inclusive_max=1)

Expand Down Expand Up @@ -548,7 +548,7 @@ def __init__(
P: The $m \times n$ transition probability matrix $P$, where $P = \Pr(Y = y_j | X = x_i)$.
X: The input alphabet $\mathcal{X}$ of size $m$. If `None`, it is assumed that $\mathcal{X} = \{0, 1, \ldots, m-1\}$.
Y: The output alphabet $\mathcal{Y}$ of size $n$. If `None`, it is assumed that $\mathcal{Y} = \{0, 1, \ldots, n-1\}$.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
"""
P = verify_arraylike(P, float=True, ndim=2, inclusive_min=0, inclusive_max=1)
verify_condition(np.allclose(P.sum(axis=1), 1))
Expand Down
2 changes: 1 addition & 1 deletion src/sdr/_simulation/_impairment.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def awgn(
desired noise variance can be computed and passed in `noise`. If `snr` is `None`,
`noise` must be specified.
noise: The noise power (variance) in linear units. If `noise` is `None`, `snr` must be specified.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng()`.
seed: The seed for the random number generator. This is passed to :func:`numpy.random.default_rng`.
Returns:
The noisy signal $x[n] + w[n]$.
Expand Down
4 changes: 2 additions & 2 deletions src/sdr/plot/_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def p_d(
p_d: The probability of detection $P_d$.
ax: The axis to plot on. If `None`, the current axis is used.
x_label: The x-axis label to use.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Group:
plot-detection
Expand Down Expand Up @@ -139,7 +139,7 @@ def detector_pdfs(
p_h0: The probability of the $\mathcal{H}_0$ tails to plot. The smaller the value, the longer the x-axis.
p_h1: The probability of the $\mathcal{H}_1$ tails to plot. The smaller the value, the longer the x-axis.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
See Also:
sdr.h0, sdr.h1, sdr.threshold
Expand Down
10 changes: 5 additions & 5 deletions src/sdr/plot/_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def zeros_poles(
feedback coefficients $a_j$.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Examples:
See the :ref:`fir-filters` example.
Expand Down Expand Up @@ -312,7 +312,7 @@ def magnitude_response(
for real-valued filters and `"two-sided"` for complex-valued filters.
y_axis: The y-axis scaling. Options are to display a linear or logarithmic magnitude response.
decades: The number of decades to plot when `x_axis="log"`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Examples:
See the :ref:`fir-filters` example.
Expand Down Expand Up @@ -440,7 +440,7 @@ def phase_response(
one-sided spectrum with a logarithmic frequency axis. The default is `"auto"` which selects `"one-sided"`
for real-valued filters and `"two-sided"` for complex-valued filters.
decades: The number of decades to plot when `x_axis="log"`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Examples:
See the :ref:`fir-filters` example.
Expand Down Expand Up @@ -563,7 +563,7 @@ def phase_delay(
one-sided spectrum with a logarithmic frequency axis. The default is `"auto"` which selects `"one-sided"`
for real-valued filters and `"two-sided"` for complex-valued filters.
decades: The number of decades to plot when `x_axis="log"`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Examples:
See the :ref:`fir-filters` example.
Expand Down Expand Up @@ -687,7 +687,7 @@ def group_delay(
one-sided spectrum with a logarithmic frequency axis. The default is `"auto"` which selects `"one-sided"`
for real-valued filters and `"two-sided"` for complex-valued filters.
decades: The number of decades to plot when `x_axis="log"`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Examples:
See the :ref:`fir-filters` example.
Expand Down
14 changes: 7 additions & 7 deletions src/sdr/plot/_modulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def constellation(
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to Matplotlib functions.
If `persistence=False`, the following keyword arguments are passed to :func:`matplotlib.pyplot.scatter()`.
If `persistence=False`, the following keyword arguments are passed to :func:`matplotlib.pyplot.scatter`.
The defaults may be overwritten.
- `"marker"`: `"."`
- `"linestyle"`: `"none"`
If `persistence=True`, the following keyword arguments are passed to :func:`numpy.histogram2d()` and
If `persistence=True`, the following keyword arguments are passed to :func:`numpy.histogram2d` and
:func:`matplotlib.pyplot.pcolormesh`. The defaults may be overwritten.
- `"range"`: +/- 10% of the maximum value
Expand Down Expand Up @@ -153,7 +153,7 @@ def symbol_map(
limits: The axis limits, which apply to both the x- and y-axis.
If `None`, the axis limits are set to 50% larger than the maximum value.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
The following keyword arguments are set by default. The defaults may be overwritten.
- `"marker"`: `"x"`
Expand Down Expand Up @@ -271,7 +271,7 @@ def eye(
colorbar: Indicates whether to add a colorbar to the plot. This is only added if `color="index"` or
`persistence=True`.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`sdr.plot.raster()`.
kwargs: Additional keyword arguments to pass to :func:`sdr.plot.raster`.
Example:
Modulate 1,000 QPSK symbols using a square root raised cosine (SRRC) pulse shaping filter. The SRRC pulse shape
Expand Down Expand Up @@ -385,7 +385,7 @@ def phase_tree(
color: Indicates how to color the rasters. If `"index"`, the rasters are colored based on their index.
If a valid Matplotlib color, the rasters are all colored with that color.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`sdr.plot.raster()`.
kwargs: Additional keyword arguments to pass to :func:`sdr.plot.raster`.
Example:
Modulate 100 MSK symbols.
Expand Down Expand Up @@ -465,7 +465,7 @@ def ber(
ebn0: The bit energy $E_b$ to noise PSD $N_0$ ratio (dB).
ber: The bit error rate $P_{be}$.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.semilogy()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.semilogy`.
Examples:
Plot theoretical BER curves for BPSK, QPSK, 8-PSK, and 16-PSK in an AWGN channel.
Expand Down Expand Up @@ -523,7 +523,7 @@ def ser(
esn0: The symbol energy $E_s$ to noise PSD $N_0$ ratio (dB).
ser: The symbol error rate $P_{se}$.
ax: The axis to plot on. If `None`, the current axis is used.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.semilogy()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.semilogy`.
Examples:
Plot theoretical SER curves for BPSK, QPSK, 8-PSK, and 16-PSK in an AWGN channel.
Expand Down
2 changes: 1 addition & 1 deletion src/sdr/plot/_rc_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def use_style():
"""
Applies :obj:`sdr`'s default :obj:`matplotlib` rcParams.
These style settings may be reverted with :func:`matplotlib.pyplot.rcdefaults()`.
These style settings may be reverted with :func:`matplotlib.pyplot.rcdefaults`.
Examples:
The following rcParams are applied.
Expand Down
6 changes: 3 additions & 3 deletions src/sdr/plot/_spectral_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def periodogram(
one-sided spectrum with a logarithmic frequency axis. The default is `"auto"` which selects `"one-sided"`
for real-valued signals and `"two-sided"` for complex-valued signals.
y_axis: The y-axis scaling. Options are to display a linear or logarithmic power spectral density.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.plot`.
Group:
plot-spectral-estimation
Expand Down Expand Up @@ -144,7 +144,7 @@ def spectrogram(
Plots the spectrogram of a time-domain signal $x[n]$ using Welch's method.
Note:
This function uses :func:`scipy.signal.spectrogram()` to estimate the spectrogram of the time-domain signal.
This function uses :func:`scipy.signal.spectrogram` to estimate the spectrogram of the time-domain signal.
Arguments:
x: The time-domain signal $x[n]$.
Expand All @@ -160,7 +160,7 @@ def spectrogram(
y_axis: The y-axis scaling. Options are to display a one-sided spectrum or a two-sided spectrum.
The default is `"auto"` which selects `"one-sided"` for real-valued signals and `"two-sided"` for
complex-valued signals.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.pcolormesh()`.
kwargs: Additional keyword arguments to pass to :func:`matplotlib.pyplot.pcolormesh`.
The following keyword arguments are set by default. The defaults may be overwritten.
- `"vmin"`: 10th percentile
Expand Down
Loading

0 comments on commit b9c02b0

Please sign in to comment.