def getSVGObject(self): photo = I3_Photo() photo.add_point(p1) photo.add_point(p2) photo.label = "test_Label" p_bottom_left = PhotoScan.Vector((0, 2000)) p_bottom_right = PhotoScan.Vector((2000, 2000)) p_upper_left = PhotoScan.Vector((0, 0)) p_upper_right = PhotoScan.Vector((2000, 0)) photo.add_point(I3_Point(measurement_I=p_bottom_left, projection_I=p_bottom_left)) photo.add_point(I3_Point(measurement_I=p_bottom_right, projection_I=PhotoScan.Vector((2001, 2001)))) photo.add_point(I3_Point(measurement_I=p_upper_left, projection_I=p_upper_left)) photo.add_point(I3_Point(measurement_I=p_upper_right, projection_I=p_upper_right)) class psSensor(): height = 2000 width = 2000 class psCamera(): sensor = psSensor() cam_dummy = psCamera() photo.photoScan_camera = cam_dummy return SVG_Photo_Representation([photo], 700)
def getPhotoforRasterTest(cls): photo = I3_Photo() photo.add_point(p1) photo.add_point(p2) photo.label = "test_Label" p_bottom_left = PhotoScan.Vector((0, 2000)) p_bottom_right = PhotoScan.Vector((2000, 2000)) p_upper_left = PhotoScan.Vector((0, 0)) p_upper_right = PhotoScan.Vector((2000, 0)) photo.add_point(I3_Point(measurement_I=p_bottom_left, projection_I=PhotoScan.Vector((-1, 2001)))) photo.add_point(I3_Point(measurement_I=p_bottom_right, projection_I=PhotoScan.Vector((2001, 2001)))) photo.add_point(I3_Point(measurement_I=p_upper_left, projection_I=PhotoScan.Vector((-1, -1)))) photo.add_point(I3_Point(measurement_I=p_upper_right, projection_I=PhotoScan.Vector((2001, -1)))) class psSensor(): height = 2000 width = 1990 class psCamera(): sensor = psSensor() cam_dummy = psCamera() photo.photoScan_camera = cam_dummy return photo
class TestMyProject(unittest.TestCase): pho1 = I3_Photo() pho1.sigma_I = PhotoScan.Vector((2, 13)) pho2 = I3_Photo() pho2.sigma_I = PhotoScan.Vector((5, 11)) project = I3_Project() project.photos = [pho1, pho2] def test_calcGlobalSigma(self): rms_x, rms_y = self.project._get_RMS_4_all_photos() self.assertAlmostEqual(rms_x, 3.807886553, 6) self.assertAlmostEqual(rms_y, 12.04159458, 6) def test_createProjectSVG(self): pass
def test_addPoint(self): photo = I3_Photo() photo.add_point(p1) self.assertEqual(photo.points[-1], p1) self.assertIs(len(photo.points), 1) photo.add_point() self.assertIsInstance(photo.points[-1], I3_Point)
def test_createSVG(self): photo = I3_Photo() photo.add_point(p1) photo.add_point(p2) photo.label = "test_Label" p_bottom_left = PhotoScan.Vector((0, 2000)) p_bottom_right = PhotoScan.Vector((2000, 2000)) p_upper_left = PhotoScan.Vector((0, 0)) p_upper_right = PhotoScan.Vector((2000, 0)) photo.add_point(I3_Point(measurement_I=p_bottom_left, projection_I=p_bottom_left)) photo.add_point(I3_Point(measurement_I=p_bottom_right, projection_I=PhotoScan.Vector((2001, 0)))) photo.add_point(I3_Point(measurement_I=p_upper_left, projection_I=p_upper_left)) photo.add_point(I3_Point(measurement_I=p_upper_right, projection_I=p_upper_right)) class psSensor(): height = 2000 width = 2000 class psCamera(): sensor = psSensor() cam_dummy = psCamera() photo.photoScan_camera = cam_dummy
class TestMyPhoto(unittest.TestCase): photo = I3_Photo() photo.points.append(p1) photo.points.append(p2) def test_addPoint(self): photo = I3_Photo() photo.add_point(p1) self.assertEqual(photo.points[-1], p1) self.assertIs(len(photo.points), 1) photo.add_point() self.assertIsInstance(photo.points[-1], I3_Point) def test_calc_sigma(self): sigma = self.photo.sigma_I self.assertAlmostEqual(sigma.x, 0.395994834, 6) self.assertAlmostEqual(sigma.y, 0.057946469, 6) # self.assertAlmostEqual(error_quad.x, 0.313623818, 6) #self.assertAlmostEqual(error_quad.y, 0.006715587, 6) def test_calc_Cov_from_ErrorMatrix(self): errorMatrix = [[1.6, 1.7], [0.6, 0.6], [-0.4, -0.4], [-1.4, -1.4], [-0.3, -0.4]] cov = self.photo.calc_cov_from_error_matrix(errorMatrix) var_x = cov[0, 0] var_y = cov[1, 1] cov_xy = cov[0, 1] self.assertAlmostEqual(var_x, 1.026, 4) self.assertAlmostEqual(var_y, 1.10600, 4) self.assertAlmostEqual(cov_xy, 1.064, 4) def test_gestExtremError(self): maxError = self.photo.get_max_error() self.assertAlmostEqual(maxError.x, 0.5565147, 5) self.assertAlmostEqual(maxError.y, 0.0790828, 5) def test_createSVG(self): photo = I3_Photo() photo.add_point(p1) photo.add_point(p2) photo.label = "test_Label" p_bottom_left = PhotoScan.Vector((0, 2000)) p_bottom_right = PhotoScan.Vector((2000, 2000)) p_upper_left = PhotoScan.Vector((0, 0)) p_upper_right = PhotoScan.Vector((2000, 0)) photo.add_point(I3_Point(measurement_I=p_bottom_left, projection_I=p_bottom_left)) photo.add_point(I3_Point(measurement_I=p_bottom_right, projection_I=PhotoScan.Vector((2001, 0)))) photo.add_point(I3_Point(measurement_I=p_upper_left, projection_I=p_upper_left)) photo.add_point(I3_Point(measurement_I=p_upper_right, projection_I=p_upper_right)) class psSensor(): height = 2000 width = 2000 class psCamera(): sensor = psSensor() cam_dummy = psCamera() photo.photoScan_camera = cam_dummy # Optische Kontrolle des SVGs #print(photo.getPhotsSVG()[0].getXML()) @classmethod def getPhotoforRasterTest(cls): photo = I3_Photo() photo.add_point(p1) photo.add_point(p2) photo.label = "test_Label" p_bottom_left = PhotoScan.Vector((0, 2000)) p_bottom_right = PhotoScan.Vector((2000, 2000)) p_upper_left = PhotoScan.Vector((0, 0)) p_upper_right = PhotoScan.Vector((2000, 0)) photo.add_point(I3_Point(measurement_I=p_bottom_left, projection_I=PhotoScan.Vector((-1, 2001)))) photo.add_point(I3_Point(measurement_I=p_bottom_right, projection_I=PhotoScan.Vector((2001, 2001)))) photo.add_point(I3_Point(measurement_I=p_upper_left, projection_I=PhotoScan.Vector((-1, -1)))) photo.add_point(I3_Point(measurement_I=p_upper_right, projection_I=PhotoScan.Vector((2001, -1)))) class psSensor(): height = 2000 width = 1990 class psCamera(): sensor = psSensor() cam_dummy = psCamera() photo.photoScan_camera = cam_dummy return photo
def test_raster_legend(self): photo = I3_Photo() svg_photo = self.getSVGObject() svg_photo.set_raster_legend(SVG_Photo_Representation.colormap, [1, 9]) print(svg_photo.count_legend.getXML())