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


Python Constants.kperpsigma方法代码示例

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


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

示例1: Getkperphitmiss

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import kperpsigma [as 别名]
    def Getkperphitmiss(self,string): # to be used within the string decay class
        ''' function used to generate a sensible kperp value based on a hit or miss rejection basis '''
        ''' Find the suitable range (min - max) of kperp values based on the given string '''
        sigma = Constants.kperpsigma()
        g_sigma = Constants.gsigma() # this value is for g(x) such that g(x) > f(x). If edited, needs to be recalculated (c.f. finding a suitable.... generation)
        #g_sigma = Constants.kperpsigma()
        B = 1/(g_sigma*g_sigma)
        A = Constants.g_kperpA()
        M = string.Getstringmass()
        kperpmin = 0
        kperpmax = M/2 # where M is the invariant mass of the string decaying
        # g_kperp = Aexp(-kperp/(gsigma*gsigma) = Aexp(-Bkperp)            #numpy.exp(-M*M/(sigma1*sigma1)) - this factor can be omited as it cancels when creating testvalue (its essentially a constant)
        G_kperp_max = -(A/B)*numpy.exp(-B*kperpmax)
        G_kperp_min = -(A/B)*numpy.exp(-B*kperpmin)
        
        while True:      
            rand_1 = numpy.random.uniform(0,1) #(kperpmin,kperpmax)
            rand_2 = numpy.random.uniform(0,1) #(kperpmin,kperpmax)
            kperp_test = -(1/B)*numpy.log(rand_1*(numpy.exp(-kperpmax*B)-1) + 1) # working inverse function
            #kperp_test = -(1/B)*numpy.log(rand_1*(1-numpy.exp(kperpmax*B)) - 1) # bfroken inverse function
            #kperp_test = -(1/B)*numpy.log(rand_1 - 1 +numpy.exp(-kperpmax*B)) # dans inverse function

            f_kperptest = numpy.exp(-kperp_test*kperp_test/(sigma*sigma))     # system designed such that gx is always greater than fx
            g_kperptest = A*numpy.exp(-B*kperp_test)
            testvalue = f_kperptest/g_kperptest
        
            if rand_2 <= testvalue:
                return kperp_test
                break
            else:
                continue
开发者ID:PyLund-MC,项目名称:PyLund,代码行数:33,代码来源:Stringdecay.py

示例2: exp

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import kperpsigma [as 别名]
def exp(number):
	pdgid = PDG_ID.PDG_Type(number)
	mass = PDG_ID.PDG_Type.mass(pdgid)
	sigma = Constants.kperpsigma()
	value = numpy.exp(-1*mass*mass/(sigma*sigma))
	return value
开发者ID:PyLund-MC,项目名称:PyLund,代码行数:8,代码来源:Gluonsplitting.py


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