Skip to content

Commit

Permalink
Update the example sections
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Jul 8, 2023
1 parent d6f777d commit 9d8b19f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/examples/farrow-resampler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"(farrow-arbitrary-resampler)=\n",
"# Farrow arbitrary resampler"
]
},
Expand Down
27 changes: 18 additions & 9 deletions src/sdr/_farrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class FarrowResampler:
References:
- https://wirelesspi.com/fractional-delay-filters-using-the-farrow-structure/
Examples:
See the :ref:`farrow-arbitrary-resampler` example.
Group:
resampling
"""
Expand Down Expand Up @@ -63,6 +66,9 @@ def resample(self, x: np.ndarray, rate: float) -> np.ndarray:
Returns:
The resampled signal, $y[n] = x(n \frac{T_s}{r})$.
Examples:
See the :ref:`farrow-arbitrary-resampler` example.
"""
if not rate > 0:
raise ValueError("Argument 'rate' must be positive.")
Expand Down Expand Up @@ -115,10 +121,11 @@ def streaming(self) -> bool:
In streaming mode, the filter state is preserved between calls to :obj:`resample()`.
.. ipython:: python
Examples:
.. ipython:: python
farrow = sdr.FarrowResampler()
farrow.streaming
farrow = sdr.FarrowResampler()
farrow.streaming
"""
return self._streaming

Expand All @@ -127,10 +134,11 @@ def order(self) -> int:
"""
Returns the order of the filter.
.. ipython:: python
Examples:
.. ipython:: python
farrow = sdr.FarrowResampler()
farrow.order
farrow = sdr.FarrowResampler()
farrow.order
"""
return self._taps.shape[1] - 1

Expand All @@ -139,9 +147,10 @@ def taps(self) -> np.ndarray:
"""
Returns the Farrow filter taps.
.. ipython:: python
Examples:
.. ipython:: python
farrow = sdr.FarrowResampler()
farrow.taps
farrow = sdr.FarrowResampler()
farrow.taps
"""
return self._taps

0 comments on commit 9d8b19f

Please sign in to comment.