def test_saturation_correction_nbframes_wrong_value(self): det = Maxipix("Maxipix") det.saturation_threshold = 10 data = np.ones((3, 3)) * 11 mask = np.zeros((3, 3)) with self.assertRaises(ValueError): det._saturation_correction(data, mask, nb_frames=0)
def test_saturation_correction_wrong_type(self): det = Maxipix("Maxipix") det.saturation_threshold = 10 data = 11 mask = np.zeros((3, 3)) with self.assertRaises(TypeError): det._saturation_correction(data, mask, nb_frames=1)
def test_saturation_correction_shape_mismatch(self): det = Maxipix("Maxipix") det.saturation_threshold = 10 data = np.ones((3, 3)) * 11 mask = np.zeros((3, 4)) with self.assertRaises(ValueError): det._saturation_correction(data, mask, nb_frames=1)
def test_saturation_correction_nbframes_2(self): det = Maxipix("Maxipix") det.saturation_threshold = 10 data = np.ones((3, 3)) * 11 mask = np.zeros((3, 3)) output = det._saturation_correction(data, mask, nb_frames=2) self.assertTrue(np.all(np.isclose(output[0], data))) self.assertTrue(np.all(np.isclose(output[1], mask)))