Old engine for Continuous Time Bayesian Networks. Superseded by reCTBN. 🐍
https://github.com/madlabunimib/PyCTBN
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
4 years ago
|
import sys
|
||
4 years ago
|
sys.path.append("../../classes/")
|
||
4 years ago
|
import unittest
|
||
4 years ago
|
import glob
|
||
|
import os
|
||
4 years ago
|
import utility.json_importer as ji
|
||
|
import structure_graph.sample_path as sp
|
||
|
import structure_graph.trajectory as tr
|
||
|
import structure_graph.structure as st
|
||
4 years ago
|
|
||
|
|
||
|
class TestSamplePath(unittest.TestCase):
|
||
|
|
||
4 years ago
|
@classmethod
|
||
|
def setUpClass(cls) -> None:
|
||
4 years ago
|
cls.read_files = glob.glob(os.path.join('../../data', "*.json"))
|
||
4 years ago
|
cls.importer = ji.JsonImporter(cls.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name')
|
||
|
|
||
4 years ago
|
def test_init(self):
|
||
4 years ago
|
s1 = sp.SamplePath(self.importer)
|
||
4 years ago
|
s1.build_trajectories()
|
||
|
self.assertIsNotNone(s1.trajectories)
|
||
|
self.assertIsInstance(s1.trajectories, tr.Trajectory)
|
||
|
s1.build_structure()
|
||
|
self.assertIsNotNone(s1.structure)
|
||
|
self.assertIsInstance(s1.structure, st.Structure)
|
||
|
self.assertTrue(s1.importer.concatenated_samples.empty)
|
||
4 years ago
|
self.assertEqual(s1.total_variables_count, len(s1.importer.sorter))
|
||
4 years ago
|
print(s1.structure)
|
||
|
print(s1.trajectories)
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
unittest.main()
|