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