Skip to content

Commit

Permalink
Project structuring
Browse files Browse the repository at this point in the history
- laid out pyproject and added pytest support
- ignoring editable egg info
- added build info for pyroject frontend
  • Loading branch information
mahdiolfat committed Jan 31, 2024
1 parent 54864e9 commit a062e03
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 20 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
*.egg-info
env

.vscode
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "pyssp"
version = "0.1"
readme = "README.md"

[tool.pytest.ini_options]
pythonpath = "."
addopts = [
"--import-mode=importlib",
]
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions lattice.py → pyssp/lattice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import scipy as sp

def fcov(x, p):
'''
Expand Down
20 changes: 0 additions & 20 deletions levinson.py → pyssp/levinson.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ def gtor(gamma, epsilon=None):

return r

def test_gtor():
'''Based on example 5.2.6'''

gamma = [1/2, 1/2, 1/2]
epsilon = 2 * (3 / 4)**3
res = gtor(gamma, epsilon)
true_results = np.array([2, -1, -1/4, 1/8])
print(res)

test_gtor()

def ator(a, b):
'''
Expand Down Expand Up @@ -176,13 +166,3 @@ def glev(r, b):
print()

return x

def test_glev():
'''Example 5.3.1, Page 266'''
r = [4, 2, 1]
b = [9, 6, 12]

res = glev(r, b)
print(res)

test_glev()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions tests/test_levinson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
""""""


import numpy as np
from pyssp.levinson import glev, gtor


def test_glev():
'''Example 5.3.1, Page 266'''
r = [4, 2, 1]
b = [9, 6, 12]

res = glev(r, b)
print(res)


def test_gtor():
'''Based on example 5.2.6'''

gamma = [1/2, 1/2, 1/2]
epsilon = 2 * (3 / 4)**3
res = gtor(gamma, epsilon)
true_results = np.array([2, -1, -1/4, 1/8])
print(res)

0 comments on commit a062e03

Please sign in to comment.