def test_read(self): "Test reading of compressed OXD images" for line in TESTIMAGES.split("\n"): vals = line.split() name = vals[0] dim1, dim2 = [int(x) for x in vals[1:3]] mini, maxi, mean, stddev = [float(x) for x in vals[3:]] obj = OXDimage() obj.read(self.fn[name]) self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin") self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax") self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean") self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev") self.assertEqual(dim1, obj.dim1, "dim1") self.assertEqual(dim2, obj.dim2, "dim2")
def test_read(self): "Test reading of compressed OXD images" for vals in TESTIMAGES: name = vals[0] dim1, dim2 = vals[1:3] shape = dim2, dim1 mini, maxi, mean, stddev = vals[3:7] detector_type = vals[7] obj = OXDimage() obj.read(self.fn[name]) self.assertEqual(shape, obj.shape) self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin on " + name) self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax on " + name) self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean on " + name) self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev on " + name) self.assertIn(detector_type, obj.header["Detector type"], "detector type on " + name)