當前位置: 首頁>>代碼示例>>Python>>正文


Python ma.sin方法代碼示例

本文整理匯總了Python中numpy.ma.sin方法的典型用法代碼示例。如果您正苦於以下問題:Python ma.sin方法的具體用法?Python ma.sin怎麽用?Python ma.sin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在numpy.ma的用法示例。


在下文中一共展示了ma.sin方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: transform_non_affine

# 需要導入模塊: from numpy import ma [as 別名]
# 或者: from numpy.ma import sin [as 別名]
def transform_non_affine(self, ll):
            longitude = ll[:, 0:1]
            latitude  = ll[:, 1:2]

            # Pre-compute some values
            half_long = longitude / 2.0
            cos_latitude = np.cos(latitude)

            alpha = np.arccos(cos_latitude * np.cos(half_long))
            # Mask this array or we'll get divide-by-zero errors
            alpha = ma.masked_where(alpha == 0.0, alpha)
            # The numerators also need to be masked so that masked
            # division will be invoked.
            # We want unnormalized sinc.  numpy.sinc gives us normalized
            sinc_alpha = ma.sin(alpha) / alpha

            x = (cos_latitude * ma.sin(half_long)) / sinc_alpha
            y = (ma.sin(latitude) / sinc_alpha)
            return np.concatenate((x.filled(0), y.filled(0)), 1) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:21,代碼來源:geo.py

示例2: polar2cart

# 需要導入模塊: from numpy import ma [as 別名]
# 或者: from numpy.ma import sin [as 別名]
def polar2cart(rho, theta):
    """
    Convert polar coordinates to cartesian coordinated.

    :param rho: polar rho coordinate
    :param theta: polar theta coordinate in degrees
    :return:
    """
    x = rho * ma.cos(theta)
    y = rho * ma.sin(theta)
    return x, y 
開發者ID:aws-samples,項目名稱:aws-greengrass-mini-fulfillment,代碼行數:13,代碼來源:stages.py

示例3: _apply_function

# 需要導入模塊: from numpy import ma [as 別名]
# 或者: from numpy.ma import sin [as 別名]
def _apply_function(func, arg):
    # type: (QuilParser.FunctionContext, Any) -> Any
    if isinstance(arg, Expression):
        if func.SIN():
            return quil_sin(arg)
        elif func.COS():
            return quil_cos(arg)
        elif func.SQRT():
            return quil_sqrt(arg)
        elif func.EXP():
            return quil_exp(arg)
        elif func.CIS():
            return quil_cis(arg)
        else:
            raise RuntimeError("Unexpected function to apply: " + func.getText())
    else:
        if func.SIN():
            return sin(arg)
        elif func.COS():
            return cos(arg)
        elif func.SQRT():
            return sqrt(arg)
        elif func.EXP():
            return exp(arg)
        elif func.CIS():
            return cos(arg) + complex(0, 1) * sin(arg)
        else:
            raise RuntimeError("Unexpected function to apply: " + func.getText()) 
開發者ID:rigetti,項目名稱:pyquil,代碼行數:30,代碼來源:PyQuilListener.py


注:本文中的numpy.ma.sin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。