Skip to content

Commit

Permalink
Regression test for QLRPS coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tomalrussell committed Dec 5, 2019
1 parent 63aa319 commit 4fbe688
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
16 changes: 7 additions & 9 deletions src/itmlogic/qlrps.py
@@ -1,23 +1,21 @@
import cmath
import math

def qlrps(fmhz, zsys, en0, ipol, eps, sgm):
"""
???
"""???
"""
gma = 157e-9
wn = fmhz / 47.7
ens = en0
wn = fmhz / 47.7
ens = en0

if zsys != 0:

ens = ens * math.exp(-zsys / 9460)

gme = gma * (1 - 0.04665 * math.exp(ens / 179.3))
gme = gma * (1 - 0.04665 * math.exp(ens / 179.3))

zq = complex(eps, 376.62 * sgm / wn)
zq = complex(eps, 376.62 * sgm / wn)

zgnd = math.sqrt(zq - 1)
zgnd = cmath.sqrt(zq - 1)

if ipol != 0:

Expand Down
22 changes: 15 additions & 7 deletions tests/test_qlrps.py
@@ -1,10 +1,18 @@
# import pytest
# from itmlogic.qlrps import qlrps
import pytest

# def test_qlrps():
from itmlogic.qlrps import qlrps

def test_qlrps():
fmhz = 1
zsys = 1
en0 = 1
ipol = 1
eps = 1
sgm = 1
wn, gme, ens, zgnd = qlrps(fmhz, zsys, en0, ipol, eps, sgm)


# assert actual_answer == expected_answer


# NB - these values obtained from running qlrps as-is, so can only test regressions
assert wn == pytest.approx(0.02096436)
assert gme == pytest.approx(1.49634e-7)
assert ens == pytest.approx(0.99989429)
assert zgnd == pytest.approx(0.00527592-0.00527533j)

0 comments on commit 4fbe688

Please sign in to comment.