Commit 06c5914e authored by Javier Quinteros's avatar Javier Quinteros

Add 2 tests to check types in parameters of TDMS

parent 4a0301a6
......@@ -52,7 +52,29 @@ class ConversionTests(unittest.TestCase):
# print(orig[0].stats)
# print(conv[0].stats)
self.assertTrue((orig[0].data==conv[0].data).all(), 'Wrong comparison for one record and one channel!')
self.assertTrue((orig[0].data == conv[0].data).all(), 'Wrong comparison for one record and one channel!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
def testOneChannel2(self):
"""One record from one channel defined by list of channels"""
directory = '/Users/javier/Nextcloud/share_Philippe'
# Start of the time window close to the beginning of the file
stt = datetime(2018, 9, 5, 9, 53, 34)
# Take only 250 samples
ett = stt + timedelta(milliseconds=250)
orig = read('testOneChannel.mseed')
t = TDMS('PDN_1km', directory, channels=[100], starttime=stt, endtime=ett)
with t:
for data in t:
aux = Trace(data=data[0], header=data[1])
conv = Stream([aux])
# print(orig[0].stats)
# print(conv[0].stats)
self.assertTrue((orig[0].data == conv[0].data).all(), 'Wrong comparison for one record and one channel!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
def testTwoChannels(self):
......@@ -73,8 +95,30 @@ class ConversionTests(unittest.TestCase):
aux = Trace(data=data[0], header=data[1])
conv += aux
self.assertTrue((orig[0].data==conv[0].data).all(), 'Wrong comparison for channel 100!')
self.assertTrue((orig[1].data==conv[1].data).all(), 'Wrong comparison for channel 101!')
self.assertTrue((orig[0].data == conv[0].data).all(), 'Wrong comparison for channel 100!')
self.assertTrue((orig[1].data == conv[1].data).all(), 'Wrong comparison for channel 101!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
def testTwoChannels2(self):
"""One record from two channels defined by list of channels"""
directory = '/Users/javier/Nextcloud/share_Philippe'
# Start of the time window close to the beginning of the file
stt = datetime(2018, 9, 5, 9, 53, 34)
# Take only 250 samples
ett = stt + timedelta(milliseconds=250)
orig = read('testTwoChannels.mseed')
t = TDMS('PDN_1km', directory, channels=[100, 101], starttime=stt, endtime=ett)
with t:
conv = Stream()
for data in t:
aux = Trace(data=data[0], header=data[1])
conv += aux
self.assertTrue((orig[0].data == conv[0].data).all(), 'Wrong comparison for channel 100!')
self.assertTrue((orig[1].data == conv[1].data).all(), 'Wrong comparison for channel 101!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
def testTwoRecords(self):
......@@ -95,7 +139,7 @@ class ConversionTests(unittest.TestCase):
aux = Trace(data=data[0], header=data[1])
conv += aux
self.assertTrue((orig[0].data==conv[0].data).all(), 'Wrong comparison for channel 100!')
self.assertTrue((orig[0].data == conv[0].data).all(), 'Wrong comparison for channel 100!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment