GaussClasses.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:livespin 作者: biocompibens 项目源码 文件源码
def draw2D(self, title, image=[]):
        pylab.figure()
        if image == []:
            pylab.imshow(self.image, 'gray')
        else:
            pylab.imshow(image, 'gray')
        pylab.axis('off')
        pylab.autoscale(False)
        for i in xrange(self.nComponents):
            xeq = lambda t: self.params[6 * i + 3] * np.cos(t) * np.cos(self.params[6 * i + 5]) + self.params[
                                                                                                      6 * i + 4] * np.sin(
                t) * np.sin(self.params[6 * i + 5]) + self.params[6 * i + 1]
            yeq = lambda t: - self.params[6 * i + 3] * np.cos(t) * np.sin(self.params[6 * i + 5]) + self.params[
                                                                                                        6 * i + 4] * np.sin(
                t) * np.cos(self.params[6 * i + 5]) + self.params[6 * i + 2]
            t = np.linspace(0, 2 * np.pi, 100)
            x = xeq(t)
            y = yeq(t)
            pylab.scatter(self.params[6 * i + 2], self.params[6 * i + 1], color='k')
            pylab.plot(y.astype(int), x.astype(int), self.colors[i] + '-')
        pylab.savefig(title)
        pylab.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号