本文整理匯總了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)
示例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
示例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())