Пример #1
0
 def test_get_longest_img_diameter_resolution_invariant(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26_two_chains.pdb')
     ref_proj =  fpp.Projection2D(cg, [1., 1.,   1.   ], project_virtual_atoms=True)
     ref_box=ref_proj.get_bounding_square(margin=30)
     scale=ref_box[1]-ref_box[0]
     img1, _=ref_proj.rasterize(70, bounding_square=ref_box, rotate=0) 
     img2, _=ref_proj.rasterize(40, bounding_square=ref_box, rotate=0) 
     img3, _=ref_proj.rasterize(60, bounding_square=ref_box, rotate=10)
     d1 = fph.get_longest_img_diameter(img1, scale)
     d2 = fph.get_longest_img_diameter(img2, scale)
     d3 = fph.get_longest_img_diameter(img3, scale)
     self.assertAlmostEqual(d1, d2, places=-1 )
     self.assertAlmostEqual(d1, d3, places=-1 )
     self.assertAlmostEqual(d3, d2, places=-1 )
Пример #2
0
 def test_get_longest_img_diameter_resolution_invariant(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26_two_chains.pdb')
     ref_proj = fpp.Projection2D(
         cg, [1., 1.,   1.], project_virtual_atoms=True)
     ref_box = ref_proj.get_bounding_square(margin=30)
     scale = ref_box[1] - ref_box[0]
     img1, _ = ref_proj.rasterize(70, bounding_square=ref_box, rotate=0)
     img2, _ = ref_proj.rasterize(40, bounding_square=ref_box, rotate=0)
     img3, _ = ref_proj.rasterize(60, bounding_square=ref_box, rotate=10)
     d1 = fph.get_longest_img_diameter(img1, scale)
     d2 = fph.get_longest_img_diameter(img2, scale)
     d3 = fph.get_longest_img_diameter(img3, scale)
     self.assertAlmostEqual(d1, d2, places=-1)
     self.assertAlmostEqual(d1, d3, places=-1)
     self.assertAlmostEqual(d3, d2, places=-1)
Пример #3
0
 def test_proj_longest_axis_vs_img_diameter(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26_two_chains.pdb')
     ref_proj =  fpp.Projection2D(cg, [1., 1.,   1.   ], project_virtual_atoms=True)
     ref_box=ref_proj.get_bounding_square(margin=30)
     scale=ref_box[1]-ref_box[0]
     ref_img, _=ref_proj.rasterize(70, bounding_square=ref_box, rotate=0)
     self.assertAlmostEqual(ref_proj.longest_axis, fph.get_longest_img_diameter(ref_img, scale), places=-1)
Пример #4
0
 def test_proj_longest_axis_vs_img_diameter(self):
     cg = ftmc.from_pdb('test/forgi/threedee/data/1y26_two_chains.pdb')
     ref_proj = fpp.Projection2D(
         cg, [1., 1.,   1.], project_virtual_atoms=True)
     ref_box = ref_proj.get_bounding_square(margin=30)
     scale = ref_box[1] - ref_box[0]
     ref_img, _ = ref_proj.rasterize(70, bounding_square=ref_box, rotate=0)
     self.assertAlmostEqual(
         ref_proj.longest_axis, fph.get_longest_img_diameter(ref_img, scale), places=-1)
Пример #5
0
 def test_get_longest_img_diameter_diagonal(self):
     self.img[9,9]=1
     self.assertAlmostEqual(fph.get_longest_img_diameter(self.img, 10), 7*math.sqrt(2))
Пример #6
0
 def test_get_longest_img_diameter_straight(self):
     self.assertAlmostEqual(fph.get_longest_img_diameter(self.img, 10), math.sqrt(26))
     self.assertAlmostEqual(fph.get_longest_img_diameter(self.img, 100), 10*math.sqrt(26))
Пример #7
0
 def test_get_longest_img_diameter_diagonal(self):
     self.img[9, 9] = 1
     self.assertAlmostEqual(fph.get_longest_img_diameter(
         self.img, 10), 7 * math.sqrt(2))
Пример #8
0
 def test_get_longest_img_diameter_straight(self):
     self.assertAlmostEqual(
         fph.get_longest_img_diameter(self.img, 10), math.sqrt(26))
     self.assertAlmostEqual(fph.get_longest_img_diameter(
         self.img, 100), 10 * math.sqrt(26))