aboutsummaryrefslogtreecommitdiffstats
path: root/submitter/contour_dag.py
blob: 8b3c11cf281ef582a3f854c9c10aae07816034ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /usr/bin/env python

import os
import numpy as np

gfsource      = os.environ['GOLEMSOURCEPATH'] + '/GolemFit'
condor_script = gfsource + '/scripts/flavour_ratio/submitter/contour_submit.sub'

injected_ratios = [
    (1, 1, 1),
    (1, 0, 0),
    (0, 1, 0),
    (0, 0, 1)
]

datadir = '/data/user/smandalia/flavour_ratio/data/contour'

prefix = ''
# prefix = '_noprior'

golemfitsourcepath = os.environ['GOLEMSOURCEPATH'] + '/GolemFit'
condor_script = golemfitsourcepath + '/scripts/flavour_ratio/submitter/contour_submit.sub'

GLOBAL_PARAMS = {}

GLOBAL_PARAMS.update(dict(
    threads     = 12,
    seed        = 26
))

# Emcee
GLOBAL_PARAMS.update(dict(
    run_mcmc = 'True',
    burnin   = 200,
    nsteps   = 1000,
    nwalkers = 60,
    mcmc_seed_type = 'uniform'
))

# GolemFit
GLOBAL_PARAMS.update(dict(
    ast  = 'p2_0',
    data = 'real'
))

# Plot
GLOBAL_PARAMS.update(dict(
    plot_angles   = 'False',
    plot_elements = 'False',
))

dagfile = 'dagman_CONTOUR_{0}'.format(GLOBAL_PARAMS['data'])
dagfile += prefix + '.submit'

with open(dagfile, 'w') as f:
    job_number = 1
    for inj in injected_ratios:
        print 'inj', inj
        f.write('JOB\tjob{0}\t{1}\n'.format(job_number, condor_script))
        f.write('VARS\tjob{0}\tir0="{1}"\n'.format(job_number, inj[0]))
        f.write('VARS\tjob{0}\tir1="{1}"\n'.format(job_number, inj[1]))
        f.write('VARS\tjob{0}\tir2="{1}"\n'.format(job_number, inj[2]))
        for key in GLOBAL_PARAMS.iterkeys():
            f.write('VARS\tjob{0}\t{1}="{2}"\n'.format(job_number, key, GLOBAL_PARAMS[key]))
        f.write('VARS\tjob{0}\tdatadir="{1}"\n'.format(job_number, datadir))
        job_number += 1
        if GLOBAL_PARAMS['data'] == 'real': break

print 'total jobs = {0}'.format(job_number - 1)
print 'dag file = {0}'.format(dagfile)