diff --git a/.gitignore b/.gitignore index 6d3feb6cc699a5af67da7cbd28e2fcf98554c058..5c2598f27ad1770a1ed8d9496ce0370c682371d5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ wetb/hawc2/ascii2bin/tests/test_files/Hawc2ascii_bin.sel wetb/hawc2/ascii2bin/tests/test_files/Hawc2ascii_bin.dat wetb/prepost/tests/data/demo_dlc/remote* +/wetb/fatigue_tools/rainflowcounting/compile.py diff --git a/wetb/fatigue_tools/rainflowcounting/rainflowcount.py b/wetb/fatigue_tools/rainflowcounting/rainflowcount.py index 8d1bdd76e8bb550114bb552e5ae6985a8c9b427b..bac7c262bbe9582c28961aaabea600b9fd6d9d6b 100644 --- a/wetb/fatigue_tools/rainflowcounting/rainflowcount.py +++ b/wetb/fatigue_tools/rainflowcounting/rainflowcount.py @@ -6,7 +6,8 @@ from builtins import str from future import standard_library standard_library.install_aliases() import numpy as np - +from wetb.fatigue_tools.rainflowcounting import peak_trough +from wetb.fatigue_tools.rainflowcounting import pair_range def check_signal(signal): @@ -73,16 +74,14 @@ def rainflow_windap(signal, levels=255., thresshold=(255 / 50)): # If possible the module is compiled using cython otherwise the python implementation is used - from wetb.fatigue_tools.rainflowcounting.peak_trough import peak_trough - from wetb.fatigue_tools.rainflowcounting.pair_range import pair_range_amplitude_mean #Convert to list of local minima/maxima where difference > thresshold - sig_ext = peak_trough(signal, thresshold) + sig_ext = peak_trough.peak_trough(signal, thresshold) #rainflow count - ampl_mean = pair_range_amplitude_mean(sig_ext) + ampl_mean = pair_range.pair_range_amplitude_mean(sig_ext) ampl_mean = np.array(ampl_mean) ampl_mean = np.round(ampl_mean / thresshold) * gain * thresshold diff --git a/wetb/fatigue_tools/tests/test_fatigue.py b/wetb/fatigue_tools/tests/test_fatigue.py index b84ec1b71b973ec70195eeafdbf3623e4f6dc35c..6e7c89f3219bf76ded45efa1fd1b5078dd1f3da5 100644 --- a/wetb/fatigue_tools/tests/test_fatigue.py +++ b/wetb/fatigue_tools/tests/test_fatigue.py @@ -59,7 +59,8 @@ class TestFatigueTools(unittest.TestCase): def test_windap3(self): data = Hawc2io.ReadHawc2(testfilepath + "test").ReadBinary([2]).flatten() from wetb.fatigue_tools.rainflowcounting import peak_trough - self.assertTrue(peak_trough.__file__.lower()[-4:] == ".pyd" or peak_trough.__file__.lower()[-3:] == ".so", "not compiled, %s"%sys.executable) + self.assertTrue(peak_trough.__file__.lower()[-4:] == ".pyd" or peak_trough.__file__.lower()[-3:] == ".so", + "not compiled, %s, %s\n%s"%(sys.executable, peak_trough.__file__, os.listdir(os.path.dirname(peak_trough.__file__)))) np.testing.assert_array_equal(cycle_matrix(data, 4, 4, rainflow_func=rainflow_windap)[0], np.array([[ 14., 65., 39., 24.], [ 0., 1., 4., 0.], [ 0., 0., 0., 0.],