analysis.py 文件源码

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

项目:AdK_analysis 作者: orbeckst 项目源码 文件源码
def contour_area(self,edges,resolution=0.1,**limits):
        """Return the area of each contour interval within the limits.

        edges           list containing the contour edges (1D array)
        resolution      resolution of the spline map used to calculate the area

        TODO: better handling of limits
        """

        lim = self.limits.copy()
        lim.update(limits)
        XX,YY = numpy.mgrid[lim['minNMP']:lim['maxNMP']:resolution,
                            lim['minLID']:lim['maxLID']:resolution]
        A = self.F(XX,YY)
        e = numpy.asarray(edges)
        area = numpy.zeros(len(e)-1,dtype=int)
        area[:] = [len(A[numpy.logical_and(lo <= A, A < hi)]) for lo,hi in zip(e[:-1],e[1:])]
        return area * resolution**2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号