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


Python scipy.cos方法代码示例

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


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

示例1: pix2vert

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import cos [as 别名]
def pix2vert(nside,ipix,nest=False):
		"""
		NAME:
		   pix2vert
		PURPOSE:
		   calculate the locations of the vertices (theta,phi)
		   of a given HEALPix pixel
		INPUT:
		   nside - HEALPix resolution parameter
		   ipix - pixel number
		   nest - if True, use NESTED scheme (default: RING)
		OUTPUT:
		   numpy.array([4,2]) theta,phi [rad] NWSE
		HISTORY:
		   2010-01-21 - Written - Bovy (NYU)
		"""
		(centerTheta,centerPhi)= healpy.pix2ang(nside,ipix,nest=nest)
		#Are we in the polar regime or in the equatorial regime?
		z= sc.cos(centerTheta)
		if z > -2./3. and z < 2./3.:
			return bovy_healpy._ang2vert_eq(nside,centerTheta,centerPhi,z)
		else:
			return bovy_healpy._ang2vert(nside,centerTheta,centerPhi,z) 
开发者ID:segasai,项目名称:astrolibpy,代码行数:25,代码来源:healmap.py

示例2: coszen

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import cos [as 别名]
def coszen(self):
        """ Return the cosine of the solar zenith."""
        self.dt = self.datetime
        az, zen, ra, dec, h = sunpos(self.datetime, self.latitude,
                                     self.longitudeE,
                                     self.surface_elevation_km * 1000.0,
                                     radians=True)
        return s.cos(zen) 
开发者ID:isofit,项目名称:isofit,代码行数:10,代码来源:geometry.py

示例3: spherical_integral

# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import cos [as 别名]
def spherical_integral(C,rho):
    """
    Calculate the integral of a function over a unit sphere.
    """
    # phi - azimuthal angle (angle in xy-plane)
    # theta - polar angle (angle between z and xy-plane)
    #       (  y  , x )
    def func(theta,phi,C,rho):  # Test function. Can I get 4*pi^2????
        x = sp.cos(phi)*sp.sin(theta)
        y = sp.sin(phi)*sp.sin(theta)
        z = sp.cos(theta)
        #dir = sp.array((x,y,z))
        #dc = dir_cosines(dir)
        dc = sp.array((x,y,z))  # Turns out these are direction cosines!
        Gamma = make_gamma(dc,C)
        rho_c_square = linalg.eigvals(Gamma).real  # GPa
        rho_c_square = rho_c_square*1e9  # Pa
        sound_vel = sp.sqrt(rho_c_square/rho)  # m/s
        integrand = 1/(sound_vel[0]**3) + 1/(sound_vel[1]**3) + 1/(sound_vel[2]**3)
        return integrand*sp.sin(theta)
    #        (  y  , x      )
    #def sfunc(theta,phi,args=()):
    #    return func(theta,phi,args)*sp.sin(theta)

    integral,error = dblquad(func,0,2*sp.pi,lambda g: 0,lambda h:
            sp.pi,args=(C,rho))
    return integral


#direction = sp.array((1.0,1.0,1.0))
#dc = dir_cosines(direction)
#C = read_file.read_file(sys.argv[1])
#C.pop(0)
#C = sp.array(C,float)
#Gamma = make_gamma(dc,C)
#density = 7500 #kg/m**3
#density = float(read_file.read_file(sys.argv[2])[0][0])
#rho_c_square = linalg.eigvals(Gamma) #GPa
#rho_c_square = rho_c_square*1e9 #Pa
#sound_vel = sp.sqrt(rho_c_square/density).real
#avg_vel = sp.average(sound_vel)
#print Gamma
#print direction
#print C
#print rho_c_square
#print rho_c_square.real
#print sound_vel," in m/s"
#print avg_vel
#print spherical_integral(C,density) 
开发者ID:wolverton-research-group,项目名称:qmpy,代码行数:51,代码来源:sound_waves.py


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