Skip to content
Snippets Groups Projects
Commit 93ba4621 authored by mads's avatar mads
Browse files

fixed all tests

parent 5af59a7a
No related branches found
No related tags found
No related merge requests found
Showing
with 57 additions and 51442 deletions
import pkg_resources
test = "TEST"
try:
__version__ = pkg_resources.get_distribution(__name__).version
except:
......
......@@ -8,15 +8,16 @@ from wetb.dlc.high_level import DLCHighLevel, Weibull
import os
import numpy as np
testfilepath = os.path.join(os.path.dirname(__file__), 'test_files/') # test file path
class TestDLCHighLevel(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.dlc_hl = DLCHighLevel('test_files/DLC_test.xlsx')
self.dlc_hl = DLCHighLevel(testfilepath + 'DLC_test.xlsx')
def test_variables(self):
self.assertEqual(self.dlc_hl.vref, 50)
self.assertEqual(os.path.realpath(self.dlc_hl.res_path), os.path.realpath(os.path.join(os.getcwd(), "test_files/res")))
self.assertEqual(os.path.realpath(self.dlc_hl.res_path), os.path.realpath(testfilepath + "res"))
def test_sensor_info(self):
self.assertEqual(list(self.dlc_hl.sensor_info().name), ['MxTB', 'MyTB', 'MxBR', 'PyBT', 'Pitch', 'PitchBearing', 'Tip1TowerDistance', 'TipTowerDistance'])
......@@ -41,12 +42,12 @@ class TestDLCHighLevel(unittest.TestCase):
def test_file_hour_lst(self):
f, h = self.dlc_hl.file_hour_lst()[0]
self.assertEqual(f, 'test_files\\res\\DLC12_IEC61400-1ed3\\dlc12_wsp04_wdir350_s3001.sel')
self.assertEqual(f, os.path.abspath(testfilepath + 'res\\DLC12_IEC61400-1ed3\\dlc12_wsp04_wdir350_s3001.sel'))
self.assertEqual(h, .975 * .25 * 0.11002961306549919 / 2 * 20 * 365 * 24)
def test_file_hour_lst_count(self):
f, h = self.dlc_hl.file_hour_lst()[-1]
self.assertEqual(f, 'test_files\\res\\DLC31_IEC61400-1ed3\\dlc31_wsp25_wdir000_s0000.sel')
self.assertEqual(f, os.path.abspath(testfilepath + 'res\\DLC31_IEC61400-1ed3\\dlc31_wsp25_wdir000_s0000.sel'))
self.assertAlmostEqual(h, 0.0087201928 * 1 * (50 / 1100) * 20 * 365 * 24)
......@@ -67,7 +68,7 @@ class TestDLCHighLevel(unittest.TestCase):
self.assertTrue(k in self.dlc_hl.sensor_info().keys(), k)
def test_fail_on_res_not_fount(self):
self.dlc_hl = DLCHighLevel('test_files/DLC_test.xlsx', fail_on_resfile_not_found=True)
self.dlc_hl = DLCHighLevel(testfilepath + 'DLC_test.xlsx', fail_on_resfile_not_found=True)
self.assertRaisesRegex(FileNotFoundError, "Result files for dlc='12', wsp='6', wdir='-10' not found")
......
......@@ -6,13 +6,14 @@ Created on 03/09/2015
import unittest
from wetb.fast.fast_io import load_output
import os
class Test(unittest.TestCase):
testfilepath = os.path.join(os.path.dirname(__file__), 'test_files/') # test file path
class TestFastIO(unittest.TestCase):
def test_load_output(self):
data, info = load_output('testfiles/DTU10MW.out')
data, info = load_output(testfilepath + 'DTU10MW.out')
self.assertAlmostEqual(data[4, 3], 4.295E-04)
self.assertEqual(info['name'], "DTU10MW")
self.assertEqual(info['attribute_names'][1], "RotPwr")
......@@ -21,7 +22,7 @@ class Test(unittest.TestCase):
def test_load_binary(self):
data, info = load_output('testfiles/test_binary.outb')
data, info = load_output(testfilepath + 'test_binary.outb')
self.assertEqual(info['name'], 'test_binary')
self.assertEqual(info['description'], 'Modified by mwDeriveSensors on 27-Jul-2015 16:32:06')
self.assertEqual(info['attribute_names'][4], 'RotPwr')
......
This diff is collapsed.
File deleted
from wetb.utils.cython_compile.cython_compile import cython_import
cython_import('pair_range')
cython_import('peak_trough')
cython_import('rainflowcount_astm')
......@@ -48,8 +48,8 @@ def rainflow_windap(signal, levels=255., thresshold=(255 / 50)):
Mean values of the half cycles
Example
-------
Examples
--------
>>> signal = np.array([-2.0, 0.0, 1.0, 0.0, -3.0, 0.0, 5.0, 0.0, -1.0, 0.0, 3.0, 0.0, -4.0, 0.0, 4.0, 0.0, -2.0])
>>> ampl, mean = rainflow_windap(signal)
"""
......
import numpy as np
def rfc_hist(sig_rf, nrbins=46):
"""
Histogram of rainflow counted cycles
====================================
"""Histogram of rainflow counted cycles
hist, bin_edges, bin_avg = rfc_hist(sig, nrbins=46)
......@@ -46,4 +44,4 @@ def rfc_hist(sig_rf, nrbins=46):
# since the sum is also 0, the avg remains zero for those whos hist is zero
bin_avg = hist_sum / hist_
return hist, bin_edges, bin_avg
\ No newline at end of file
return hist, bin_edges, bin_avg
......@@ -6,16 +6,22 @@ Created on 16/07/2013
import unittest
import numpy as np
from wetb.hawc2 import Hawc2io
from wetb.fatigue_tools.bearing_damage import bearing_damage_SWP
from wetb.fatigue_tools.bearing_damage import bearing_damage
import os
class TestBearingDamage(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.tfp = os.path.join(os.path.dirname(__file__), 'test_files/')
def test_bearing_damage_swp(self):
data = Hawc2io.ReadHawc2("test_files/test_bearing_damage").ReadBinary((np.array([4, 26, 6, 32, 8, 38]) - 1).tolist())
self.assertAlmostEqual(bearing_damage_SWP([(data[:, i], data[:, i + 1]) for i in [0, 2, 4]]), 7.755595081475002e+13)
data = Hawc2io.ReadHawc2(self.tfp + "test_bearing_damage").ReadBinary((np.array([4, 26, 6, 32, 8, 38]) - 1).tolist())
self.assertAlmostEqual(bearing_damage([(data[:, i], data[:, i + 1]) for i in [0, 2, 4]]), 7.755595081475002e+13)
if __name__ == "__main__":
......
......@@ -10,9 +10,11 @@ import numpy as np
from wetb.fatigue_tools.fatigue import eq_load, rainflow_astm, rainflow_windap, \
cycle_matrix
from wetb.hawc2 import Hawc2io
import os
testfilepath = os.path.join(os.path.dirname(__file__), 'test_files/') # test file path
class Test(unittest.TestCase):
class TestFatigueTools(unittest.TestCase):
def test_astm1(self):
......@@ -38,17 +40,17 @@ class Test(unittest.TestCase):
[ 0., 0., 2., 1.]]))
def test_windap2(self):
data = Hawc2io.ReadHawc2("test_files/test").ReadBinary([2]).flatten()
data = Hawc2io.ReadHawc2(testfilepath + "test").ReadBinary([2]).flatten()
np.testing.assert_allclose(eq_load(data, neq=61), np.array([[1.356, 1.758, 2.370, 2.784, 3.077, 3.296]]), 0.01)
def test_astm2(self):
data = Hawc2io.ReadHawc2("test_files/test").ReadBinary([2]).flatten()
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)
def test_windap3(self):
data = Hawc2io.ReadHawc2("test_files/test").ReadBinary([2]).flatten()
data = Hawc2io.ReadHawc2(testfilepath + "test").ReadBinary([2]).flatten()
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.],
......@@ -56,7 +58,7 @@ class Test(unittest.TestCase):
def test_astm3(self):
data = Hawc2io.ReadHawc2("test_files/test").ReadBinary([2]).flatten()
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.],
......
......@@ -12,7 +12,7 @@ import unittest
import os
import shutil
class Test(unittest.TestCase):
class Test_gsdf(unittest.TestCase):
f = "tmp/"
def setUp(self):
unittest.TestCase.setUp(self)
......
......@@ -9,9 +9,9 @@ import datetime
from wetb.utils.timing import print_time
from wetb.gtsdf.unix_time import to_unix
class Test(unittest.TestCase):
class TestUnixTime(unittest.TestCase):
@print_time
#@print_time
def r(self, dt):
return [to_unix(dt) for dt in dt]
......
......@@ -36,15 +36,6 @@ import os
################################################################################
class ReadHawc2:
"""
Class title
===========
Class documentation docstring
class subtitle
--------------
and more...
"""
################################################################################
# read *.sel file
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
________________________________________________________________________________________________________________________
Version ID : Pdap 1.2
Time : 14:11:25
Date : 31:03.2014
________________________________________________________________________________________________________________________
Result file : C:/mmpe/programming/python/MMPE/hawc2/ascii2bin/unit_test/Hawc2ascii.dat
________________________________________________________________________________________________________________________
Scans Channels Time [sec] Format
800 28 20.000 ASCII
Channel Variable Description
1 Time s Time
2 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -47.50
3 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -47.50
4 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -47.50
5 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -50.00
6 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -50.00
7 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -50.00
8 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -52.50
9 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -52.50
10 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -52.50
11 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -47.50
12 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -47.50
13 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -47.50
14 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -50.00
15 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -50.00
16 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -50.00
17 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -52.50
18 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -52.50
19 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -52.50
20 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -47.50
21 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -47.50
22 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -47.50
23 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -50.00
24 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -50.00
25 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -50.00
26 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -52.50
27 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -52.50
28 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -52.50
________________________________________________________________________________________________________________________
\ No newline at end of file
File deleted
________________________________________________________________________________________________________________________
Version ID : Pdap 1.2
Time : 14:11:25
Date : 31:03.2014
________________________________________________________________________________________________________________________
Result file : Hawc2ascii_bin.dat
________________________________________________________________________________________________________________________
Scans Channels Time [sec] Format
800 28 20.000 BINARY
Channel Variable Description
1 Time s Time
2 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -47.50
3 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -47.50
4 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -47.50
5 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -50.00
6 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -50.00
7 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -50.00
8 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -52.50
9 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -52.50
10 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -52.50
11 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -47.50
12 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -47.50
13 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -47.50
14 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -50.00
15 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -50.00
16 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -50.00
17 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -52.50
18 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -52.50
19 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -52.50
20 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -47.50
21 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -47.50
22 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -47.50
23 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -50.00
24 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -50.00
25 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -50.00
26 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -52.50
27 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -52.50
28 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -52.50
________________________________________________________________________________________________________________________
Scale factors:
6.25000E-04
5.65541E-02
0.00000E+00
1.24203E-01
3.27578E-02
1.67890E-02
9.77313E-04
1.19489E-01
1.22708E-01
1.25926E-01
5.39287E-02
8.59994E-02
1.18070E-01
3.11474E-02
1.59594E-02
9.30853E-04
1.13800E-01
1.16866E-01
1.19932E-01
5.11688E-02
8.15175E-02
1.12097E-01
2.96155E-02
1.51702E-02
8.82013E-04
1.07819E-01
1.10725E-01
1.13630E-01
File deleted
________________________________________________________________________________________________________________________
Version ID : Pdap 1.2
Time : 14:11:25
Date : 31:03.2014
________________________________________________________________________________________________________________________
Result file : Hawc2bin.dat
________________________________________________________________________________________________________________________
Scans Channels Time [sec] Format
800 28 20.000 BINARY
Channel Variable Description
1 Time s Time
2 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -47.50
3 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -47.50
4 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -47.50
5 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -50.00
6 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -50.00
7 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -50.00
8 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, -1.00, -52.50
9 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, -1.00, -52.50
10 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, -1.00, -52.50
11 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -47.50
12 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -47.50
13 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -47.50
14 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -50.00
15 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -50.00
16 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -50.00
17 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 0.00, -52.50
18 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 0.00, -52.50
19 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 0.00, -52.50
20 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -47.50
21 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -47.50
22 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -47.50
23 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -50.00
24 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -50.00
25 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -50.00
26 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 2.50, 1.00, -52.50
27 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos 0.00, 1.00, -52.50
28 WSP gl. coo.,Vy m/s Free wind speed Vy, gl. coo, of gl. pos -2.50, 1.00, -52.50
________________________________________________________________________________________________________________________
Scale factors:
6.25000E-04
5.65541E-02
0.00000E+00
1.24203E-01
3.27578E-02
1.67890E-02
9.77313E-04
1.19489E-01
1.22708E-01
1.25926E-01
5.39287E-02
8.59994E-02
1.18070E-01
3.11474E-02
1.59594E-02
9.30853E-04
1.13800E-01
1.16866E-01
1.19932E-01
5.11688E-02
8.15175E-02
1.12097E-01
2.96155E-02
1.51702E-02
8.82013E-04
1.07819E-01
1.10725E-01
1.13630E-01
......@@ -10,39 +10,47 @@ import sys
import unittest
from wetb.hawc2.ascii2bin.ascii2bin import ascii2bin, size_from_file
class Test(unittest.TestCase):
testfilepath = os.path.join(os.path.dirname(__file__), 'test_files/') # test file path
class TextUI(object):
def show_message(self, m):
pass
def exec_long_task(self, text, allow_cancel, task, *args, **kwargs):
return task(*args, **kwargs)
class TestAscii2Bin(unittest.TestCase):
def setUp(self):
sys.path.append("../")
def testAscii2bin(self):
for f in ["Hawc2ascii_bin.sel", "Hawc2ascii_bin.dat"]:
if os.path.exists(f):
os.remove(f)
ascii2bin("Hawc2ascii.sel")
if os.path.exists(testfilepath + f):
os.remove(testfilepath + f)
ascii2bin(testfilepath + "Hawc2ascii.sel", ui=TextUI())
ascii_file = Hawc2io.ReadHawc2('Hawc2ascii')
bin_file = Hawc2io.ReadHawc2("Hawc2ascii_bin")
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 testAscii2bin_new_name(self):
for f in ["Hawc2bin.sel", "Hawc2bin.dat"]:
if os.path.exists(f):
os.remove(f)
ascii2bin("Hawc2ascii.sel", "Hawc2bin.sel")
if os.path.exists(testfilepath + f):
os.remove(testfilepath + f)
ascii2bin(testfilepath + "Hawc2ascii.sel", testfilepath + "Hawc2bin.sel", ui=TextUI())
ascii_file = Hawc2io.ReadHawc2('Hawc2ascii')
bin_file = Hawc2io.ReadHawc2("Hawc2bin")
ascii_file = Hawc2io.ReadHawc2(testfilepath + 'Hawc2ascii')
bin_file = Hawc2io.ReadHawc2(testfilepath + "Hawc2bin")
np.testing.assert_array_almost_equal(ascii_file.ReadAscii(), bin_file.ReadBinary(), 1)
self.assertEqual(ascii_file.ChInfo, bin_file.ChInfo)
def testSizeOfFile(self):
self.assertEqual(size_from_file("hawc2ascii.sel"), (800, 28))
self.assertEqual(size_from_file(testfilepath + "hawc2ascii.sel"), (800, 28))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment