Skip to content
Snippets Groups Projects

More fast IO and improved memory efficiency

Merged Emmanuel Branlard requested to merge f/fast_io into master
1 file
+ 6
5
Compare changes
  • Side-by-side
  • Inline
@@ -15,9 +15,10 @@ from wetb.fast.fast_io import load_output, load_binary_output
import os
testfilepath = os.path.join(os.path.dirname(__file__), 'test_files/') # test file path
class TestFastIO(unittest.TestCase):
class TestFastIO(unittest.TestCase):
def test_load_output(self):
data, info = load_output(testfilepath + 'DTU10MW.out')
self.assertAlmostEqual(data[4, 3], 4.295E-04)
@@ -37,11 +38,11 @@ class TestFastIO(unittest.TestCase):
# The old method was not using a buffer and was also memory expensive
# Now use_buffer is set to true by default
import numpy as np
data, info = load_binary_output(testfilepath + 'test_binary.outb', use_buffer=True)
data, info = load_binary_output(testfilepath + 'test_binary.outb', use_buffer=True)
data_old, info_old = load_binary_output(testfilepath + 'test_binary.outb', use_buffer=False)
self.assertEqual(info['name'], info_old['name'])
np.testing.assert_array_equal(data[0 ,:],data_old[0 ,:])
np.testing.assert_array_equal(data[-1,:],data_old[-1,:])
np.testing.assert_array_equal(data[0, :], data_old[0, :])
np.testing.assert_array_equal(data[-1, :], data_old[-1, :])
def test_load_output2(self):
data, info = load_output(testfilepath + 'DTU10MW.out')
@@ -51,7 +52,7 @@ class TestFastIO(unittest.TestCase):
def test_load_output3(self):
# This file has an extra comment at the end
data, info = load_output(testfilepath + 'FastOut_Hydro.out')
data, info = load_output(testfilepath + 'FASTOut_Hydro.out')
self.assertAlmostEqual(data[3, 1], -1.0E+01)
Loading