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


Python Physics.normalize方法代码示例

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


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

示例1: __set_g

# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import normalize [as 别名]
 def __set_g(self, g):
     self.__g = array(g)
     self.gnorm = Physics.norm(g)
     self.gnormalized = Physics.normalize(g)
     # angular coordinates (azimuth and colatitude) of the g versor
     self.gtheta = math.acos(self.gnormalized[2])
     self.gphi = Physics.atan2(g[1], g[0])
开发者ID:enricovirgilli,项目名称:lll,代码行数:9,代码来源:Xtal.py

示例2: __set_k

# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import normalize [as 别名]
 def __set_k(self, k):
     self.__k = array(k)
     self.knorm=Physics.norm(k)
     self.knormalized = Physics.normalize(k)
     # Calculates wavelength and energy of the photon
     if self.knorm==0.:
         self.__e, self.__lam=0., '+inf'
     else:
         self.__lam=2.*pi/self.knorm
         self.__e=Booklet.hc/self.__lam
开发者ID:enricovirgilli,项目名称:lll,代码行数:12,代码来源:Source.py

示例3: __set_g

# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import normalize [as 别名]
 def __set_g(self, g):
 
     self.__g = array(g)
     
     self.gnorm = Physics.norm(g)
 
     self.gnormalized = Physics.normalize(g)
     
     # angular coordinates of the reciprocal lattice vector g
     # gtheta is the polar angle (the angle between z axis and g vector)
     # gphi is the azimuthal angle (in the plane xy, from the x axis)
     self.gtheta = math.acos(self.gnormalized[2])
 
     self.gphi = Physics.atan2(g[1], g[0])
开发者ID:enricovirgilli,项目名称:lll,代码行数:16,代码来源:Xtal.py

示例4: local_eranges

# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import normalize [as 别名]
    def local_eranges(self, Emin=1., Emax=1000., sphi=0., stheta=pi, deltasource=0):
        
        l = math.sqrt(self.photon.r[0]**2 + self.photon.r[1]**2)

        #stheta = stheta - self.divergence_stheta(l, deltasource)
        sphi = self.divergence_sphi(self.photon.r)

        local_xtal_g = self.change_the_g(self.xtal.g) 
        lgn=Physics.normalize(local_xtal_g)
        local_xtal_gphi = Physics.atan2(local_xtal_g[1], local_xtal_g[0])
        local_xtal_gtheta = math.acos(lgn[2])
        order, reached_max_order = 0,False
        factor = 2.5 
        Darwin_Width = Physics.darwinwidth(self.xtal.Z, self.xtal.hkl, self.photon.e)
        if self.xtal.structure == "mosaic":
            Deltatheta = 1.0 * (self.xtal.fwhm/60/180*pi) 
        else:
            Deltatheta = Darwin_Width + (self.xtal.dim[2] * self.xtal.curvature) / factor
        Delta_curvature = self.xtal.curvature * self.xtal.dim[0]
        
        thetamin, thetamax = local_xtal_gtheta-Deltatheta/2, local_xtal_gtheta+Deltatheta/2

        constant=-Booklet.hc/(2.*self.xtal.d_hkl)
        eranges=[]
        while not reached_max_order:
            order+=1
            cosdeltaphi=math.cos(sphi-local_xtal_gphi)
            sinstheta=math.sin(stheta)
            cosstheta=math.cos(stheta)
            sinthetamin=math.sin(thetamin)
            costhetamin=math.cos(thetamin)
            sinthetamax=math.sin(thetamax)
            costhetamax=math.cos(thetamax)
            Eminim_= constant*order/(cosdeltaphi*sinstheta*sinthetamin+cosstheta*costhetamin)
            Emaxim_= constant*order/(cosdeltaphi*sinstheta*sinthetamax+cosstheta*costhetamax)
            if Emaxim_ >= Emax:
                if Eminim_>=Emax: return eranges
                else:
                    reached_max_order=True
                    Emaxim_=Emax
            if Eminim_ <= Emin:
                if Emaxim_ <= Emin: pass
                else:
                    Eminim_=Emin
                    eranges.append((Eminim_, Emaxim_))                   
            else: eranges.append((Eminim_, Emaxim_))

        return eranges
开发者ID:enricovirgilli,项目名称:lll,代码行数:50,代码来源:Source.py

示例5: best_thickness

# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import normalize [as 别名]

def best_thickness(keV):
    """Wrapper for the Physics module function"""
    return Physics.best_thickness(keV, Z, hkl, eta)

g=20
theta_0=0

D=2000
dim1=1.5
dim2=1.5
dim3=0.3

g=0
gnormalized = Physics.normalize(g)
gtheta = 0.0


EB = 100.0

def extinction_factor(keVB, theta_0):
    return Physics.extinction_factor(keVB, Z, hkl, microthick, theta_0)


def getDelta(self, tB, OFFSET=0.):
    return pi/2-gtheta-tB


mat_facs = Booklet.mat_fac(Z, hkl)
开发者ID:enricovirgilli,项目名称:lll,代码行数:31,代码来源:gigio.py


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