Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NCO, DDS, and loop filter #4

Merged
merged 27 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c0b32b9
Fix obscure VS Code pytest discovery issue
mhostetter Jul 9, 2023
bb262c4
Use `$$...$$` math
mhostetter Jul 9, 2023
6b5e3d8
Allow IIR taps to be float or complex
mhostetter Jul 9, 2023
b54d7fb
Plot power of frequency response
mhostetter Jul 9, 2023
62f9c1a
Label frequency axes as "Normalized Frequency"
mhostetter Jul 9, 2023
9a47ac3
Add option to plot frequency response phase
mhostetter Jul 9, 2023
f8807df
Add logarithmic frequency response plot
mhostetter Jul 9, 2023
9d3b489
Fix bug in `plot_all()` parameters
mhostetter Jul 9, 2023
0a8b5e3
Prevent impulse and step response methods from affecting filter state
mhostetter Jul 9, 2023
edebae0
Add a numerically-controlled oscillator in `sdr.NCO`
mhostetter Jul 9, 2023
ec07111
Add unit tests for NCO
mhostetter Jul 9, 2023
c07e57c
Add a direct digital synthesizer in `sdr.DDS`
mhostetter Jul 9, 2023
1cd3156
Add unit tests for the DDS
mhostetter Jul 9, 2023
2feebfd
Rename example
mhostetter Jul 9, 2023
7ee390e
Rename reference
mhostetter Jul 9, 2023
5d18f81
Add PLL section in API reference
mhostetter Jul 9, 2023
057daa1
Add a 2nd order loop filter
mhostetter Jul 9, 2023
529050b
Add unit tests for the loop filter
mhostetter Jul 9, 2023
08a1259
Add PLL example notebook
mhostetter Jul 9, 2023
22e82c6
Add more loop filter unit tests
mhostetter Jul 9, 2023
86c1eab
Add NCO, DDS, and loop filter to feature list
mhostetter Jul 9, 2023
2f29b39
Support running `black` on Jupyter notebooks
mhostetter Jul 9, 2023
3857866
Fix formatting
mhostetter Jul 9, 2023
39b45c1
Add more detail to Farrow resampler example
mhostetter Jul 9, 2023
1654a0d
Add frequency response methods to IIR filters
mhostetter Jul 9, 2023
76aeb9c
Update PLL notebook
mhostetter Jul 9, 2023
0fa1506
Fix linter error
mhostetter Jul 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"python.testing.pytestArgs": [
"-c=pyproject.toml",
"tests/"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@ A Python package for software-defined radio.

## Features

- Filters: Infinite impulse response filters (`sdr.IIR`)
- Arbitrary resamplers: Farrow resampler (`sdr.FarrowResampler`)
- Filters:
- Infinite impulse response filter (`sdr.IIR`)
- Arbitrary resamplers:
- Farrow resampler (`sdr.FarrowResampler`)
- Signal generators:
- Numerically-controlled oscillator (`sdr.NCO`)
- Direct digital synthesizer (`sdr.DDS`)
- Phase-locked loops:
- Loop filter (`sdr.LoopFilter`)
5 changes: 5 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ Resampling
----------

.. python-apigen-group:: resampling

Phase/time-locked loops
-----------------------

.. python-apigen-group:: pll
11 changes: 9 additions & 2 deletions docs/examples/farrow-resampler.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Construct an input signal, $x[n] = x(n T_s)$"
"## Construct an input signal, $x[n] = x(n T_s)$\n",
"\n",
"Create a discrete-time signal $x[n]$ that sample the continuous-time signal $x(t)$ at a sample rate $f_s = 1 / T_s$."
]
},
{
Expand Down Expand Up @@ -81,7 +83,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Resample the input signal with rate $r$, $y[n] = x(n \\frac{T_s}{r})$"
"## Resample the input signal with rate $r$, $y[n] = x(n \\frac{T_s}{r})$\n",
"\n",
"Now, resample $x[n]$ such that the output $y[n]$ is equivalent to sampling the continuous-time $x(t)$\n",
"at sample rate $f_s = r/T_s$.\n",
"This is equivalent to sampling $x[n]$ at $1/r$ fractional samples.\n",
"This is accomplished, for arbitrary $r$, with a Farrow arbitrary resampler."
]
},
{
Expand Down
708 changes: 708 additions & 0 deletions docs/examples/iir-filter.ipynb

Large diffs are not rendered by default.

682 changes: 0 additions & 682 deletions docs/examples/iir-filters.ipynb

This file was deleted.

504 changes: 504 additions & 0 deletions docs/examples/phase-locked-loop.ipynb

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ The :obj:`sdr` library is a Python 3 package for software-defined radio (SDR) ap
Features
--------

- Filters: Infinite impulse response filters (:obj:`sdr.IIR`)
- Arbitrary resamplers: Farrow resampler (:obj:`sdr.FarrowResampler`)
- Filters:
- Infinite impulse response filter (:obj:`sdr.IIR`)
- Arbitrary resamplers:
- Farrow resampler (:obj:`sdr.FarrowResampler`)
- Signal generators:
- Numerically-controlled oscillator (:obj:`sdr.NCO`)
- Direct digital synthesizer (:obj:`sdr.DDS`)
- Phase-locked loops:
- Loop filter (:obj:`sdr.LoopFilter`)

.. toctree::
:caption: Examples
:hidden:

examples/iir-filters.ipynb
examples/iir-filter.ipynb
examples/farrow-resampler.ipynb
examples/phase-locked-loop.ipynb

.. toctree::
:caption: API Reference
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ disable = [
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-public-methods",
"unneeded-not",
]
min-similarity-lines = 100
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pylint >= 2.14
black >= 22.8.0
black[jupyter] >= 22.8.0
pytest
pytest-cov[toml]
pytest-xdist
Expand Down
2 changes: 2 additions & 0 deletions src/sdr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

from ._farrow import FarrowResampler
from ._iir_filter import IIR
from ._loop_filter import LoopFilter
from ._nco import DDS, NCO
Loading