diff options
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/enums.py | 27 | ||||
| -rw-r--r-- | utils/gf.py | 70 | ||||
| -rw-r--r-- | utils/mcmc.py | 9 |
3 files changed, 12 insertions, 94 deletions
diff --git a/utils/enums.py b/utils/enums.py index bce3da2..45f164d 100644 --- a/utils/enums.py +++ b/utils/enums.py @@ -16,19 +16,6 @@ class DataType(Enum): ASMIMOV = 3 -class FitCateg(Enum): - HESESPL = 1 - HESEDPL = 2 - ZPSPL = 3 - ZPDPL = 4 - NUNUBAR2 = 5 - - -class FitFlagCateg(Enum): - DEFAULT = 1 - XS = 2 - - class FitPriorsCateg(Enum): DEFAULT = 1 XS = 2 @@ -49,10 +36,9 @@ class ParamTag(Enum): NONE = 6 -class Priors(Enum): - UNIFORM = 1 - LOGUNIFORM = 2 - JEFFREYS = 3 +class MCMCSeedType(Enum): + UNIFORM = 1 + GAUSSIAN = 2 class SteeringCateg(Enum): @@ -69,10 +55,3 @@ class SteeringCateg(Enum): LONGLIFE = 10 DPL = 11 -class XSCateg(Enum): - HALF = 1 - NOM = 2 - TWICE = 3 - TWICE01 = 4 - TWICE02 = 5 - diff --git a/utils/gf.py b/utils/gf.py index eaa9450..3fb063b 100644 --- a/utils/gf.py +++ b/utils/gf.py @@ -15,7 +15,7 @@ from functools import partial import GolemFitPy as gf -from utils.enums import * +from utils.enums import DataType, SteeringCateg from utils.misc import enum_parse, thread_factors @@ -70,60 +70,6 @@ def data_distributions(fitter): return hdat, binedges -def fit_flags(fitflag_categ): - flags = gf.FitParametersFlag() - if fitflag_categ is FitFlagCateg.xs: - # False means it's not fixed in minimization - flags.NeutrinoAntineutrinoRatio = False - return flags - - -def fit_params(fit_categ): - params = gf.FitParameters() - params.astroNorm = 7.5 - params.astroDeltaGamma = 0.9 - if fit_categ is FitCateg.hesespl: - params.astroNormSec = 0 - elif fit_categ is FitCateg.hesedpl: - params.astroNormSec=7.0 - elif fit_categ is FitCateg.zpspl: - # zero prompt, single powerlaw - params.promptNorm = 0 - params.astroNormSec = 0 - elif fit_categ is FitCateg.zpdpl: - # zero prompt, double powerlaw - params.promptNorm = 0 - params.astroNormSec=7.0 - elif fit_categ is FitCateg.nunubar2: - params.NeutrinoAntineutrinoRatio = 2 - - -def fit_priors(fitpriors_categ): - priors = gf.Priors() - if fitpriors_categ == FitPriorsCateg.xs: - priors.promptNormCenter = 1 - priors.promptNormWidth = 3 - priors.astroDeltaGammaCenter = 0 - priors.astroDeltaGammaWidth = 1 - return priors - - -def gen_steering_params(steering_categ, quiet=False): - params = gf.SteeringParams() - if quiet: params.quiet = True - params.fastmode = False - params.do_HESE_reshuffle = False - params.numc_tag = steering_categ.name - params.baseline_astro_spectral_index = -2. - if steering_categ is SteeringCateg.LONGLIFE: - params.years = [999] - params.numc_tag = 'std_half1' - if steering_categ is SteeringCateg.DPL: - params.diffuse_fit_type = gf.DiffuseFitType.DoublePowerLaw - params.numc_tag = 'std_half1' - return params - - def gf_argparse(parser): parser.add_argument( '--data', default='real', type=partial(enum_parse, c=DataType), @@ -134,18 +80,4 @@ def gf_argparse(parser): choices=SteeringCateg, help='use asimov/fake dataset with specific steering' ) - parser.add_argument( - '--aft', default='hesespl', type=partial(enum_parse, c=FitCateg), - choices=FitCateg, - help='use asimov/fake dataset with specific Fit' - ) - parser.add_argument( - '--axs', default='nom', type=partial(enum_parse, c=XSCateg), - choices=XSCateg, - help='use asimov/fake dataset with xs scaling' - ) - parser.add_argument( - '--priors', default='uniform', type=partial(enum_parse, c=Priors), - choices=Priors, help='Bayesian priors' - ) diff --git a/utils/mcmc.py b/utils/mcmc.py index d2036da..0b78f1e 100644 --- a/utils/mcmc.py +++ b/utils/mcmc.py @@ -10,13 +10,15 @@ Useful functions to use an MCMC for the BSM flavour ratio analysis from __future__ import absolute_import, division import argparse +from functools import partial import emcee import tqdm import numpy as np -from utils.misc import make_dir, parse_bool +from utils.enums import MCMCSeedType +from utils.misc import enum_parse, make_dir, parse_bool def mcmc(p0, triangle_llh, lnprior, ndim, nwalkers, burnin, nsteps, ntemps=1, threads=1): @@ -65,6 +67,11 @@ def mcmc_argparse(parser): '--nsteps', type=int, default=2000, help='Number of steps to run' ) + parser.add_argument( + '--mcmc-seed-type', default='uniform', + type=partial(enum_parse, c=MCMCSeedType), choices=MCMCSeedType, + help='Type of distrbution to make the initial MCMC seed' + ) def flat_seed(paramset, ntemps, nwalkers): |
