Skip to content

Commit

Permalink
Resolve #2: mypy linting integration
Browse files Browse the repository at this point in the history
- some minor gitignore and readme todo updates
- mypy passing with github workflow
  • Loading branch information
mahdi committed Nov 21, 2023
1 parent a02c788 commit 90b71fa
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ContinuousTesting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
run: |
ruff check --output-format=github pyssp --verbose
- name: Static Type Check
run: |
mypy pyssp --explicit-package-bases
- name: Test
run: |
pytest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
*cache
*.egg-info
env
.env
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Direct impelementation of statistical digital signal processing algorithms from

The book represents algorithms as:

1. set of instructions (pseudo-code)
1. matlab code
1. described in English in the textbook body
1. set of instructions (pseudo-code) annotated in Tables.
1. matlab code annotated in Figures.
1. described in words in the body of the text.

## Chapters

Expand All @@ -22,18 +22,13 @@ The book represents algorithms as:

### TODO

- add proper reference
- add proper reference to the book
- lint markdown readme
- License
- Finalize test cases for all codes
- pytest-cov?
- finalize test cases for all codes
- python documentation generator
- linting workflow
- pass linting
- mypy static type checking
- Release package scripts
- release package scripts
- stub files?
- VS code add-ons
- use matlab-equivalent psuedo-inverse ("X \ R") operation to match the book
- switch linting to Ruff?
- performance benchmarking would be cool
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.mypy]
mypy_path = "pyssp"
ignore_missing_imports = true
#plugins = "numpy.typing.mypy_plugin"
2 changes: 1 addition & 1 deletion pyssp/levinson.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def rtoa(r) -> tuple[np.ndarray, np.ndarray]:
gamma = -np.transpose(r[1:1 + j,]) @ np.flipud(a) / epsilon
an = np.concatenate((a, np.zeros((1, 1)))).reshape(-1, 1)
anT = np.conjugate(np.flipud(a))
a = an + gamma * np.concatenate(([0], anT.ravel())).reshape(-1, 1)
a = an + gamma * np.concatenate((np.zeros(1), anT.ravel())).reshape(-1, 1)
epsilon = epsilon * (1 - np.abs(gamma)**2)
print(f"{gamma=},\n{a=},\n{epsilon=}\n")
return a, epsilon
Expand Down
1 change: 1 addition & 0 deletions pyssp/modeling.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Chapter 4 modeling algorithm implementations."""


import numpy as np
import scipy as sp

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ matplotlib
ruff
pytest
pytest-cov
mypy
mypy

0 comments on commit 90b71fa

Please sign in to comment.