示例#1
0
 def test_ellipse_conversion(self):
     x, y = ellipsoid_list_to_cartesian(self.radii,
                                        self.thetas,
                                        center=[0, 0],
                                        axes_lengths=[10, 20],
                                        angle=np.pi / 4)
     plt.scatter(x, y)
     p = random_ellipse(num_points=100,
                        center=[0, 0],
                        foci=[20, 10],
                        angle=np.pi / 4)
     plt.scatter(p[:, 0], p[:, 1])
     plt.show()
示例#2
0
 def setUp(self):
     d = np.random.rand(10, 10, 512, 512)
     self.center = [276, 256]
     self.lengths = sorted(np.random.rand(2) * 50 + 100, reverse=True)
     self.angle = np.random.rand() * np.pi
     rand_points = random_ellipse(num_points=1000,
                                  center=self.center,
                                  foci=self.lengths,
                                  angle=self.angle)
     d[:, :, rand_points[:, 0], rand_points[:, 1]] = 10
     self.bs = BaseSignal(data=d, lazy=False)
     self.s = Signal2D(self.bs)
     self.ds = DiffractionSignal(self.s)