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.
26 lines
1.0 KiB
26 lines
1.0 KiB
|
|
import unittest
|
|
import numpy as np
|
|
|
|
from ...classes.structure_graph.trajectory import Trajectory
|
|
|
|
|
|
class TestTrajectory(unittest.TestCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.read_files = glob.glob(os.path.join('./data', "*.json"))
|
|
cls.importer = JsonImporter(cls.read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name')
|
|
cls.importer.import_data(0)
|
|
|
|
def test_init(self):
|
|
t1 = Trajectory(self.importer.build_list_of_samples_array(self.importer.concatenated_samples),
|
|
len(self.importer.sorter) + 1)
|
|
self.assertTrue(np.array_equal(self.importer.concatenated_samples.iloc[:, 0].to_numpy(), t1.times))
|
|
self.assertTrue(np.array_equal(self.importer.concatenated_samples.iloc[:,1:].to_numpy(), t1.complete_trajectory))
|
|
self.assertTrue(np.array_equal(self.importer.concatenated_samples.iloc[:, 1: len(self.importer.sorter) + 1], t1.trajectory))
|
|
self.assertEqual(len(self.importer.sorter) + 1, t1._original_cols_number)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|
|
|