Coverage for gemlib/mcmc/discrete_time_state_transition_model/fixtures.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.10.3, created at 2025-12-02 22:09 +0000

1"""Test fixtures""" 

2 

3import numpy as np 

4import pytest 

5 

6 

7@pytest.fixture(scope="module") 

8def sir_metapop_example(): 

9 """Outcome of a simulation from a 3-metapopulation model 

10 with mixing, implemented in https://colab.research.google.com/drive/1Q1PUcOnYlvCGHzRUBUAp4CxYhZ8RJzg8?usp=sharing 

11 """ 

12 

13 incidence_matrix = np.array([[-1, 0], [1, -1], [0, 1]], dtype=np.float32) 

14 

15 initial_conditions = np.array( 

16 [[999, 50, 0], [500, 20, 0], [250, 10, 0]], dtype=np.float32 

17 ) 

18 

19 events = np.array( 

20 [ 

21 [[11.0, 11.0], [5.0, 4.0], [2.0, 2.0]], 

22 [[11.0, 6.0], [5.0, 2.0], [4.0, 2.0]], 

23 [[2.0, 6.0], [11.0, 1.0], [1.0, 0.0]], 

24 [[10.0, 6.0], [8.0, 4.0], [2.0, 2.0]], 

25 [[12.0, 7.0], [7.0, 4.0], [6.0, 1.0]], 

26 [[11.0, 5.0], [5.0, 5.0], [4.0, 1.0]], 

27 [[13.0, 10.0], [12.0, 6.0], [6.0, 1.0]], 

28 ], 

29 dtype=np.float32, 

30 ) 

31 

32 return { 

33 "initial_conditions": initial_conditions, 

34 "events": events, 

35 "incidence_matrix": incidence_matrix, 

36 }