示例#1
0
 def test_endian_little(self):
     """`PackedBinariesReader`: floats with little-endianness"""
     # Make data and write out
     dtype = np.dtype('<f')
     arr = np.array(np.random.random(self.n), dtype=dtype)
     filename = os.path.join(self.test_dir, 'test.bin')
     arr.tofile(filename)
     # Set up reader
     reader = PackedBinariesReader()
     reader.AddFileName(filename)
     reader.set_data_type('f')
     reader.set_endian(1)  # '<' test that sending an int choice works
     # Perfrom Read
     reader.Update()
     table = reader.GetOutput()
     # Check output
     self._check_data(table, arr)
     return
示例#2
0
 def test_floats(self):
     """`PackedBinariesReader`: floats"""
     # Make data and write out
     dtype = np.dtype('f')
     arr = np.array(np.random.random(self.n), dtype=dtype)
     filename = os.path.join(self.test_dir, 'test.bin')
     arr.tofile(filename)
     # Set up reader
     reader = PackedBinariesReader()
     reader.AddFileName(filename)
     reader.set_data_type('f')
     reader.set_data_name('Test Data')
     # Perfrom Read
     reader.Update()
     table = reader.GetOutput()
     # Check output
     self.assertEqual(table.GetColumnName(0), 'Test Data')
     self._check_data(table, arr)
     return
示例#3
0
 def test_doubles(self):
     """`PackedBinariesReader`: doubles"""
     # Make data and write out
     dtype = np.dtype('d')
     arr = np.array(np.random.random(self.n), dtype=dtype)
     filename = os.path.join(self.test_dir, 'test.bin')
     arr.tofile(filename)
     # Set up reader
     reader = PackedBinariesReader()
     reader.AddFileName(filename)
     reader.set_data_type('d')
     # Perfrom Read
     reader.Update()
     table = reader.GetOutput()
     # Check output
     self._check_data(table, arr)
     return
示例#4
0
 def SetDataName(self, dataName):
     PackedBinariesReader.SetDataName(self, dataName)
示例#5
0
 def SetDataType(self, dtype):
     PackedBinariesReader.SetDataType(self, dtype)
示例#6
0
 def SetEndian(self, endian):
     PackedBinariesReader.SetEndian(self, endian)
示例#7
0
 def GetTimestepValues(self):
     """This is critical for registering the timesteps"""
     return PackedBinariesReader.GetTimestepValues(self)
示例#8
0
 def SetTimeDelta(self, dt):
     PackedBinariesReader.SetTimeDelta(self, dt)
示例#9
0
 def AddFileName(self, fname):
     PackedBinariesReader.AddFileName(self, fname)
示例#10
0
 def __init__(self):
     PackedBinariesReader.__init__(self)
示例#11
0
 def set_data_name(self, data_name):
     PackedBinariesReader.set_data_name(self, data_name)
示例#12
0
 def set_data_type(self, dtype):
     PackedBinariesReader.set_data_type(self, dtype)
示例#13
0
 def set_endian(self, endian):
     PackedBinariesReader.set_endian(self, endian)
示例#14
0
 def get_time_step_values(self):
     """This is critical for registering the timesteps"""
     return PackedBinariesReader.get_time_step_values(self)
示例#15
0
 def set_time_delta(self, dt):
     PackedBinariesReader.set_time_delta(self, dt)