aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xplot_sens.py5
-rw-r--r--submitter/sens_dag.py2
-rw-r--r--utils/fr.py14
-rw-r--r--utils/gf.py3
-rw-r--r--utils/likelihood.py9
-rw-r--r--utils/plot.py11
6 files changed, 30 insertions, 14 deletions
diff --git a/plot_sens.py b/plot_sens.py
index a957fe5..1c30bdf 100755
--- a/plot_sens.py
+++ b/plot_sens.py
@@ -173,6 +173,7 @@ def parse_args(args=None):
def main():
args = parse_args()
process_args(args)
+ args.scale = 0
misc_utils.print_args(args)
asimov_paramset, llh_paramset = get_paramsets(args, define_nuisance())
@@ -232,6 +233,7 @@ def main():
if args.likelihood is Likelihood.GAUSSIAN:
infile += '{0}/'.format(str(args.sigma_ratio).replace('.', '_'))
infile += '/DIM{0}/fix_ifr/{1}/{2}/{3}/fr_stat'.format(
+ # infile += '/DIM{0}/fix_ifr/{1}/{2}/{3}/old/fr_stat'.format(
# infile += '/DIM{0}/fix_ifr/seed2/{1}/{2}/{3}/fr_stat'.format(
# infile += '/DIM{0}/fix_ifr/100TeV/{1}/{2}/{3}/fr_stat'.format(
dim, *map(misc_utils.parse_enum, [args.stat_method, args.run_method, args.data])
@@ -286,6 +288,7 @@ def main():
for isrc, src in enumerate(args.source_ratios):
argsc.source_ratio = src
infile = base_infile +'/{0}/{1}/{2}/fr_stat'.format(
+ # infile = base_infile +'/{0}/{1}/{2}/old/fr_stat'.format(
*map(misc_utils.parse_enum, [args.stat_method, args.run_method, args.data])
) + misc_utils.gen_identifier(argsc)
basename = os.path.dirname(infile)
@@ -353,7 +356,7 @@ def main():
elif args.run_method in fixed_angle_categ:
plot_utils.plot_sens_fixed_angle_pretty(
data = data,
- outfile = baseoutfile + '/fixed_angle_pretty_1108',
+ outfile = baseoutfile + '/fixed_angle_pretty',
outformat = ['png', 'pdf'],
args = args,
)
diff --git a/submitter/sens_dag.py b/submitter/sens_dag.py
index 47abd59..be99d8b 100644
--- a/submitter/sens_dag.py
+++ b/submitter/sens_dag.py
@@ -35,7 +35,7 @@ GLOBAL_PARAMS.update(dict(
# MultiNest
GLOBAL_PARAMS.update(dict(
- mn_live_points = 4000,
+ mn_live_points = 1000,
mn_tolerance = 0.1,
mn_output = './mnrun'
))
diff --git a/utils/fr.py b/utils/fr.py
index 81ba3b2..80a26e1 100644
--- a/utils/fr.py
+++ b/utils/fr.py
@@ -248,10 +248,12 @@ def estimate_scale(args):
"""Estimate the scale at which new physics will enter."""
try: m_eign = args.m3x_2
except: m_eign = MASS_EIGENVALUES[1]
- if args.scale is not None:
- scale = args.scale
- scale_region = (scale/args.scale_region, scale*args.scale_region)
- elif args.energy_dependance is EnergyDependance.MONO:
+ if hasattr(args, 'scale'):
+ if args.scale != 0:
+ scale = args.scale
+ scale_region = (scale/args.scale_region, scale*args.scale_region)
+ return scale, scale_region
+ if args.energy_dependance is EnergyDependance.MONO:
scale = np.power(
10, np.round(np.log10(m_eign/args.energy)) - \
np.log10(args.energy**(args.dimension-3))
@@ -319,7 +321,7 @@ def fr_argparse(parser):
help='Fix the new physics scale'
)
parser.add_argument(
- '--scale', type=float, default=None,
+ '--scale', type=float, default=0,
help='Set the new physics scale'
)
parser.add_argument(
@@ -418,7 +420,7 @@ def params_to_BSMu(theta, dim, energy, mass_eigenvalues=MASS_EIGENVALUES,
'--fix-mixing and --fix-mixing-almost cannot be used together'
)
- if not isinstance(theta, list):
+ if not isinstance(theta, (list, tuple)):
theta = [theta]
if fix_mixing is MixingScenario.T12:
diff --git a/utils/gf.py b/utils/gf.py
index ddf3fdd..6ce7863 100644
--- a/utils/gf.py
+++ b/utils/gf.py
@@ -69,7 +69,8 @@ def steering_params(args):
# For Tianlu
# params.years = [999]
- params.minFitEnergy = args.binning[0] # GeV
+ params.minFitEnergy = args.binning[0] # GeV
+ params.maxFitEnergy = args.binning[-1] # GeV
params.load_data_from_text_file = False
return params
diff --git a/utils/likelihood.py b/utils/likelihood.py
index 93f3aea..7079d52 100644
--- a/utils/likelihood.py
+++ b/utils/likelihood.py
@@ -72,6 +72,8 @@ def lnprior(theta, paramset):
prior += Gaussian().logpdf(
param.nominal_value, param.value, param.std
)
+ print 'prioring param', param.name, '=', param.value
+ print 'prior', prior
elif param.prior is PriorsCateg.HALFGAUSS:
prior += Gaussian().logpdf(
param.nominal_value, param.value, param.std
@@ -177,7 +179,8 @@ def triangle_llh(theta, args, asimov_paramset, llh_paramset, fitter):
n = gen_identifier(args) + '.txt'
with open(args.output_measured_fr + n, 'a') as f:
f.write(r'{0:.3f} {1:.3f} {2:.3f} {3:.1f}'.format(
- fr[0], fr[1], fr[2], llh_paramset['logLam'].value
+ float(fr[0]), float(fr[1]), float(fr[2]),
+ llh_paramset['logLam'].value
))
f.write('\n')
@@ -202,6 +205,10 @@ def ln_prob(theta, args, asimov_paramset, llh_paramset, fitter):
lp = lnprior(theta, paramset=llh_paramset)
if not np.isfinite(lp):
return -np.inf
+ llh = triangle_llh(
+ theta, args=args, asimov_paramset=asimov_paramset,
+ llh_paramset=llh_paramset, fitter=fitter
+ )
return lp + triangle_llh(
theta, args=args, asimov_paramset=asimov_paramset,
llh_paramset=llh_paramset, fitter=fitter
diff --git a/utils/plot.py b/utils/plot.py
index a73235b..53a4a84 100644
--- a/utils/plot.py
+++ b/utils/plot.py
@@ -196,10 +196,10 @@ def chainer_plot(infile, outfile, outformat, args, llh_paramset):
# )
if args.data is DataType.REAL:
- fig.text(0.8, 0.7, 'IceCube Preliminary', color='red', fontsize=15,
+ plt.text(0.8, 0.7, 'IceCube Preliminary', color='red', fontsize=15,
ha='center', va='center')
elif args.data in [DataType.ASIMOV, DataType.REALISATION]:
- fig.text(0.8, 0.7, 'IceCube Simulation', color='red', fontsize=15,
+ plt.text(0.8, 0.7, 'IceCube Simulation', color='red', fontsize=15,
ha='center', va='center')
for of in outformat:
@@ -247,14 +247,15 @@ def chainer_plot(infile, outfile, outformat, args, llh_paramset):
g = plot_Tchain(Tchain, trns_axes_labels, trns_ranges)
if args.data is DataType.REAL:
- fig.text(0.8, 0.7, 'IceCube Preliminary', color='red', fontsize=15,
+ plt.text(0.8, 0.7, 'IceCube Preliminary', color='red', fontsize=15,
ha='center', va='center')
elif args.data in [DataType.ASIMOV, DataType.REALISATION]:
- fig.text(0.8, 0.7, 'IceCube Simulation', color='red', fontsize=15,
+ plt.text(0.8, 0.7, 'IceCube Simulation', color='red', fontsize=15,
ha='center', va='center')
mpl.pyplot.figtext(0.5, 0.7, fig_text, fontsize=15)
for of in outformat:
+ print 'Saving', outfile+'_elements'+of
g.export(outfile+'_elements.'+of)
@@ -281,6 +282,8 @@ def plot_statistic(data, outfile, outformat, args, scale_param, label=None):
min_idx = np.argmin(scales)
null = statistic[min_idx]
+ fig_text += '\nnull lnZ = {0:.2f}'.format(null)
+
if args.stat_method is StatCateg.BAYESIAN:
reduced_ev = -(statistic - null)
elif args.stat_method is StatCateg.FREQUENTIST: