[ea0fd6]: / tests / edgepy / test_q2qnbinom.py

Download this file

44 lines (37 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import unittest
import numpy as np
from inmoose.edgepy import q2qnbinom
class Test(unittest.TestCase):
def test_q2qnbinom(self):
x = np.arange(20, dtype=float)
input_mean = 10.0
output_mean = 20.0
dispersion = 0.1
ref = np.array(
[
1.339746,
3.720337,
5.706665,
7.602321,
9.448944,
11.2636,
13.05531,
14.82956,
16.58996,
18.33906,
20.07871,
21.81033,
23.53501,
25.25363,
26.96691,
28.67544,
30.37969,
32.0801,
33.777,
35.47071,
]
)
res = q2qnbinom(
x, input_mean=input_mean, output_mean=output_mean, dispersion=dispersion
)
self.assertTrue(np.allclose(res, ref))