Esempio n. 1
0
    def test_seed(self):
        data = Data()
        self.assertEqual(data.seed, "")

        data.seed = 10
        self.assertEqual(data.seed, 10)

        data.seed = None
        self.assertEqual(data.seed, "")
Esempio n. 2
0
    def test_save_load_exdir(self):
        self.data = Data(logger_level="error", backend="exdir")

        self.setup_mock_data(self.data)

        folder = os.path.dirname(os.path.realpath(__file__))
        compare_file = os.path.join(folder, "data/test_save_mock")
        filename = os.path.join(self.output_test_dir, "test_save_mock")

        self.data.save(filename)

        new_data = Data(filename, backend="exdir")

        for statistical_metric in self.statistical_metrics:
            new_data["feature1d"][statistical_metric] = np.array([1., 2.])
            new_data["TestingModel1d"][statistical_metric] = np.array([3., 4.])

        new_data["feature1d"]["labels"] = ["xlabel", "ylabel"]
        new_data["TestingModel1d"]["labels"] = ["xlabel", "ylabel"]

        new_data.model_name = "TestingModel1d"
        new_data.uncertain_parameters = ["a", "b"]
        new_data.method = "mock"
        new_data.seed = 10
        new_data.incomplete = ["a", "b"]
        new_data.error = ["feature1d"]