示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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')
示例#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')
示例#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)
示例#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)
示例#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)
示例#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, )
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#21
0
 def test_offline(self):
     offline = Offline(output_name='Pressure')
示例#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)
示例#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()
示例#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()
示例#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)
示例#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, )
示例#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)