render.py 文件源码

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

项目:picasso 作者: jungmannlab 项目源码 文件源码
def mask_locs(self):

        locs = self.locs[0]
        steps_x = len(self.xedges)
        steps_y = len(self.yedges)

        x_ind = np.floor((locs['x']-self.x_min)/(self.x_max-self.x_min)*steps_x)-1
        y_ind = np.floor((locs['y']-self.y_min)/(self.y_max-self.y_min)*steps_y)-1
        x_ind = x_ind.astype(int)
        y_ind = y_ind.astype(int)

        index = self.mask[y_ind,x_ind].astype(bool)
        self.index_locs = locs[index]
        self.index_locs_out = locs[~index]

        H_new, xedges, yedges = np.histogram2d(self.index_locs['x'], self.index_locs['y'], bins=(self.xedges, self.yedges))
        self.H_new = H_new.T  # Let each row list bins with common y range.

        ax4 = self.figure.add_subplot(144, title='Masked image')
        ax4.imshow(self.H_new, interpolation='nearest', origin='low',extent=[self.xedges[0], self.xedges[-1], self.yedges[0], self.yedges[-1]])
        ax4.grid(False)
        self.mask_exists = 1
        self.saveButton.setEnabled(True)
        self.canvas.draw()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号