kendall_triangles.py 文件源码

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

项目:lddmm-ot 作者: jeanfeydy 项目源码 文件源码
def __init__(self, mode = 'whole sphere', resolution = (45, 90) ):
        "mode = 'whole sphere' | 'spherical blackboard'"
        self.mode = mode
        if self.mode == 'whole sphere' :
            thetas = linspace(0,   pi, resolution[0] + 1)
            phis   = linspace(-pi, pi, resolution[1] + 1)
        elif self.mode == 'spherical blackboard' :
            thetas = linspace(0,.5*pi, resolution[0] + 1)
            phis   = linspace(-pi/3, 0, resolution[1] + 1)

        (self.theta_grid, self.phi_grid) = meshgrid(thetas, phis)
        self.theta_centers = (self.theta_grid[0:-1,0:-1] + self.theta_grid[0:-1,1:] + self.theta_grid[1:,0:-1] + self.theta_grid[1:,1:]) / 4.
        self.phi_centers   = (self.phi_grid[0:-1,0:-1]   + self.phi_grid[0:-1,1:]   + self.phi_grid[1:,0:-1]   + self.phi_grid[1:,1:] ) / 4.

        areas_thetas = (phis[1]-phis[0]) * ( -cos(thetas[1:]) + cos(thetas[0:-1]))
        self.cell_areas = vstack( (areas_thetas,)*(resolution[1]) ).T

        # Setup routines for the interactive "Plot.ly" display
        self.setup_layout()
        self.current_axis = []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号