Exemplo n.º 1
0
    def testAscii2bin(self):

        for f in ["Hawc2ascii_bin.sel", "Hawc2ascii_bin.dat"]:
            if os.path.exists(testfilepath + f):
                os.remove(testfilepath + f)
        ascii2bin(testfilepath + "Hawc2ascii.sel", ui=TextUI())

        ascii_file = Hawc2io.ReadHawc2(testfilepath + 'Hawc2ascii')
        bin_file = Hawc2io.ReadHawc2(testfilepath + "Hawc2ascii_bin")

        np.testing.assert_array_almost_equal(ascii_file.ReadAscii(),
                                             bin_file.ReadBinary(), 1)
        self.assertEqual(ascii_file.ChInfo, bin_file.ChInfo)
 def test_astm3(self):
     data = Hawc2io.ReadHawc2(testfilepath + "test").ReadBinary(
         [2]).flatten()
     np.testing.assert_allclose(
         cycle_matrix(data, 4, 4, rainflow_func=rainflow_astm)[0],
         np.array([[24., 83., 53., 26.], [0., 1., 4., 0.], [0., 0., 0., 0.],
                   [0., 1., 2., 0.]]) / 2, 0.001)
 def test_bearing_damage_swp(self):
     data = Hawc2io.ReadHawc2(self.tfp + "test_bearing_damage").ReadBinary((np.array([1, 4, 2, 5, 3, 6]) ).tolist())
     self.assertAlmostEqual(bearing_damage([(data[:, i], data[:, i + 1]) for i in [0,2,4]]), 7.755595081475002e+13)
 def test_astm2(self):
     data = Hawc2io.ReadHawc2(testfilepath + "test").ReadBinary(
         [2]).flatten()
     np.testing.assert_allclose(
         eq_load(data, neq=61, rainflow_func=rainflow_astm),
         np.array([[1.356, 1.758, 2.370, 2.784, 3.077, 3.296]]), 0.01)
Exemplo n.º 5
0
import os

from wetb.prepost import windIO
from wetb.hawc2 import Hawc2io
from wetb.prepost import hawcstab2

if __name__ == '__main__':

    # =============================================================================
    # READ HAWC2 RESULT FILE
    # =============================================================================

    # METHOD A
    fname = '../wetb/hawc2/tests/test_files/hawc2io/Hawc2ascii.sel'
    res = Hawc2io.ReadHawc2(fname)
    sig = res.ReadAll()

    # METHOD B
    path, file = os.path.dirname(fname), os.path.basename(fname)
    res = windIO.LoadResults(path, file)
    sig = res.sig
    sel = res.ch_details
    # result in dataframe with unique channel names (instead of indices)
    sig_df = res.sig2df()
    ch_df = res.ch_df

    # =============================================================================
    # READ HAWCStab2 files
    # =============================================================================