當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。