コード例 #1
0
 def testi8c(self):
     # Test int 8 compressed functions
     ana.write('/tmp/pyana-testi8c', self.img_i8, 'testcase', 0)
     self.img_i8c_rec = ana.read('/tmp/pyana-testi8c')
     self.assert_(
         np.sum(self.img_i8c_rec[0][0] - self.img_i8) == 0,
         msg="Storing 8 bits integer data with compression failed (diff: %d)"
         % (np.sum(self.img_i8c_rec[0][0] - self.img_i8)))
コード例 #2
0
ファイル: test_ana.py プロジェクト: examon/sunpy
 def testi8c(self):
     # Test int 8 compressed functions
     ana.write('/tmp/pyana-testi8c', self.img_i8, 'testcase', 1)
     self.img_i8c_rec = ana.read('/tmp/pyana-testi8c')
     print type(self.img_i8c_rec[0][0])
     print type(self.img_i8)
     self.assert_(np.sum(self.img_i8c_rec[0][0] - self.img_i8) == 0,
          msg="Storing 8 bits integer data with compression failed (diff: %d)" % (np.sum(self.img_i8c_rec[0][0] - self.img_i8)))
コード例 #3
0
 def testf32u(self):
     # Test float 32 uncompressed functions
     ana.write('/tmp/pyana-testf32u', self.img_f32, 'testcase', 0)
     self.img_f32u_rec = ana.read('/tmp/pyana-testf32u')
     self.assert_(
         np.sum(self.img_f32u_rec[0][0] - self.img_f32) == 0,
         msg=
         "Storing 32 bits float data without compression failed (diff: %g)"
         % (1.0 * np.sum(self.img_f32u_rec[0][0] - self.img_f32)))
コード例 #4
0
 def testi16u(self):
     # Test int 16 uncompressed functions
     ana.write('/tmp/pyana-testi16u', self.img_i16, 'testcase', 0)
     self.img_i16u_rec = ana.read('/tmp/pyana-testi16u')
     self.assert_(
         np.sum(self.img_i16u_rec[0][0] - self.img_i16) == 0,
         msg=
         "Storing 16 bits integer data without compression failed (diff: %d)"
         % (np.sum(self.img_i16u_rec[0][0] - self.img_i16)))
コード例 #5
0
ファイル: test_ana.py プロジェクト: Cadair/sunpy
def test_f32c():
    # TODO: Bug with same code. Needs to be tracked down.
    #Test if float 32 compressed functions
    #ana.write('/tmp/pyana-testf32c', img_f32, 1, 'testcase', 0)
    #img_f32c_rec = ana.read('/tmp/pyana-testf32c', 1)
    #assert_(np.sum(img_f32c_rec[0][1]- img_f32) == 0,
    #        msg="Storing 32 bits float data without compression failed (diff: %g)" % (1.0*np.sum(img_f32c_rec[0][1] - img_f32)))
    afilename = tempfile.NamedTemporaryFile().name
    with pytest.raises(RuntimeError):
        ana.write(afilename, img_f32, 'testcase', 1)
コード例 #6
0
def test_f32c():
    # TODO: Bug with same code. Needs to be tracked down.
    # Test if float 32 compressed functions
    # ana.write('/tmp/pyana-testf32c', img_f32, 1, 'testcase', 0)
    # img_f32c_rec = ana.read('/tmp/pyana-testf32c', 1)
    # assert_(np.sum(img_f32c_rec[0][1]- img_f32) == 0,
    #        msg="Storing 32 bits float data without compression failed (diff: %g)" % (1.0*np.sum(img_f32c_rec[0][1] - img_f32)))
    afilename = tempfile.NamedTemporaryFile().name
    with pytest.raises(RuntimeError):
        ana.write(afilename, img_f32, 'testcase', 1)
コード例 #7
0
ファイル: test_ana.py プロジェクト: nabobalis/sunpy
def test_read_memmap():
    # Test to check that passing memmap doesn't raise an error
    afilename = tempfile.NamedTemporaryFile().name
    ana.write(afilename, img_f32, 'testcase', 0)

    # Memmap is not supported by ana
    data_memmap, _ = ana.read(afilename, memmap=True)[0]
    assert data_memmap.base is None

    data, _ = ana.read(afilename, memmap=False)[0]
    assert data.base is None

    assert np.sum(data_memmap - data) == 0
コード例 #8
0
ファイル: test_ana.py プロジェクト: Cadair/sunpy
def test_f32u():
    # Test float 32 uncompressed functions
    afilename = tempfile.NamedTemporaryFile().name
    ana.write(afilename, img_f32, 'testcase', 0)
    img_f32u_rec = ana.read(afilename)
    assert np.sum(img_f32u_rec[0][0] - img_f32) == 0
コード例 #9
0
ファイル: test_ana.py プロジェクト: Cadair/sunpy
def test_i16u():
    # Test int 16 uncompressed functions
    afilename = tempfile.NamedTemporaryFile().name
    ana.write(afilename, img_i16, 'testcase', 0)
    img_i16u_rec = ana.read(afilename)
    assert np.sum(img_i16u_rec[0][0] - img_i16) == 0
コード例 #10
0
ファイル: test_ana.py プロジェクト: MediaPlex/sunpy
 def testf32u(self):
     # Test float 32 uncompressed functions
     ana.write('/tmp/pyana-testf32u', self.img_f32, 'testcase', 0)
     self.img_f32u_rec = ana.read('/tmp/pyana-testf32u')
     self.assert_(np.sum(self.img_f32u_rec[0][0]- self.img_f32) == 0,
         msg="Storing 32 bits float data without compression failed (diff: %g)" % (1.0*np.sum(self.img_f32u_rec[0][0] - self.img_f32)))
コード例 #11
0
ファイル: test_ana.py プロジェクト: MediaPlex/sunpy
 def testi16u(self):
     # Test int 16 uncompressed functions
     ana.write('/tmp/pyana-testi16u', self.img_i16, 'testcase', 0)
     self.img_i16u_rec = ana.read('/tmp/pyana-testi16u')
     self.assert_(np.sum(self.img_i16u_rec[0][0] - self.img_i16) == 0,
         msg="Storing 16 bits integer data without compression failed (diff: %d)" % (np.sum(self.img_i16u_rec[0][0] - self.img_i16)))
コード例 #12
0
def test_f32u():
    # Test float 32 uncompressed functions
    afilename = tempfile.NamedTemporaryFile().name
    ana.write(afilename, img_f32, 'testcase', 0)
    img_f32u_rec = ana.read(afilename)
    assert np.sum(img_f32u_rec[0][0] - img_f32) == 0
コード例 #13
0
def test_i16u():
    # Test int 16 uncompressed functions
    afilename = tempfile.NamedTemporaryFile().name
    ana.write(afilename, img_i16, 'testcase', 0)
    img_i16u_rec = ana.read(afilename)
    assert np.sum(img_i16u_rec[0][0] - img_i16) == 0