Exemplo n.º 1
0
 def test_add_snapshot2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.add_snapshot([-0.29334384, -0.2312056],
                          "tests/test_datasets/matlab_04.vtk")
     assert offline.snapshots.values.shape == (2500, 5)
Exemplo n.º 2
0
 def test_optimal_mu2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     mu = offline.optimal_mu(error=offline.loo_error())
     expected_mu = np.array([-0.29334384, -0.23120563])
     np.testing.assert_array_almost_equal(mu[0], expected_mu)
Exemplo n.º 3
0
 def test_optimal_mu(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     mu = offline.optimal_mu()
     expected_mu = np.array([-0.29334384, -0.23120563])
     np.testing.assert_array_almost_equal(mu[0], expected_mu)
Exemplo n.º 4
0
 def test_add_snapshot(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.add_snapshot([-0.29334384, -0.2312056],
                          "tests/test_datasets/matlab_04.vtk")
     expected_mu = np.array([[-.5, .5, .5, -.5, -0.29334384],
                             [-.5, -.5, .5, .5, -0.2312056]])
     np.testing.assert_array_almost_equal(expected_mu, offline.mu.values)
Exemplo n.º 5
0
 def test_init_database2(self):
     mu_values = [[-.5, -.5], [.5, -.5], [.5, .5], [-.5, .5]]
     files = [
         "tests/test_datasets/matlab_00.vtk",
         "tests/test_datasets/matlab_01.vtk",
         "tests/test_datasets/matlab_02.vtk",
         "tests/test_datasets/matlab_03.vtk"
     ]
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database(mu_values, files)
     assert offline.snapshots.values.shape == (2500, 4)
Exemplo n.º 6
0
 def test_init_database2(self):
     mu_values = [[-.5, -.5], [.5, -.5], [.5, .5], [-.5, .5]]
     files = [
         "tests/test_datasets/matlab_00.vtk",
         "tests/test_datasets/matlab_01.vtk",
         "tests/test_datasets/matlab_02.vtk",
         "tests/test_datasets/matlab_03.vtk"
     ]
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database(mu_values, files)
     assert offline.snapshots.values.shape == (2500, 4)
Exemplo n.º 7
0
 def test_init_database(self):
     mu_values = [[-.5, -.5], [.5, -.5], [.5, .5], [-.5, .5]]
     files = [
         "tests/test_datasets/matlab_00.vtk",
         "tests/test_datasets/matlab_01.vtk",
         "tests/test_datasets/matlab_02.vtk",
         "tests/test_datasets/matlab_03.vtk"
     ]
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database(mu_values, files)
     expected_mu = np.array([[-.5, .5, .5, -.5], [-.5, -.5, .5, .5]])
     np.testing.assert_array_almost_equal(expected_mu, offline.mu.values)
Exemplo n.º 8
0
 def test_init_database(self):
     mu_values = [[-.5, -.5], [.5, -.5], [.5, .5], [-.5, .5]]
     files = [
         "tests/test_datasets/matlab_00.vtk",
         "tests/test_datasets/matlab_01.vtk",
         "tests/test_datasets/matlab_02.vtk",
         "tests/test_datasets/matlab_03.vtk"
     ]
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database(mu_values, files)
     expected_mu = np.array([[-.5, .5, .5, -.5], [-.5, -.5, .5, .5]])
     np.testing.assert_array_almost_equal(expected_mu, offline.mu.values)
Exemplo n.º 9
0
 def test_save(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.generate_rb_space()
     offline.save_rb_space('space')
     assert os.path.isfile('space')
Exemplo n.º 10
0
 def test_save(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.generate_rb_space()
     offline.save_rb_space('space')
     assert os.path.isfile('space')
Exemplo n.º 11
0
 def test_add_snapshot2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.add_snapshot([-0.29334384, -0.2312056],
                          "tests/test_datasets/matlab_04.vtk")
     assert offline.snapshots.values.shape == (2500, 5)
Exemplo n.º 12
0
 def test_add_snapshot(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.add_snapshot([-0.29334384, -0.2312056],
                          "tests/test_datasets/matlab_04.vtk")
     expected_mu = np.array([[-.5, .5, .5, -.5, -0.29334384],
                             [-.5, -.5, .5, .5, -0.2312056]])
     np.testing.assert_array_almost_equal(expected_mu, offline.mu.values)
Exemplo n.º 13
0
 def test_init_database_from_file_wrongfile(self):
     conf_file = 'tests/test_datasets/wrongmu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     with self.assertRaises(ValueError):
         offline.init_database_from_file(conf_file)
Exemplo n.º 14
0
 def test_loo_error(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     error = offline.loo_error()
     assert error.shape == (4, )
Exemplo n.º 15
0
 def test_init_database_from_file2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     assert offline.snapshots.values.shape == (2500, 4)
Exemplo n.º 16
0
 def test_init_database_from_file_nofile(self):
     conf_file = 'tests/test_datasets/notexisting_mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     with self.assertRaises(IOError):
         offline.init_database_from_file(conf_file)
Exemplo n.º 17
0
 def test_init_database_from_file(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     expected_mu = np.array([[-.5, .5, .5, -.5], [-.5, -.5, .5, .5]])
     np.testing.assert_array_almost_equal(expected_mu, offline.mu.values)
Exemplo n.º 18
0
 def test_init_database_from_file(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     expected_mu = np.array([[-.5, .5, .5, -.5], [-.5, -.5, .5, .5]])
     np.testing.assert_array_almost_equal(expected_mu, offline.mu.values)
Exemplo n.º 19
0
 def test_init_database_from_file2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     assert offline.snapshots.values.shape == (2500, 4)
Exemplo n.º 20
0
 def test_init_database_from_file_nofile(self):
     conf_file = 'tests/test_datasets/notexisting_mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     with self.assertRaises(IOError):
         offline.init_database_from_file(conf_file)
Exemplo n.º 21
0
 def test_offline(self):
     offline = Offline(output_name='Pressure')
Exemplo n.º 22
0
 def test_init_database_from_file_wrongfile(self):
     conf_file = 'tests/test_datasets/wrongmu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     with self.assertRaises(ValueError):
         offline.init_database_from_file(conf_file)
Exemplo n.º 23
0
 def test_generate(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.generate_rb_space()
Exemplo n.º 24
0
 def test_generate(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     offline.generate_rb_space()
Exemplo n.º 25
0
 def test_loo_error2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     max_error = np.max(offline.loo_error())
     assert isinstance(max_error, float)
Exemplo n.º 26
0
 def test_loo_error(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     error = offline.loo_error()
     assert error.shape == (4, )
Exemplo n.º 27
0
 def test_loo_error2(self):
     conf_file = 'tests/test_datasets/mu.conf'
     offline = Offline(output_name='Pressure', dformat='point')
     offline.init_database_from_file(conf_file)
     max_error = np.max(offline.loo_error())
     assert isinstance(max_error, float)