Пример #1
0
 def check_float(self):
     a = rand(3, 4) * 30
     fname = tempfile.mktemp(".dat")
     io.write_array(fname, a)
     b = io.read_array(fname)
     assert_array_almost_equal(a, b, decimal=4)
     os.remove(fname)
Пример #2
0
 def check_complex(self):
     a = rand(13, 4) + 1j * rand(13, 4)
     fname = tempfile.mktemp(".dat")
     io.write_array(fname, a)
     b = io.read_array(fname, atype=N.Complex)
     assert_array_almost_equal(a, b, decimal=4)
     os.remove(fname)
Пример #3
0
    def check_integer(self):
        from scipy import stats

        a = stats.randint.rvs(1, 20, size=(3, 4))
        fname = tempfile.mktemp(".dat")
        io.write_array(fname, a)
        b = io.read_array(fname, atype=a.dtype.char)
        assert_array_equal(a, b)
        os.remove(fname)