当前位置: 首页>>代码示例>>Python>>正文


Python ma.power方法代码示例

本文整理汇总了Python中numpy.ma.power方法的典型用法代码示例。如果您正苦于以下问题:Python ma.power方法的具体用法?Python ma.power怎么用?Python ma.power使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy.ma的用法示例。


在下文中一共展示了ma.power方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: moment

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import power [as 别名]
def moment(a, moment=1, axis=0):
    a, axis = _chk_asarray(a, axis)
    if moment == 1:
        # By definition the first moment about the mean is 0.
        shape = list(a.shape)
        del shape[axis]
        if shape:
            # return an actual array of the appropriate shape
            return np.zeros(shape, dtype=float)
        else:
            # the input was 1D, so return a scalar instead of a rank-0 array
            return np.float64(0.0)
    else:
        mn = ma.expand_dims(a.mean(axis=axis), axis)
        s = ma.power((a-mn), moment)
        return s.mean(axis=axis) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:mstats_basic.py

示例2: kurtosistest

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import power [as 别名]
def kurtosistest(a, axis=0):
    a, axis = _chk_asarray(a, axis)
    n = a.count(axis=axis).astype(float)
    if np.min(n) < 20:
        warnings.warn(
            "kurtosistest only valid for n>=20 ... continuing anyway, n=%i" %
            np.min(n))
    b2 = kurtosis(a, axis, fisher=False)
    E = 3.0*(n-1) / (n+1)
    varb2 = 24.0*n*(n-2)*(n-3) / ((n+1)*(n+1)*(n+3)*(n+5))
    x = (b2-E)/ma.sqrt(varb2)
    sqrtbeta1 = 6.0*(n*n-5*n+2)/((n+7)*(n+9)) * np.sqrt((6.0*(n+3)*(n+5)) /
                                                        (n*(n-2)*(n-3)))
    A = 6.0 + 8.0/sqrtbeta1 * (2.0/sqrtbeta1 + np.sqrt(1+4.0/(sqrtbeta1**2)))
    term1 = 1 - 2./(9.0*A)
    denom = 1 + x*ma.sqrt(2/(A-4.0))
    denom[denom < 0] = masked
    term2 = ma.power((1-2.0/A)/denom,1/3.0)
    Z = (term1 - term2) / np.sqrt(2/(9.0*A))
    return Z, (1.0-stats.zprob(Z))*2 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:22,代码来源:mstats_basic.py

示例3: transform_non_affine

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import power [as 别名]
def transform_non_affine(self, a):
        return ma.power(10.0, a) / 10.0 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:scale.py

示例4: __call__

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import power [as 别名]
def __call__(self, value, clip=None):
        if clip is None:
            clip = self.clip

        result, is_scalar = self.process_value(value)

        self.autoscale_None(result)
        gamma = self.gamma
        vmin, vmax = self.vmin, self.vmax
        if vmin > vmax:
            raise ValueError("minvalue must be less than or equal to maxvalue")
        elif vmin == vmax:
            result.fill(0)
        else:
            res_mask = result.data < 0
            if clip:
                mask = ma.getmask(result)
                result = ma.array(np.clip(result.filled(vmax), vmin, vmax),
                                  mask=mask)
            resdat = result.data
            resdat -= vmin
            np.power(resdat, gamma, resdat)
            resdat /= (vmax - vmin) ** gamma

            result = np.ma.array(resdat, mask=result.mask, copy=False)
            result[res_mask] = 0
        if is_scalar:
            result = result[0]
        return result 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:31,代码来源:colors.py

示例5: inverse

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import power [as 别名]
def inverse(self, value):
        if not self.scaled():
            raise ValueError("Not invertible until scaled")
        gamma = self.gamma
        vmin, vmax = self.vmin, self.vmax

        if cbook.iterable(value):
            val = ma.asarray(value)
            return ma.power(value, 1. / gamma) * (vmax - vmin) + vmin
        else:
            return pow(value, 1. / gamma) * (vmax - vmin) + vmin 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:13,代码来源:colors.py

示例6: transform_non_affine

# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import power [as 别名]
def transform_non_affine(self, a):
        return ma.power(self.base, a) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:4,代码来源:scale.py


注:本文中的numpy.ma.power方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。