本文整理汇总了Python中Physics.darwinwidth方法的典型用法代码示例。如果您正苦于以下问题:Python Physics.darwinwidth方法的具体用法?Python Physics.darwinwidth怎么用?Python Physics.darwinwidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Physics
的用法示例。
在下文中一共展示了Physics.darwinwidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: diffracted_eranges
# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import darwinwidth [as 别名]
def diffracted_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)
sphi = self.divergence_sphi(self.photon.r)
"""Energy ranges that are diffracted by the crystals."""
##################################################################
#local_xtal_g = self.change_the_g(self.xtal.g)
#local_xtal_gphi = Physics.atan2(local_xtal_g[1], local_xtal_g[0])
#local_xtal_gtheta = math.acos(local_xtal_g[2])
##################################################################
order, reached_max_order = 0,False
factor = 2.5
if self.xtal.structure == "mosaic":
Deltatheta = 1.0 * (self.xtal.fwhm/60/180*pi)
else:
Darwin_Width = Physics.darwinwidth(self.xtal.Z, self.xtal.hkl, self.photon.e)
Deltatheta = Darwin_Width + (self.xtal.dim[2] * self.xtal.curvature) / factor
Delta_curvature = self.xtal.curvature * self.xtal.dim[0]
thetamin, thetamax = self.xtal.gtheta-Deltatheta/2-Delta_curvature/2, self.xtal.gtheta+Deltatheta/2+Delta_curvature/2
constant=-Booklet.hc/(2.*self.xtal.d_hkl)
eranges=[]
while not reached_max_order:
order+=1
cosdeltaphi=math.cos(sphi-self.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)
Emin_= constant*order/(cosdeltaphi*sinstheta*sinthetamin+cosstheta*costhetamin)
Emax_= constant*order/(cosdeltaphi*sinstheta*sinthetamax+cosstheta*costhetamax)
#print "DELTAE", order, Emin_, Emax_, Emax_- Emin_
if Emax_ >= Emax:
if Emin_>=Emax: return eranges
else:
reached_max_order=True
Emax_=Emax
if Emin_ <= Emin:
if Emax_ <= Emin: pass
else:
Emin_=Emin
eranges.append((Emin_, Emax_))
else: eranges.append((Emin_, Emax_))
return eranges
示例2: local_eranges
# 需要导入模块: import Physics [as 别名]
# 或者: from Physics import darwinwidth [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