Example #1
0
def create_python_script_nondiag(opts, dt_type, stage, label, x, y):
    if stage not in ['nondiag'] :
        raise NameError(stage)

    content =  '''#!/usr/bin/env python

from fit import crossfeeds

crossfeeds.stage_%s("%s", "%s", %s, %s)

'''% (stage, dt_type, label, x, y)

    xstr = pair_to_str(x)
    ystr = pair_to_str(y)
    
    filename = 'crossfeeds-%s-%s-%s-%s.py' % (stage, dt_type, xstr, ystr)
    file_ = os.path.join(attr.datpath, dt_type, label, 'src', 'csf', filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1 
    
    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
Example #2
0
def submit_batch_job_nondiag(opts, dt_type, stage, label, x, y):
    script = create_python_script_nondiag(opts, dt_type, stage, label, x, y)
    bash_file = create_bash_file(opts, label, dt_type, script,
                                 'fit-crossfeeds-%s.sh' %stage, subdir='csf')

    xstr = pair_to_str(x)
    ystr = pair_to_str(y)

    logfile = tools.set_file(extbase=attr.logpath,
                             prefix='dir_'+label+'/crossfeeds',
                             comname='stage_%s_%s_%s.txt' %(stage, xstr, ystr))

    qjobname = 'x%s%s' % (xstr, ystr)
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #3
0
def create_python_script(opts, datatype, mode, label, lowmass, highmass):
    content = '''#!/usr/bin/env python

from fit import kkmass2

kkmass2.fit_single_mode("%s", "%s", "%s", %s, %s, %s)

''' % (datatype, mode, label, lowmass, highmass, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'fit-%s.py' % ms

    filename = filename.replace('/', '-')

    file_ = os.path.join(attr.datpath, datatype, label, 'src',
                         'kkmass2/%s_%s' % (lowmass, highmass), filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f = UserFile()
    f.append(content)
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
Example #4
0
def create_python_script(opts, dt_type, mode, label):
    content =  '''#!/usr/bin/env python

from fit import sidebands

sidebands.fit_sidebands_single_mode("%s", "%s", "%s", %s)

'''% (dt_type, mode, label, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'sidebands-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')
    
    file_ = os.path.join(attr.datpath, dt_type, label, 'src', filename)
    
    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
Example #5
0
File: kkmass2.py Project: xshi/dhad
def create_python_script(opts, datatype, mode, label, lowmass, highmass):
    content =  '''#!/usr/bin/env python

from fit import kkmass2

kkmass2.fit_single_mode("%s", "%s", "%s", %s, %s, %s)

'''% (datatype, mode, label, lowmass, highmass, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'fit-%s.py' % ms

    filename = filename.replace('/', '-')
    
    file_ = os.path.join(attr.datpath, datatype, label, 'src',
                         'kkmass2/%s_%s' % (lowmass, highmass) , filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1
        
    f = UserFile()
    f.append(content) 
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
Example #6
0
def create_python_script(opts, dt_type, mode, label):
    content = '''#!/usr/bin/env python

from fit import sidebands

sidebands.fit_sidebands_single_mode("%s", "%s", "%s", %s)

''' % (dt_type, mode, label, opts.test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'sidebands-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')

    file_ = os.path.join(attr.datpath, dt_type, label, 'src', filename)

    verbose = opts.verbose
    if opts.test:
        verbose = 1

    f = UserFile()
    f.append(content)
    f.output(file_, verbose=verbose)
    os.chmod(file_, 0755)
    return filename
Example #7
0
def submit_batch_job(datatype, tag, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)
    pyline = 'from sel import multcand; multcand.%s_tag_mode("%s", "%s", "%s", test=%s)'% (tag, datatype, mode, label, opts.test)

    bash_file_name = 'multcand-%s.sh' % ms 
    bash_file = create_bash_file_pyline(opts, label, datatype, pyline,
                                        bash_file_name, subdir='sel')
    logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    logpath = os.path.join(attr.logpath, label, 'multcand')
    logfile = tools.set_file(extbase=logpath, comname=logname)
    qjobname = 'sel%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #8
0
def submit_batch_job(datatype, tag, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    pyline = 'import yld; yld.%s_tag_mode("%s", "%s", "%s", test=%s)'% (
        tag, datatype, mode, label, opts.test)

    bash_file_name = 'get-yld.sh' 
    bash_file = create_bash_file_pyline(opts, label, datatype, pyline,
                                        bash_file_name)
    logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    logpath = os.path.join(attr.logpath, label, 'yld')
    logfile = tools.set_file(extbase=logpath, comname=logname)
    qjobname = 'sel%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #9
0
File: kpimass.py Project: xshi/dhad
def submit_batch_job(datatype, mode, label, lowmass, highmass, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    pyline = 'from fit import kpimass; kpimass.fit_single_mode("%s", "%s", "%s", %s, %s, %s)' % (datatype, mode, label, lowmass, highmass, opts.test)

    bash_file_name = 'kpimass-fit-%s.sh' % ms
    
    bash_file = create_bash_file_pyline(opts, label, datatype, pyline,
                                        bash_file_name)
    logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    
    prefix='dir_%s/kpimass/%s_%s' % (label, lowmass, highmass)
    logfile = tools.set_file(extbase=attr.logpath, prefix=prefix, comname=logname)
    qjobname = 'kpi%s' % ms
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #10
0
File: kkmass2.py Project: xshi/dhad
def submit_batch_job(datatype, mode, label, lowmass, highmass, opts):
    script = create_python_script(opts, datatype, mode, label, lowmass, highmass)

    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    bash_file_name = 'fit-%s.sh' % ms
    bash_file = create_bash_file(opts, label, datatype, script, bash_file_name,
                                 subdir='kkmass2/%s_%s' % (lowmass, highmass))

    logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    
    prefix='dir_%s/kkmass2/%s_%s' % (label, lowmass, highmass)
    logfile = tools.set_file(extbase=attr.logpath, prefix=prefix, comname=logname)
    qjobname = 'kkm%s' % ms
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #11
0
def submit_batch_job(datatype, mode, label, opts):
    script = create_python_script(opts, datatype, mode, label)
    
    dt =  datatype.replace('/', '-')
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    bash_file_name = 'fit-sidebands-%s-%s.sh' % (dt, ms)
    #bash_file = create_bash_file(script, bash_file_name, 'setpyroot l')
    bash_file = create_bash_file(opts, label, datatype, script, bash_file_name)

    logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    logfile = tools.set_file(extbase=attr.logpath, prefix='dir_'+label,
                             comname=logname)
    qjobname = 'sdb%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #12
0
File: kkmass.py Project: xshi/dhad
def submit_batch_job(datatype, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    script_name =  'kkmass-%s.py' % ms 
    script = create_python_script(opts, script_name, datatype, mode, label)
    
    bash_file_name = 'kkmass-%s.sh' % ms
    bash_file = create_bash_file(opts, label, datatype, script, bash_file_name,
                                 subdir='sel')

    logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    logpath = os.path.join(attr.logpath, label, 'sel', 'kkmass')
    logfile = tools.set_file(extbase=logpath, comname=logname)
    qjobname = 'sel%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #13
0
def submit_batch_job(datatype, mode, label, opts):
    script = create_python_script(opts, datatype, mode, label)

    dt = datatype.replace('/', '-')
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    bash_file_name = 'fit-sidebands-%s-%s.sh' % (dt, ms)
    #bash_file = create_bash_file(script, bash_file_name, 'setpyroot l')
    bash_file = create_bash_file(opts, label, datatype, script, bash_file_name)

    logname = '%s_%s.txt' % (datatype.replace('/', '_'), mode)
    logfile = tools.set_file(extbase=attr.logpath,
                             prefix='dir_' + label,
                             comname=logname)
    qjobname = 'sdb%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #14
0
def submit_batch_job(reweight, datatype, tag, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)
    pyline = 'from sel import multspec; multspec.%s_tag_mode("%s", "%s", "%s", "%s", test=%s)' % (
        tag, reweight, datatype, mode, label, opts.test)

    bash_file_name = 'multspec-%s.sh' % ms
    bash_file = create_bash_file_pyline(opts,
                                        label,
                                        datatype,
                                        pyline,
                                        bash_file_name,
                                        subdir='sel')
    logname = '%s_%s.txt' % (datatype.replace('/', '_'), mode)
    logpath = os.path.join(attr.logpath, label, 'multspec')
    logfile = tools.set_file(extbase=logpath, comname=logname)
    qjobname = 'sel%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #15
0
def submit_batch_job(datatype, mode, label, lowmass, highmass, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    pyline = 'from fit import kpimass; kpimass.fit_single_mode("%s", "%s", "%s", %s, %s, %s)' % (
        datatype, mode, label, lowmass, highmass, opts.test)

    bash_file_name = 'kpimass-fit-%s.sh' % ms

    bash_file = create_bash_file_pyline(opts, label, datatype, pyline,
                                        bash_file_name)
    logname = '%s_%s.txt' % (datatype.replace('/', '_'), mode)

    prefix = 'dir_%s/kpimass/%s_%s' % (label, lowmass, highmass)
    logfile = tools.set_file(extbase=attr.logpath,
                             prefix=prefix,
                             comname=logname)
    qjobname = 'kpi%s' % ms
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #16
0
def submit_batch_job(datatype, tag, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    if mode_sign[1] == None:
        ms = '%s_%s' %(mode_sign[0])
    else:
        ms = tools.pair_to_str(mode_sign)

    pyline = 'import fit; fit.%s_tag_mode("%s", "%s", "%s", test=%s)'% (
        tag, datatype, mode, label, opts.test)

    bash_file_name = 'fit-mbc.sh' 
    bash_file = create_bash_file_pyline(opts, label, datatype, pyline,
                                        bash_file_name)
    #logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    #logpath = os.path.join(attr.logpath, label)#, 'yld')
    #logfile = tools.set_file(extbase=logpath, comname=logname)
    logfile = tools.set_file('txt', datatype, mode_sign[0], tag,
                             prefix='dir_'+label, extbase=attr.logpath)
    qjobname = 'fit%s' % ms
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #17
0
def submit_batch_job(datatype, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    script_name = 'kkmass-%s.py' % ms
    script = create_python_script(opts, script_name, datatype, mode, label)

    bash_file_name = 'kkmass-%s.sh' % ms
    bash_file = create_bash_file(opts,
                                 label,
                                 datatype,
                                 script,
                                 bash_file_name,
                                 subdir='sel')

    logname = '%s_%s.txt' % (datatype.replace('/', '_'), mode)
    logpath = os.path.join(attr.logpath, label, 'sel', 'kkmass')
    logfile = tools.set_file(extbase=logpath, comname=logname)
    qjobname = 'sel%s' % ms

    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #18
0
def submit_batch_job(datatype, mode, label, lowmass, highmass, opts):
    script = create_python_script(opts, datatype, mode, label, lowmass,
                                  highmass)

    mode_sign = tools.get_modekey_sign(mode)
    ms = tools.pair_to_str(mode_sign)

    bash_file_name = 'fit-%s.sh' % ms
    bash_file = create_bash_file(opts,
                                 label,
                                 datatype,
                                 script,
                                 bash_file_name,
                                 subdir='kkmass2/%s_%s' % (lowmass, highmass))

    logname = '%s_%s.txt' % (datatype.replace('/', '_'), mode)

    prefix = 'dir_%s/kkmass2/%s_%s' % (label, lowmass, highmass)
    logfile = tools.set_file(extbase=attr.logpath,
                             prefix=prefix,
                             comname=logname)
    qjobname = 'kkm%s' % ms
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #19
0
def create_python_script(dt_type, mode, label, test):
    content = '''#!/usr/bin/env python

from fit import backgrounds

backgrounds.fit_backgrounds_single_mode("%s", "%s", "%s", %s)

''' % (dt_type, mode, label, test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'backgrounds-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')

    file_ = os.path.join(attr.srcfitpath, filename)

    f = UserFile()
    f.append(content)
    f.output(file_)
    os.chmod(file_, 0755)
    return filename
Example #20
0
def submit_batch_job(datatype, tag, mode, label, opts):
    mode_sign = tools.get_modekey_sign(mode)
    if mode_sign[1] == None:
        ms = '%s_%s' % (mode_sign[0])
    else:
        ms = tools.pair_to_str(mode_sign)

    pyline = 'import fit; fit.%s_tag_mode("%s", "%s", "%s", test=%s)' % (
        tag, datatype, mode, label, opts.test)

    bash_file_name = 'fit-mbc.sh'
    bash_file = create_bash_file_pyline(opts, label, datatype, pyline,
                                        bash_file_name)
    #logname = '%s_%s.txt' %(datatype.replace('/', '_'), mode)
    #logpath = os.path.join(attr.logpath, label)#, 'yld')
    #logfile = tools.set_file(extbase=logpath, comname=logname)
    logfile = tools.set_file('txt',
                             datatype,
                             mode_sign[0],
                             tag,
                             prefix='dir_' + label,
                             extbase=attr.logpath)
    qjobname = 'fit%s' % ms
    tools.qsub_jobs(logfile, qjobname, bash_file, opts.test)
Example #21
0
def create_python_script(dt_type, mode, label, test):
    content =  '''#!/usr/bin/env python

from fit import backgrounds

backgrounds.fit_backgrounds_single_mode("%s", "%s", "%s", %s)

'''% (dt_type, mode, label, test)

    mode_sign = tools.get_modekey_sign(mode)

    ms = tools.pair_to_str(mode_sign)

    filename = 'backgrounds-%s-%s-%s.py' % (dt_type, ms, label)

    filename = filename.replace('/', '-')
    
    file_ = os.path.join(attr.srcfitpath, filename)
    
    f = UserFile()
    f.append(content) 
    f.output(file_)
    os.chmod(file_, 0755)
    return filename