Skip to content

Commit

Permalink
Test Hy
Browse files Browse the repository at this point in the history
  • Loading branch information
mkelley committed Sep 27, 2024
1 parent 6c05b5d commit 7512dd9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions models/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import numpy as np
import pytest


def schleicher_marcus(phase):
Expand Down Expand Up @@ -87,3 +88,19 @@ def Hy(H, y, rh, delta, phase):
- (2.5 * y) * np.log10(rh)
- 2.5 * np.log10(schleicher_marcus(phase))
)


@pytest.mark.parametrize(
"H,y,rh,delta,phase,expected",
(
[0, 0, 1, 1, 0, 0],
[0, 0, 10, 1, 0, 5],
[0, 0, 1, 10, 0, 5],
[0, 0, 1, 1, 23, -2.5 * np.log10(0.4765)],
[10, 0, 1, 1, 0, 10],
[0, -1, 1, 1, 0, 0],
[0, -1, 10, 1, 0, 7.5],
),
)
def test_Hy(H, y, rh, delta, phase, expected):
assert np.isclose(Hy(H, y, rh, delta, phase), expected, atol=0.003)

0 comments on commit 7512dd9

Please sign in to comment.