Example #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)
Example #2
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')
Example #3
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)
Example #4
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)
Example #5
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)
Example #6
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')
Example #7
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)
Example #8
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)
Example #9
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, )
Example #10
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)
Example #11
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)
Example #12
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)
Example #13
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)
Example #14
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)
Example #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)
Example #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)
Example #17
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)
Example #18
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()
Example #19
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()
Example #20
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)
Example #21
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, )
Example #22
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)