本文整理汇总了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())