Example #1
0
 def runSPheno(self,LHA=None,DEBUG=False):
     """
     Set self.config for PATHS. 
     Using defatull SARAH Toolbox SPHENO command. 
     Return back a pyslha.Doc object for LHA model.
     Designed to change for other MODEL easily
     Set self.config['SPHENO_PATH']. 
     Self self.config['SPHENO_COMMAND'] if not using 
     default SARAH SPHENO executable
     """
     if not LHA:
         LHA=self.LHA
     if self.config['SPHENO_LHA_INPUT']=='':
         inputLHA='LesHouches.in.%s%s' %(self.MODEL,self.low)
     else:
         inputLHA=self.config['SPHENO_LHA_INPUT']
     if self.config['SPHENO_COMMAND']=='':
         SPheno_bin_command='SPheno'+self.MODEL #Default SARAH toolbox command
     else:
         SPheno_bin_command=self.config['SPHENO_COMMAND']
     #writeLHAinFile(xdict,inputLHA)
     pyslha.writeSLHAFile(inputLHA,LHA)
     a=commands.getoutput('%s/%s %s' %(self.config['SPHENO_PATH'],SPheno_bin_command,inputLHA))
     if DEBUG:
         print(a)
     assert os.path.isfile('SPheno.spc.%s' %self.MODEL)
     #print a
     if a.find('Problem')==-1:
         self.LHA_out=pyslha.readSLHAFile('SPheno.spc.%s' %self.MODEL)
     else:
         self.LHA_out=False
     return self.LHA_out
Example #2
0
    def runSPheno(self, LHA=None, DEBUG=False):
        """
        Set self.config for PATHS. 
        Using defatull SARAH Toolbox SPHENO command. 
        Return back a pyslha.Doc object for LHA model.
        Designed to change for other MODEL easily
        Set self.config['SPHENO_PATH']. 
        Self self.config['SPHENO_COMMAND'] if not using 
        default SARAH SPHENO executable
        """
        if not LHA:
            LHA = self.LHA
        if self.config['SPHENO_LHA_INPUT'] == '':
            inputLHA = 'LesHouches.in.%s%s' % (self.MODEL, self.low)
        else:
            inputLHA = self.config['SPHENO_LHA_INPUT']
        if self.config['SPHENO_COMMAND'] == '':
            SPheno_bin_command = 'SPheno' + self.MODEL  #Default SARAH toolbox command
        else:
            SPheno_bin_command = self.config['SPHENO_COMMAND']
        #writeLHAinFile(xdict,inputLHA)
        pyslha.writeSLHAFile(inputLHA, LHA)
        a = commands.getoutput(
            '%s/%s %s' %
            (self.config['SPHENO_PATH'], SPheno_bin_command, inputLHA))
        if DEBUG:
            print(a)
        assert os.path.isfile('SPheno.spc.%s' % self.MODEL)
        #print a
        #exceptions
        if a.find('Problem in OneLoop') > -1:
            a = a.replace('Problem', 'No problem')

        if a.find('Problem') == -1:
            self.LHA_out = pyslha.readSLHAFile('SPheno.spc.%s' % self.MODEL)
            #with comments but without decays
            a = commands.getoutput(
                "cat  SPheno.spc.%s | grep -m 1 -i -B1000 '^decay' | grep -vi '^decay' >  SPheno.spc.%s_nodecays.spc"
                % (self.MODEL, self.MODEL))
            if os.path.isfile("SPheno.spc.%s_nodecays.spc" % self.MODEL):
                self.LHA_out_with_comments = _readSLHAFile_with_comments(
                    "SPheno.spc.%s_nodecays.spc" % self.MODEL)
                #PDG for new particles
                for pid in self.LHA_out_with_comments.blocks['MASS'].entries:
                    if np.abs(pid) > 25:
                        pvalues = self.LHA_out_with_comments.blocks[
                            'MASS'].entries[pid].split('#')
                        if len(pvalues) == 2:
                            self.pdg[pvalues[1].strip()] = pid

        else:
            self.LHA_out = False
            self.LHA_out_with_comments = False

        self.to_series()  #Fill to_Series pandas Series
        return self.LHA_out
Example #3
0
def writeLHAinFile(xdict,lhinfile='LesHouches.in',universal=True,RP=False):
    '''To write LesHouches.in in the right order.'''
    LesHouches2={}
    LesHouches2['AMODSEL']=xdict['MODSEL']
    LesHouches2['BSMINPUTS']=xdict['SMINPUTS']
    LesHouches2['CMINPAR']=xdict['MINPAR']
    if not universal: LesHouches2['DEXTPAR']=xdict['EXTPAR']
    if not RP:
        LesHouches2['ERVSNVEVIN']=xdict['RVSNVEVIN']
        LesHouches2['FRVKAPPAIN']=xdict['RVKAPPAIN']
        
    LesHouches2['GSPhenoInput']=xdict['SPHENOINPUT']
    if not RP:
        LesHouches2['HNEUTRINOBOUNDSIN']=xdict['NEUTRINOBOUNDSIN']
        
    pyslha.writeSLHAFile(lhinfile,LesHouches2,{})
Example #4
0
    def runSPheno(self,LHA=None,DEBUG=False):
        """
        Set self.config for PATHS. 
        Using defatull SARAH Toolbox SPHENO command. 
        Return back a pyslha.Doc object for LHA model.
        Designed to change for other MODEL easily
        Set self.config['SPHENO_PATH']. 
        Self self.config['SPHENO_COMMAND'] if not using 
        default SARAH SPHENO executable
        """
        if not LHA:
            LHA=self.LHA
        if self.config['SPHENO_LHA_INPUT']=='':
            inputLHA='LesHouches.in.%s%s' %(self.MODEL,self.low)
        else:
            inputLHA=self.config['SPHENO_LHA_INPUT']
        if self.config['SPHENO_COMMAND']=='':
            SPheno_bin_command='SPheno'+self.MODEL #Default SARAH toolbox command
        else:
            SPheno_bin_command=self.config['SPHENO_COMMAND']
        #writeLHAinFile(xdict,inputLHA)
        pyslha.writeSLHAFile(inputLHA,LHA)
        a=commands.getoutput('%s/%s %s' %(self.config['SPHENO_PATH'],SPheno_bin_command,inputLHA))
        if DEBUG:
            print(a)
        assert os.path.isfile('SPheno.spc.%s' %self.MODEL)
        #print a
        if a.find('Problem')==-1:
            self.LHA_out=pyslha.readSLHAFile('SPheno.spc.%s' %self.MODEL)
            #with comments but without decays
            a=commands.getoutput("cat  SPheno.spc.%s | grep -m 1 -i -B1000 '^decay' | grep -vi '^decay' >  SPheno.spc.%s_nodecays.spc" %(self.MODEL,self.MODEL))
            if os.path.isfile("SPheno.spc.%s_nodecays.spc" %self.MODEL):
                self.LHA_out_with_comments=_readSLHAFile_with_comments("SPheno.spc.%s_nodecays.spc" %self.MODEL)
                #PDG for new particles
                for pid in self.LHA_out_with_comments.blocks['MASS'].entries:
                    if np.abs(pid)>25:
                        pvalues=self.LHA_out_with_comments.blocks['MASS'].entries[pid].split('#')
                        if len(pvalues)==2:
                            self.pdg[pvalues[1].strip()]=pid

            
        else:
            self.LHA_out=False
            self.LHA_out_with_comments=False
        return self.LHA_out
Example #5
0
 def WriteNewSLHAFile(self, newLHAPath, newLHAcontent, precision_val):
     self.newLHA = pyslha.writeSLHAFile(newLHAPath,
                                        newLHAcontent,
                                        precision=precision_val)
Example #6
0
import numpy as np
import commands
import pyslha
import sys

##To write rp parameters and neutrino 
datos= open('solutions.out','w')
for m0 in [200, 500, 700, 1000]:
    print "m0=", m0
    for tanb in [3, 10, 30, 50]:
        print "tanb=", tanb
        LesHouchesFit,decaysFit=pyslha.readSLHAFile('LesHouches_FIT_ON.in')
        LesHouchesFit['MINPAR'].entries[1]=m0 #M0
        LesHouchesFit['MINPAR'].entries[3]=1.0*tanb #tanbeta
        LesHouchesFit2={'AMODSEL':LesHouchesFit['MODSEL'],'BSMINPUTS':LesHouchesFit['SMINPUTS'],'CMINPAR':LesHouchesFit['MINPAR'],'GSPhenoInput':LesHouchesFit['SPHENOINPUT']}
        pyslha.writeSLHAFile('LesHouches.in',LesHouchesFit2,decaysFit)
#        sys.exit(0)
## Run Spheno with lesHouches.in
#    commands.getoutput('cp LesHouches.in.neutrinofits-ON LesHouches.in')
        commands.getoutput('./bin/SPheno')
##Determine mu
        spc,decays=pyslha.readSLHAFile('SPheno.spc')
        veps=np.asarray(spc['RVKAPPA'].entries.values())
        vsnvev=np.asarray(spc['RVSNVEV'].entries.values())
        vlam=np.asarray(spc['SPHENORP'].entries.values()[0:3])
        vd=spc['SPHENORP'].entries[15]
        mu=((vlam-vd*veps)/vsnvev)[0]
##begin the iterations 
        LesHouches,decays=pyslha.readSLHAFile('LesHouches_MASS.in')
        print "begin loop"
        for i in range(1,100):
Example #7
0
def random_search():
    """DEBUG"""
    epsmax=np.array([1,1,1])
    epsmin=np.array([-1,-1,-1])
    Lammax=np.array([1,1,1])
    Lammin=np.array([-1,-1,-1])
    sign=False
    sgn=lambda n: (-1)**np.random.random_integers(1,2,n)



if __name__ == '__main__':
    #Change some entry of LesHouches dictionary:
    LesHouches['SMINPUTS'].entries[1]=1.28E+02
    #Write SLHA file
    pyslha.writeSLHAFile('LesHouches_new.in',LesHouches,{})
    #obtain vd, and mu
    vd=200.
    mu=400.
    #Loop over initial x
    x=np.random.uniform(-1,1,3)
    #find the minumum
    #.....
    print chisq(x)



#3E-02 0.6 ! epsilon_1
#1.E-05 1. ! epsilon_2
#1.E-05 1. ! epsilon_3
#1.E-05 6.E-02 ! Lambda_1 = v_d epsilon_1 + mu v_L1