Example #1
0
 def read_cube(self):
     a = np.array([[1.0, -1.3], [1.3, -0.2]], dtype=cb.get_default_dtype())
     a.tofile("file_a.raw")
     returncode, output, error = self.run_program("""-e 'read_cube(filename="file_a.raw", shape=("{s}"), dtype="{t!r}")' '_r.sum()' --print""".format(
         s=Shape(a.shape),
         t=cb.get_dtype_name(a.dtype),
     ))
     self.assertEqual(returncode, 0)
     v = float(output.strip())
     self.assertAlmostEqual(v, a.sum())
Example #2
0
 def test_get_default_dtype(self):
     self.assertEqual(cb.get_dtype_name(cb.get_default_dtype()), "float32")
Example #3
0
 def test_get_default_dtype(self):
     self.assertEqual(cb.get_dtype_name(cb.get_default_dtype()), "float32")