Skip to content

Commit

Permalink
Minimal formitting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexEMG committed Dec 5, 2021
1 parent bfe1d5d commit 0bdf371
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ dmypy.json

#VScode
.vscode
.DS_Store
4 changes: 2 additions & 2 deletions LotkaVolterraModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def dX_dt(X, a=1.0, b=0.1, c=1.5, d=0.75):
>>> dX_dt(np.zeros(2),1,0.1,1.5,.75) # zero is a fixpoint
array([0., 0.])
"""
if np.size(X)>2:
if np.size(X) > 2:
raise ValueError("X has only two dimensions!")

return np.array([a * X[0] - b * X[0] * X[1], -c * X[1] + d * b * X[0] * X[1]])


Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ If you are a new user, we recommend checking out the detailed Github Guides.
- numpy
- scipy
- matplotlib
- sklearn

Specifially, I'm sharing a requirements file (req.txt)

Expand Down
3 changes: 3 additions & 0 deletions test_LVM.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ def test_dX_dt():
- np.array([0.9, -1.425])
).all


def test_dX_dt_wronginput():
""" testing for wrong dimensions (ValueError) """
import pytest

with pytest.raises(ValueError):
LotkaVolterraModel.dX_dt(np.ones(3), 1, 0.1, 1.5, 0.75)


def test_growth():
state = np.array([13.0, 12.0])
growth = LotkaVolterraModel.dX_dt(state, a=1.0, b=0.3, c=1.5, d=0.1)
Expand Down

0 comments on commit 0bdf371

Please sign in to comment.