aboutsummaryrefslogtreecommitdiffstats
path: root/submitter/mcmc_dag.py
blob: 79f9b6db6d3578a29b7c3d3073886b7769b64b08 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#! /usr/bin/env python

import os
import numpy as np

full_scan_mfr = [
    # (1, 1, 1), (1, 0, 0)
]

fix_sfr_mfr = [
    (1, 1, 1, 1, 2, 0),
    (1, 1, 1, 1, 0, 0),
    (1, 1, 1, 0, 1, 0),
    (1, 1, 1, 0, 0, 1),
    # (1, 1, 0, 1, 2, 0),
    # (1, 1, 0, 1, 0, 0),
    # (1, 1, 0, 0, 1, 0),
    # (1, 0, 0, 1, 0, 0),
    # (0, 1, 0, 0, 1, 0),
    # (1, 2, 0, 1, 2, 0),
    # (1, 2, 0, 0, 1, 0),
]

GLOBAL_PARAMS = {}

# MCMC
GLOBAL_PARAMS.update(dict(
    run_mcmc = 'True',
    burnin   = 2500,
    nsteps   = 10000,
    nwalkers = 60,
    seed     = 'None',
    mcmc_seed_type = 'uniform'
))

# FR
dimension         = [3, 6]
GLOBAL_PARAMS.update(dict(
    threads           = 1,
    binning           = '1e4 1e7 5',
    no_bsm            = 'False',
    scale_region      = "1E10",
    energy_dependance = 'spectral',
    spectral_index    = -2,
    fix_mixing        = 'False',
    fix_mixing_almost = 'False'
))

# Likelihood
GLOBAL_PARAMS.update(dict(
    likelihood  = 'gaussian',
    sigma_ratio = '0.01'
))

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

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

outfile = 'dagman_FR_MCMC.submit'
golemfitsourcepath = os.environ['GOLEMSOURCEPATH'] + '/GolemFit'
condor_script = golemfitsourcepath + '/scripts/flavour_ratio/submitter/mcmc_submit.sub'

with open(outfile, 'w') as f:
    job_number = 1
    for dim in dimension:
        print 'dimension', dim
        outchain_head = '/data/user/smandalia/flavour_ratio/data/{0}/DIM{1}/SI_{2}'.format(
            GLOBAL_PARAMS['likelihood'], dim, GLOBAL_PARAMS['spectral_index']
        )
        for frs in fix_sfr_mfr:
            print 'frs', frs
            outchains = outchain_head + '/fix_ifr/'
            if GLOBAL_PARAMS['likelihood'].lower() == 'gaussian':
                outchains += '{0}/'.format(str(GLOBAL_PARAMS['sigma_ratio']).replace('.', '_'))
            outchains += 'mcmc_chain'
            f.write('JOB\tjob{0}\t{1}\n'.format(job_number, condor_script))
            f.write('VARS\tjob{0}\tdimension="{1}"\n'.format(job_number, dim))
            f.write('VARS\tjob{0}\tmr0="{1}"\n'.format(job_number, frs[0]))
            f.write('VARS\tjob{0}\tmr1="{1}"\n'.format(job_number, frs[1]))
            f.write('VARS\tjob{0}\tmr2="{1}"\n'.format(job_number, frs[2]))
            f.write('VARS\tjob{0}\tfix_source_ratio="{1}"\n'.format(job_number, True))
            f.write('VARS\tjob{0}\tsr0="{1}"\n'.format(job_number, frs[3]))
            f.write('VARS\tjob{0}\tsr1="{1}"\n'.format(job_number, frs[4]))
            f.write('VARS\tjob{0}\tsr2="{1}"\n'.format(job_number, frs[5]))
            for key in GLOBAL_PARAMS.keys():
                f.write('VARS\tjob{0}\tmr0="{1}"\n'.format(job_number, GLOBAL_PARAMS[key]))
            f.write('VARS\tjob{0}\toutfile="{1}"\n'.format(job_number, outfile))
            job_number += 1

        for frs in full_scan_mfr:
            print 'frs', frs
            outchains = outchain_head + '/full/'
            if GLOBAL_PARAMS['likelihood'].lower() == 'gaussian':
                outchains += '{0}/'.format(str(GLOBAL_PARAMS['sigma_ratio']).replace('.', '_'))
            outchains += 'mcmc_chain'
            f.write('JOB\tjob{0}\t{1}\n'.format(job_number, condor_script))
            f.write('VARS\tjob{0}\tdimension="{1}"\n'.format(job_number, dim))
            f.write('VARS\tjob{0}\tmr0="{1}"\n'.format(job_number, frs[0]))
            f.write('VARS\tjob{0}\tmr1="{1}"\n'.format(job_number, frs[1]))
            f.write('VARS\tjob{0}\tmr2="{1}"\n'.format(job_number, frs[2]))
            f.write('VARS\tjob{0}\tfix_source_ratio="{1}"\n'.format(job_number, False))
            f.write('VARS\tjob{0}\tsr0="{1}"\n'.format(job_number, 0))
            f.write('VARS\tjob{0}\tsr1="{1}"\n'.format(job_number, 0))
            f.write('VARS\tjob{0}\tsr2="{1}"\n'.format(job_number, 0))
            for key in GLOBAL_PARAMS.keys():
                f.write('VARS\tjob{0}\tmr0="{1}"\n'.format(job_number, GLOBAL_PARAMS[key]))
            f.write('VARS\tjob{0}\toutfile="{1}"\n'.format(job_number, outfile))
            job_number += 1