aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShivesh Mandalia <shivesh.mandalia@outlook.com>2020-02-29 02:18:50 +0000
committerShivesh Mandalia <shivesh.mandalia@outlook.com>2020-02-29 02:18:50 +0000
commitb337b7a457341999f97a188945c2c4cc03f7b11c (patch)
tree820f45be852f94ae68fb4a407d677345366db02b
parent7b32b3e2c437f65f6ac946d16463691e7496be29 (diff)
downloadGolemFlavor-b337b7a457341999f97a188945c2c4cc03f7b11c.tar.gz
GolemFlavor-b337b7a457341999f97a188945c2c4cc03f7b11c.zip
move golemfit test to another repo and slightly reluctantly use american style flavor spelling consistently
-rw-r--r--golemflavor/enums.py2
-rw-r--r--golemflavor/fr.py24
-rw-r--r--golemflavor/gf.py2
-rw-r--r--golemflavor/llh.py8
-rw-r--r--golemflavor/mcmc.py2
-rw-r--r--golemflavor/misc.py2
-rw-r--r--golemflavor/mn.py2
-rw-r--r--golemflavor/param.py2
-rw-r--r--golemflavor/plot.py20
-rw-r--r--scripts/contour.py14
-rw-r--r--scripts/fr.py12
-rw-r--r--scripts/mc_texture.py8
-rw-r--r--scripts/mc_unitary.py10
-rw-r--r--scripts/mc_x.py2
-rw-r--r--scripts/plot_sens.py6
-rw-r--r--scripts/sens.py12
-rw-r--r--submitter/sens_dag.py2
-rw-r--r--test/test_LV.py96
-rw-r--r--test/test_NSI.py106
-rw-r--r--test/test_all_gf.py79
-rw-r--r--test/test_gf.py89
-rw-r--r--test/test_gf_freq.py80
-rw-r--r--test/test_gf_simple.py66
23 files changed, 65 insertions, 581 deletions
diff --git a/golemflavor/enums.py b/golemflavor/enums.py
index e85158d..a8fb50e 100644
--- a/golemflavor/enums.py
+++ b/golemflavor/enums.py
@@ -4,7 +4,7 @@
# date : March 17, 2018
"""
-Define Enums for the BSM flavour ratio analysis
+Define Enums for the BSM flavor ratio analysis
"""
from enum import Enum
diff --git a/golemflavor/fr.py b/golemflavor/fr.py
index 9171972..6945ce4 100644
--- a/golemflavor/fr.py
+++ b/golemflavor/fr.py
@@ -4,7 +4,7 @@
# date : March 17, 2018
"""
-Useful functions for the BSM flavour ratio analysis
+Useful functions for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
@@ -80,8 +80,8 @@ def determinant(x):
def angles_to_fr(src_angles):
- """Convert angular projection of the source flavour ratio back into the
- flavour ratio.
+ """Convert angular projection of the source flavor ratio back into the
+ flavor ratio.
Parameters
----------
@@ -90,7 +90,7 @@ def angles_to_fr(src_angles):
Returns
----------
- flavour ratios (nue, numu, nutau)
+ flavor ratios (nue, numu, nutau)
Examples
----------
@@ -238,16 +238,16 @@ def cardano_eqn(ham):
def normalise_fr(fr):
- """Normalise an input flavour combination to a flavour ratio.
+ """Normalise an input flavor combination to a flavor ratio.
Parameters
----------
fr : list, length = 3
- flavour combination
+ flavor combination
Returns
----------
- numpy ndarray flavour ratio
+ numpy ndarray flavor ratio
Examples
----------
@@ -266,7 +266,7 @@ def fr_argparse(parser):
)
parser.add_argument(
'--source-ratio', type=float, nargs=3, default=[1, 2, 0],
- help='Set the source flavour ratio for the case when you want to fix it'
+ help='Set the source flavor ratio for the case when you want to fix it'
)
parser.add_argument(
'--no-bsm', type=parse_bool, default='False',
@@ -287,7 +287,7 @@ def fr_argparse(parser):
def fr_to_angles(ratios):
- """Convert from flavour ratio into the angular projection of the flavour
+ """Convert from flavor ratio into the angular projection of the flavor
ratios.
Parameters
@@ -500,19 +500,19 @@ def test_unitarity(x, prnt=False, rse=False, epsilon=None):
def u_to_fr(source_fr, matrix):
- """Compute the observed flavour ratio assuming decoherence.
+ """Compute the observed flavor ratio assuming decoherence.
Parameters
----------
source_fr : list, length = 3
- Source flavour ratio components
+ Source flavor ratio components
matrix : numpy ndarray, dimension 3
Mixing matrix
Returns
----------
- Measured flavour ratio
+ Measured flavor ratio
Examples
----------
diff --git a/golemflavor/gf.py b/golemflavor/gf.py
index 252e706..4401428 100644
--- a/golemflavor/gf.py
+++ b/golemflavor/gf.py
@@ -4,7 +4,7 @@
# date : March 17, 2018
"""
-Useful GolemFit wrappers for the BSM flavour ratio analysis
+Useful GolemFit wrappers for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
diff --git a/golemflavor/llh.py b/golemflavor/llh.py
index aa5d32d..14678b6 100644
--- a/golemflavor/llh.py
+++ b/golemflavor/llh.py
@@ -4,7 +4,7 @@
# date : April 04, 2018
"""
-Likelihood functions for the BSM flavour ratio analysis
+Likelihood functions for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
@@ -87,10 +87,10 @@ def triangle_llh(theta, args, asimov_paramset, llh_paramset):
# Assigning llh_paramset values from theta happens in this function.
fr = fr_utils.flux_averaged_BSMu(theta, args, spectral_index, llh_paramset)
- flavour_angles = fr_utils.fr_to_angles(fr)
- # print('flavour_angles', map(float, flavour_angles))
+ flavor_angles = fr_utils.fr_to_angles(fr)
+ # print('flavor_angles', map(float, flavor_angles))
for idx, param in enumerate(hypo_paramset.from_tag(ParamTag.BESTFIT)):
- param.value = flavour_angles[idx]
+ param.value = flavor_angles[idx]
if args.likelihood is Likelihood.GOLEMFIT:
llh = gf_utils.get_llh(hypo_paramset)
diff --git a/golemflavor/mcmc.py b/golemflavor/mcmc.py
index 4cad6e7..a1d3e27 100644
--- a/golemflavor/mcmc.py
+++ b/golemflavor/mcmc.py
@@ -4,7 +4,7 @@
# date : March 17, 2018
"""
-Useful functions to use an MCMC for the BSM flavour ratio analysis
+Useful functions to use an MCMC for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
diff --git a/golemflavor/misc.py b/golemflavor/misc.py
index 57fe6f7..9743b1a 100644
--- a/golemflavor/misc.py
+++ b/golemflavor/misc.py
@@ -4,7 +4,7 @@
# date : March 17, 2018
"""
-Misc functions for the BSM flavour ratio analysis
+Misc functions for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
diff --git a/golemflavor/mn.py b/golemflavor/mn.py
index 1e6c9fc..a18a1e8 100644
--- a/golemflavor/mn.py
+++ b/golemflavor/mn.py
@@ -4,7 +4,7 @@
# date : April 19, 2018
"""
-Useful functions to use MultiNest for the BSM flavour ratio analysis
+Useful functions to use MultiNest for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
diff --git a/golemflavor/param.py b/golemflavor/param.py
index 941f265..59a7c59 100644
--- a/golemflavor/param.py
+++ b/golemflavor/param.py
@@ -4,7 +4,7 @@
# date : April 19, 2018
"""
-Param class and functions for the BSM flavour ratio analysis
+Param class and functions for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division
diff --git a/golemflavor/plot.py b/golemflavor/plot.py
index 110032f..abc4633 100644
--- a/golemflavor/plot.py
+++ b/golemflavor/plot.py
@@ -4,7 +4,7 @@
# date : March 19, 2018
"""
-Plotting functions for the BSM flavour ratio analysis
+Plotting functions for the BSM flavor ratio analysis
"""
from __future__ import absolute_import, division, print_function
@@ -258,15 +258,15 @@ def get_tax(ax, scale, ax_labels, rot_ax_labels=False, fontsize=23):
def project(p):
- """Convert from flavour to cartesian."""
+ """Convert from flavor to cartesian."""
a, b, c = p
x = a + b/2.
y = b * np.sqrt(3)/2.
return [x, y]
-def project_toflavour(p, nbins):
- """Convert from cartesian to flavour space."""
+def project_toflavor(p, nbins):
+ """Convert from cartesian to flavor space."""
x, y = p
b = y / (np.sqrt(3)/2.)
a = x - b/2.
@@ -334,12 +334,12 @@ def alpha_shape(points, alpha):
return cascaded_union(triangles), edge_points
-def flavour_contour(frs, nbins, coverage, ax=None, smoothing=0.4,
+def flavor_contour(frs, nbins, coverage, ax=None, smoothing=0.4,
hist_smooth=0.05, plot=True, fill=False, oversample=1.,
delaunay=False, d_alpha=1.5, d_gauss=0.08, debug=False,
**kwargs):
- """Plot the flavour contour for a specified coverage."""
- # Histogram in flavour space
+ """Plot the flavor contour for a specified coverage."""
+ # Histogram in flavor space
os_nbins = nbins * oversample
H, b = np.histogramdd(
(frs[:,0], frs[:,1], frs[:,2]),
@@ -402,8 +402,8 @@ def flavour_contour(frs, nbins, coverage, ax=None, smoothing=0.4,
yi /= float(oversample)
ev_polygon = np.dstack((xi, yi))[0]
- # Remove points interpolated outside flavour triangle
- f_ev_polygon = np.array(map(lambda x: project_toflavour(x, nbins), ev_polygon))
+ # Remove points interpolated outside flavor triangle
+ f_ev_polygon = np.array(map(lambda x: project_toflavor(x, nbins), ev_polygon))
xf, yf, zf = f_ev_polygon.T
mask = np.array((xf < 0) | (yf < 0) | (zf < 0) | (xf > nbins) |
@@ -775,7 +775,7 @@ def plot_table_sens(data, outfile, outformat, args, show_lvatmo=True):
def plot_x(data, outfile, outformat, args, normalise=False):
- """Limit plot as a function of the source flavour ratio for each operator
+ """Limit plot as a function of the source flavor ratio for each operator
texture."""
print('Making X sensitivity plot')
dim = args.dimension
diff --git a/scripts/contour.py b/scripts/contour.py
index 60b117f..4785117 100644
--- a/scripts/contour.py
+++ b/scripts/contour.py
@@ -5,7 +5,7 @@
# date : November 26, 2018
"""
-HESE flavour ratio contour
+HESE flavor ratio contour
"""
from __future__ import absolute_import, division
@@ -68,15 +68,15 @@ def get_paramsets(args, nuisance_paramset):
llh_paramset = ParamSet(llh_paramset)
if args.data is not DataType.REAL:
- flavour_angles = fr_utils.fr_to_angles(args.injected_ratio)
+ flavor = fr_utils.fr_to_angles(args.injected_ratio)
else:
- flavour_angles = fr_utils.fr_to_angles([1, 1, 1])
+ flavor = fr_utils.fr_to_angles([1, 1, 1])
tag = ParamTag.BESTFIT
asimov_paramset.extend(gf_nuisance)
asimov_paramset.extend([
- Param(name='astroFlavorAngle1', value=flavour_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
- Param(name='astroFlavorAngle2', value=flavour_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle1', value=flavor[0], ranges=[ 0., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle2', value=flavor[1], ranges=[-1., 1.], std=0.2, tag=tag),
])
asimov_paramset = ParamSet(asimov_paramset)
@@ -105,12 +105,12 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="BSM flavour ratio analysis",
+ description="BSM flavor ratio analysis",
formatter_class=misc_utils.SortingHelpFormatter,
)
parser.add_argument(
'--injected-ratio', type=float, nargs=3, default=[1, 1, 1],
- help='Set the central value for the injected flavour ratio at IceCube'
+ help='Set the central value for the injected flavor ratio at IceCube'
)
parser.add_argument(
'--seed', type=misc_utils.seed_parse, default='26',
diff --git a/scripts/fr.py b/scripts/fr.py
index 25cc1f8..c8c96e3 100644
--- a/scripts/fr.py
+++ b/scripts/fr.py
@@ -5,7 +5,7 @@
# date : March 17, 2018
"""
-HESE BSM flavour ratio MCMC analysis script
+HESE BSM flavor ratio MCMC analysis script
"""
from __future__ import absolute_import, division
@@ -90,14 +90,14 @@ def get_paramsets(args, nuisance_paramset):
tag = ParamTag.BESTFIT
if args.data is not DataType.REAL:
- flavour_angles = fr_utils.fr_to_angles(args.injected_ratio)
+ flavor_angles = fr_utils.fr_to_angles(args.injected_ratio)
else:
- flavour_angles = fr_utils.fr_to_angles([1, 1, 1])
+ flavor_angles = fr_utils.fr_to_angles([1, 1, 1])
asimov_paramset.extend(gf_nuisance)
asimov_paramset.extend([
- Param(name='astroFlavorAngle1', value=flavour_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
- Param(name='astroFlavorAngle2', value=flavour_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle1', value=flavor_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle2', value=flavor_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
])
asimov_paramset = ParamSet(asimov_paramset)
@@ -135,7 +135,7 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="BSM flavour ratio analysis",
+ description="BSM flavor ratio analysis",
formatter_class=misc_utils.SortingHelpFormatter,
)
parser.add_argument(
diff --git a/scripts/mc_texture.py b/scripts/mc_texture.py
index 9e3f0eb..0a96741 100644
--- a/scripts/mc_texture.py
+++ b/scripts/mc_texture.py
@@ -76,10 +76,10 @@ def get_paramsets(args, nuisance_paramset):
llh_paramset = ParamSet(llh_paramset)
tag = ParamTag.BESTFIT
- flavour_angles = fr_utils.fr_to_angles([1, 1, 1])
+ flavor_angles = fr_utils.fr_to_angles([1, 1, 1])
asimov_paramset.extend([
- Param(name='astroFlavorAngle1', value=flavour_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
- Param(name='astroFlavorAngle2', value=flavour_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle1', value=flavor_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle2', value=flavor_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
])
asimov_paramset = ParamSet(asimov_paramset)
@@ -109,7 +109,7 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="BSM flavour ratio analysis",
+ description="BSM flavor ratio analysis",
formatter_class=misc_utils.SortingHelpFormatter,
)
parser.add_argument(
diff --git a/scripts/mc_unitary.py b/scripts/mc_unitary.py
index 0f0e8f4..4e8598d 100644
--- a/scripts/mc_unitary.py
+++ b/scripts/mc_unitary.py
@@ -58,11 +58,11 @@ def get_paramsets(args, nuisance_paramset):
hypo_paramset = ParamSet(hypo_paramset)
tag = ParamTag.BESTFIT
- flavour_angles = fr_utils.fr_to_angles(args.source_ratio)
+ flavor_angles = fr_utils.fr_to_angles(args.source_ratio)
asimov_paramset.extend([
- Param(name='astroFlavorAngle1', value=flavour_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
- Param(name='astroFlavorAngle2', value=flavour_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle1', value=flavor_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle2', value=flavor_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
])
asimov_paramset = ParamSet(asimov_paramset)
@@ -86,12 +86,12 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="BSM flavour ratio analysis",
+ description="BSM flavor ratio analysis",
formatter_class=misc_utils.SortingHelpFormatter,
)
parser.add_argument(
'--source-ratio', type=float, nargs=3, default=[1, 2, 0],
- help='Set the source flavour ratio'
+ help='Set the source flavor ratio'
)
parser.add_argument(
'--seed', type=misc_utils.seed_parse, default='26',
diff --git a/scripts/mc_x.py b/scripts/mc_x.py
index 875c40b..5d4a934 100644
--- a/scripts/mc_x.py
+++ b/scripts/mc_x.py
@@ -90,7 +90,7 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="BSM flavour ratio analysis",
+ description="BSM flavor ratio analysis",
formatter_class=misc_utils.SortingHelpFormatter,
)
parser.add_argument(
diff --git a/scripts/plot_sens.py b/scripts/plot_sens.py
index 2c827ca..a7b9b28 100644
--- a/scripts/plot_sens.py
+++ b/scripts/plot_sens.py
@@ -5,7 +5,7 @@
# date : April 28, 2018
"""
-HESE BSM flavour ratio analysis plotting script
+HESE BSM flavor ratio analysis plotting script
"""
from __future__ import absolute_import, division
@@ -97,7 +97,7 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="HESE BSM flavour ratio analysis plotting script",
+ description="HESE BSM flavor ratio analysis plotting script",
formatter_class=SortingHelpFormatter,
)
parser.add_argument(
@@ -119,7 +119,7 @@ def parse_args(args=None):
)
parser.add_argument(
'--source-ratios', type=int, nargs='*', default=None,
- required=False, help='Set the source flavour ratios'
+ required=False, help='Set the source flavor ratios'
)
parser.add_argument(
'--x-segments', type=int, default=None,
diff --git a/scripts/sens.py b/scripts/sens.py
index 5198016..39c336d 100644
--- a/scripts/sens.py
+++ b/scripts/sens.py
@@ -5,7 +5,7 @@
# date : March 17, 2018
"""
-HESE BSM flavour ratio analysis script
+HESE BSM flavor ratio analysis script
"""
from __future__ import absolute_import, division
@@ -94,14 +94,14 @@ def get_paramsets(args, nuisance_paramset):
tag = ParamTag.BESTFIT
if args.data is not DataType.REAL:
- flavour_angles = fr_utils.fr_to_angles(args.injected_ratio)
+ flavor_angles = fr_utils.fr_to_angles(args.injected_ratio)
else:
- flavour_angles = fr_utils.fr_to_angles([1, 1, 1])
+ flavor_angles = fr_utils.fr_to_angles([1, 1, 1])
asimov_paramset.extend(gf_nuisance)
asimov_paramset.extend([
- Param(name='astroFlavorAngle1', value=flavour_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
- Param(name='astroFlavorAngle2', value=flavour_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle1', value=flavor_angles[0], ranges=[ 0., 1.], std=0.2, tag=tag),
+ Param(name='astroFlavorAngle2', value=flavor_angles[1], ranges=[-1., 1.], std=0.2, tag=tag),
])
asimov_paramset = ParamSet(asimov_paramset)
@@ -144,7 +144,7 @@ def process_args(args):
def parse_args(args=None):
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
- description="BSM flavour ratio analysis",
+ description="BSM flavor ratio analysis",
formatter_class=misc_utils.SortingHelpFormatter,
)
parser.add_argument(
diff --git a/submitter/sens_dag.py b/submitter/sens_dag.py
index f23bf3d..c51fcbe 100644
--- a/submitter/sens_dag.py
+++ b/submitter/sens_dag.py
@@ -77,7 +77,7 @@ with open(dagfile, 'w') as f:
for sources, tex in scenarios:
print 'texture', tex
for src in sources:
- print 'source flavour', src
+ print 'source flavor', src
for r in xrange(GLOBAL_PARAMS['segments']):
print 'run', r
f.write('JOB\tjob{0}\t{1}\n'.format(job_number, condor_script))
diff --git a/test/test_LV.py b/test/test_LV.py
deleted file mode 100644
index 72d0a9c..0000000
--- a/test/test_LV.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import absolute_import, division
-
-import numpy as np
-import matplotlib
-matplotlib.use('Agg')
-import matplotlib.pyplot as plt
-from matplotlib import rc
-
-import GolemFitPy as gf
-
-rc('text', usetex=True)
-rc('font', **{'family':'serif', 'serif':['Computer Modern'], 'size':18})
-
-dp = gf.DataPaths()
-steer = gf.SteeringParams()
-
-fig = plt.figure(figsize=[12, 8])
-ax = fig.add_subplot(111)
-ax.set_xscale('log')
-ax.set_yscale('log')
-
-npp = gf.NewPhysicsParams()
-npp.type = gf.NewPhysicsType.None
-# npp.n_lv = 1
-# npp.lambda_1 = 1.e100
-# npp.lambda_2 = 1.e100
-
-golem = gf.GolemFit(dp, steer, npp)
-
-binning = golem.GetEnergyBinsMC()
-ax.set_xlim(binning[0], binning[-1])
-# ax.set_ylim(binning[0], binning[-1])
-
-fit_params = gf.FitParameters(gf.sampleTag.HESE)
-golem.SetupAsimov(fit_params)
-
-exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
- drawstyle='steps-pre', label='NULL', linestyle='--')
-
-print 'NULL min_llh', golem.MinLLH().likelihood
-print 'NULL expectation', exp
-print
-
-npp = gf.NewPhysicsParams()
-npp.type = gf.NewPhysicsType.LorentzViolation
-npp.n_lv = 1
-npp.lambda_1 = 1.e20
-npp.lambda_2 = 1.e20
-
-golem.SetNewPhysicsParams(npp)
-
-exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
- drawstyle='steps-pre', label='1e-20 LV', linestyle='--')
-
-print '1e20 LV min_llh', golem.MinLLH().likelihood
-print '1e20 LV expectation', exp
-
-npp = gf.NewPhysicsParams()
-npp.type = gf.NewPhysicsType.LorentzViolation
-npp.n_lv = 1
-npp.lambda_1 = 1.e10
-npp.lambda_2 = 1.e10
-
-golem.SetNewPhysicsParams(npp)
-
-exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
- drawstyle='steps-pre', label='1e-10 LV', linestyle='--')
-
-print '1e10 LV min_llh', golem.MinLLH().likelihood
-print '1e10 LV expectation', exp
-
-npp = gf.NewPhysicsParams()
-npp.type = gf.NewPhysicsType.LorentzViolation
-npp.n_lv = 1
-npp.lambda_1 = 1.e-20
-npp.lambda_2 = 1.e-20
-
-golem.SetNewPhysicsParams(npp)
-
-ax.tick_params(axis='x', labelsize=12)
-ax.tick_params(axis='y', labelsize=12)
-ax.set_xlabel(r'Deposited energy / GeV')
-ax.set_ylabel(r'Events')
-for xmaj in ax.xaxis.get_majorticklocs():
- ax.axvline(x=xmaj, ls=':', color='gray', alpha=0.7, linewidth=1)
-for ymaj in ax.yaxis.get_majorticklocs():
- ax.axhline(y=ymaj, ls=':', color='gray', alpha=0.7, linewidth=1)
-
-legend = ax.legend(prop=dict(size=12))
-fig.savefig('test.png', bbox_inches='tight', dpi=250)
-
diff --git a/test/test_NSI.py b/test/test_NSI.py
deleted file mode 100644
index d144420..0000000
--- a/test/test_NSI.py
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import absolute_import, division
-
-import numpy as np
-import matplotlib
-matplotlib.use('Agg')
-import matplotlib.pyplot as plt
-from matplotlib import rc
-
-import GolemFitPy as gf
-
-rc('text', usetex=True)
-rc('font', **{'family':'serif', 'serif':['Computer Modern'], 'size':18})
-
-dp = gf.DataPaths()
-steer = gf.SteeringParams()
-npp = gf.NewPhysicsParams()
-
-steer.quiet = False
-steer.fastmode = True
-
-golem = gf.GolemFit(dp, steer, npp)
-
-fit_params = gf.FitParameters(gf.sampleTag.HESE)
-golem.SetupAsimov(fit_params)
-
-fig = plt.figure(figsize=[6, 5])
-ax = fig.add_subplot(111)
-ax.set_xscale('log')
-ax.set_yscale('log')
-
-binning = golem.GetEnergyBinsMC()
-ax.set_xlim(binning[0], binning[-1])
-# ax.set_ylim(binning[0], binning[-1])
-
-print 'NULL min_llh', golem.MinLLH().likelihood
-
-# exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-# ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
-# drawstyle='steps-pre', label='NULL', linestyle='--')
-
-# print 'NULL expectation', exp
-print
-
-npp.type = gf.NewPhysicsType.NonStandardInteraction
-npp.epsilon_mutau = 0.1
-golem.SetNewPhysicsParams(npp)
-
-print '0.1 mutau min_llh', golem.MinLLH().likelihood
-
-# exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-# ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
-# drawstyle='steps-pre', label='0.1 mutau', linestyle='--')
-
-# print '0.1 mutau expectation', exp
-print
-
-np.epsilon_mutau = 0.2
-golem.SetNewPhysicsParams(npp)
-
-print '0.2 mutau min_llh', golem.MinLLH().likelihood
-
-# exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-# ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
-# drawstyle='steps-pre', label='0.2 mutau', linestyle='--')
-
-# print '0.2 mutau expectation', exp
-print
-
-np.epsilon_mutau = 0.3
-golem.SetNewPhysicsParams(npp)
-
-print '0.3 mutau min_llh', golem.MinLLH().likelihood
-
-# exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-# ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
-# drawstyle='steps-pre', label='0.3 mutau', linestyle='--')
-
-# print '0.3 mutau expectation', exp
-print
-
-np.epsilon_mutau = 0.4
-golem.SetNewPhysicsParams(npp)
-
-print '0.4 mutau min_llh', golem.MinLLH().likelihood
-
-# exp = np.sum(golem.GetExpectation(fit_params), axis=(0, 1, 2, 3))
-# ax.step(binning, np.concatenate([[exp[0]], exp]), alpha=1,
-# drawstyle='steps-pre', label='0.4 mutau', linestyle='--')
-
-# print '0.4 mutau expectation', exp
-print
-
-ax.tick_params(axis='x', labelsize=12)
-ax.tick_params(axis='y', labelsize=12)
-ax.set_xlabel(r'Deposited energy / GeV')
-ax.set_ylabel(r'Events')
-for xmaj in ax.xaxis.get_majorticklocs():
- ax.axvline(x=xmaj, ls=':', color='gray', alpha=0.7, linewidth=1)
-for ymaj in ax.yaxis.get_majorticklocs():
- ax.axhline(y=ymaj, ls=':', color='gray', alpha=0.7, linewidth=1)
-
-legend = ax.legend(prop=dict(size=12))
-fig.savefig('test_NSI.png', bbox_inches='tight', dpi=250)
-
diff --git a/test/test_all_gf.py b/test/test_all_gf.py
deleted file mode 100644
index 04b0980..0000000
--- a/test/test_all_gf.py
+++ /dev/null
@@ -1,79 +0,0 @@
-import numpy as np
-import matplotlib as mpl
-mpl.use('Agg')
-import matplotlib.pyplot as plt
-
-import GolemFitPy as gf
-
-FASTMODE = True
-PARAMETERS = [
- # 'astroFlavorAngle1', 'astroFlavorAngle2',
- 'convNorm',
- # 'promptNorm', 'muonNorm', 'astroNorm'
-]
-DEFAULTS = [
- # 4/9., 0., 1., 0., 1., 6.9
- 1.
-]
-RANGES = [
- # (0, 1), (-1, 1), (0.01, 10), (0., 30), (0.01, 10), (0.01, 30)
- (0.01, 10)
-]
-BINS = 50
-
-def steering_params():
- steering_categ = 'p2_0'
- params = gf.SteeringParams(gf.sampleTag.HESE)
- if FASTMODE:
- params.fastmode = True
- params.quiet = False
- params.simToLoad= steering_categ.lower()
- return params
-
-def set_up_as(fitter, params):
- print 'Injecting the model', params
- asimov_params = gf.FitParameters(gf.sampleTag.HESE)
- for x in params.iterkeys():
- asimov_params.__setattr__(x, float(params[x]))
- fitter.SetupAsimov(asimov_params)
- priors = gf.Priors()
- priors.convNormWidth = 9e9
- fitter.SetFitPriors(priors)
-
-def setup_fitter(asimov_paramset):
- datapaths = gf.DataPaths()
- sparams = steering_params()
- npp = gf.NewPhysicsParams()
- fitter = gf.GolemFit(datapaths, sparams, npp)
- set_up_as(fitter, asimov_paramset)
- return fitter
-
-def get_llh(fitter, params):
- fitparams = gf.FitParameters(gf.sampleTag.HESE)
- for x in params.iterkeys():
- fitparams.__setattr__(x, float(params[x]))
- llh = -fitter.EvalLLH(fitparams)
- return llh
-
-for ip, param in enumerate(PARAMETERS):
- asimov_paramset = {param: DEFAULTS[ip]}
- print 'injecting', asimov_paramset
- fitter = setup_fitter(asimov_paramset)
- binning = np.linspace(RANGES[ip][0], RANGES[ip][1], BINS)
- llhs = []
- for b in binning:
- test_paramset = {param: b}
- print 'testing', test_paramset
- llh = get_llh(fitter, test_paramset)
- print 'llh', llh
- llhs.append(llh)
- plt.plot(binning, llhs)
- plt.axvline(x=DEFAULTS[ip])
- plt.xlabel(param)
- plt.ylabel('LLH')
- outfile = 'llh_profile_noprior_'
- if FASTMODE:
- plt.savefig(outfile + 'fastmode_{0}.png'.format(param))
- else:
- plt.savefig(outfile + '{0}.png'.format(param))
- plt.clf()
diff --git a/test/test_gf.py b/test/test_gf.py
deleted file mode 100644
index 4b77924..0000000
--- a/test/test_gf.py
+++ /dev/null
@@ -1,89 +0,0 @@
-import numpy.ma as ma
-
-import GolemFitPy as gf
-
-FASTMODE = True
-
-def steering_params():
- steering_categ = 'p2_0'
- params = gf.SteeringParams(gf.sampleTag.HESE)
- if FASTMODE:
- params.fastmode = True
- params.quiet = False
- params.simToLoad= steering_categ.lower()
- return params
-
-def set_up_as(fitter, params):
- print 'Injecting the model', params
- asimov_params = gf.FitParameters(gf.sampleTag.HESE)
- for x in params.iterkeys():
- asimov_params.__setattr__(x, float(params[x]))
- fitter.SetupAsimov(asimov_params)
-
-def setup_fitter(asimov_paramset):
- datapaths = gf.DataPaths()
- sparams = steering_params()
- npp = gf.NewPhysicsParams()
- fitter = gf.GolemFit(datapaths, sparams, npp)
- set_up_as(fitter, asimov_paramset)
- return fitter
-
-def get_llh(fitter, params):
- fitparams = gf.FitParameters(gf.sampleTag.HESE)
- for x in params.iterkeys():
- fitparams.__setattr__(x, float(params[x]))
- llh = -fitter.EvalLLH(fitparams)
- return llh
-
-asimov_paramset = {'astroFlavorAngle1': 4/9., 'astroFlavorAngle2': 0.}
-print 'injecting', asimov_paramset
-fitter = setup_fitter(asimov_paramset)
-
-test_paramset = {'astroFlavorAngle1': 0.36, 'astroFlavorAngle2': -0.57}
-print 'testing', test_paramset
-print 'llh', get_llh(fitter, test_paramset)
-
-test_paramset = {'astroFlavorAngle1': 0.385224559219, 'astroFlavorAngle2': -0.157617854374}
-print 'testing', test_paramset
-print 'llh', get_llh(fitter, test_paramset)
-
-test_paramset = {'astroFlavorAngle1': 0.415578500878, 'astroFlavorAngle2': -0.0196186993217}
-print 'testing', test_paramset
-print 'llh', get_llh(fitter, test_paramset)
-
-test_paramset = {'astroFlavorAngle1': 4/9., 'astroFlavorAngle2': 0}
-print 'testing', test_paramset
-print 'llh', get_llh(fitter, test_paramset)
-
-test_paramset = {'astroFlavorAngle1': 4/9., 'astroFlavorAngle2': 0}
-print 'testing', test_paramset
-print 'llh', get_llh(fitter, test_paramset)
-
-
-import numpy as np
-import matplotlib as mpl
-mpl.use('Agg')
-import matplotlib.pyplot as plt
-
-shape = (10, 100)
-angle1_binning = np.linspace(0, 1, shape[0])
-angle2_binning = np.linspace(-1, 1, shape[1])
-
-for an1 in angle1_binning:
- llhs = []
- for an2 in angle2_binning:
- test_paramset = {'astroFlavorAngle1': an1, 'astroFlavorAngle2': an2}
- llh = get_llh(fitter, test_paramset)
- if abs(llh) > 9e9:
- llhs.append(np.nan)
- else:
- llhs.append(llh)
- llhs = ma.masked_invalid(llhs)
- plt.plot(angle2_binning, llhs, label='astroFlavorAngle1 = {0}'.format(an1))
-plt.xlabel('astroFlavorAngle2')
-plt.ylabel('LLH')
-plt.legend()
-if FASTMODE:
- plt.savefig('llh_profile_fastmode.png'.format(an1))
-else:
- plt.savefig('llh_profile.png'.format(an1))
diff --git a/test/test_gf_freq.py b/test/test_gf_freq.py
deleted file mode 100644
index e6ca5f4..0000000
--- a/test/test_gf_freq.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import GolemFitPy as gf
-
-FASTMODE = False
-
-def steering_params():
- steering_categ = 'p2_0'
- params = gf.SteeringParams(gf.sampleTag.MagicTau)
- params.quiet = False
- if FASTMODE:
- params.fastmode = True
- else:
- params.fastmode = False
- params.simToLoad= steering_categ.lower()
- params.evalThreads = 4
- params.minFitEnergy = 6E4 # GeV
- params.maxFitEnergy = 1E7 # GeV
- params.load_data_from_text_file = False
- params.do_HESE_reshuffle=False
- params.use_legacy_selfveto_calculation = False
- return params
-
-def setup_fitter():
- datapaths = gf.DataPaths()
- sparams = steering_params()
- npp = gf.NewPhysicsParams()
- fitter = gf.GolemFit(datapaths, sparams, npp)
- return fitter
-
-def fit_flags(fitter):
- default_flags = {
- # False means it's not fixed in minimization
- 'astroFlavorAngle1' : False,
- 'astroFlavorAngle2' : False,
- 'astroNorm' : True,
- }
- flags = gf.FitParametersFlag()
- gf_nuisance = []
- for param in default_flags.keys():
- if default_flags[param]:
- flags.__setattr__(param, True)
- else:
- print 'Setting param {0:<15} to float in the ' \
- 'minimisation'.format(param)
- flags.__setattr__(param, False)
- fitter.SetFitParametersFlag(flags)
-
-def setup_asimov(fitter, params):
- print 'Injecting the model', params
- asimov_params = gf.FitParameters(gf.sampleTag.MagicTau)
- for x in params.keys():
- asimov_params.__setattr__(x, float(params[x]))
- fitter.SetupAsimov(asimov_params)
-
-def get_bf_freq(fitter):
- bf = fitter.MinLLH()
- return bf
-
-# Setup fitter
-fitter = setup_fitter()
-fit_flags(fitter)
-
-params = {'astroFlavorAngle1': 4/9., 'astroFlavorAngle2': 0.}
-print
-setup_asimov(fitter, params)
-print 'fitting...'
-bf = get_bf_freq(fitter)
-print 'bestfit params = astroFlavorAngle1:', bf.params.astroFlavorAngle1, \
- ', astroFlavorAngle2:', bf.params.astroFlavorAngle2
-print 'bestfit llh =', -bf.likelihood
-print
-
-params = {'astroFlavorAngle1': 2/6., 'astroFlavorAngle2': 1/2.}
-print
-setup_asimov(fitter, params)
-print 'fitting...'
-bf = get_bf_freq(fitter)
-print 'bestfit params = astroFlavorAngle1:', bf.params.astroFlavorAngle1, \
- ', astroFlavorAngle2:', bf.params.astroFlavorAngle2
-print 'bestfit llh =', -bf.likelihood
-print
diff --git a/test/test_gf_simple.py b/test/test_gf_simple.py
deleted file mode 100644
index daa14a4..0000000
--- a/test/test_gf_simple.py
+++ /dev/null
@@ -1,66 +0,0 @@
-import numpy as np
-import matplotlib as mpl
-mpl.use('Agg')
-import matplotlib.pyplot as plt
-
-import GolemFitPy as gf
-
-FASTMODE = False
-
-dp = gf.DataPaths()
-npp = gf.NewPhysicsParams()
-sp = gf.SteeringParams(gf.sampleTag.MagicTau)
-
-sp.quiet = False
-if FASTMODE:
- sp.fastmode = True
-# sp.frequentist = True
-sp.load_data_from_text_file = False
-
-golem = gf.GolemFit(dp, sp, npp)
-
-fp = gf.FitParameters(gf.sampleTag.MagicTau)
-fp.astroFlavorAngle1 = 4./9.
-fp.astroFlavorAngle2 = 0.
-
-# golem.SetupAsimov(fp)
-seed = 0
-golem.Swallow(golem.SpitRealization(fp, seed))
-
-fp_sh = gf.FitParameters(gf.sampleTag.MagicTau)
-# fp_sh.astroFlavorAngle1 = 0.36
-# fp_sh.astroFlavorAngle2 = -0.57
-fp_sh.astroFlavorAngle1 = 0.
-fp_sh.astroFlavorAngle2 = 1.
-
-print 'Eval fp = {0}'.format(golem.EvalLLH(fp))
-
-# energy_centers = golem.GetEnergyBinsMC()[:-1]+ np.diff(golem.GetEnergyBinsMC())/2.
-
-# plt.hist(energy_centers,bins=golem.GetEnergyBinsMC(),
-# weights=np.sum(golem.GetExpectation(fp),axis=(0,1,2,3)),
-# histtype="step", lw = 2, label='injected')
-
-# data_energy_dist = np.sum(golem.GetDataDistribution(),axis=(0,1,2,3))
-# energy_centers=golem.GetEnergyBinsData()[:-1]+ np.diff(golem.GetEnergyBinsData())/2.
-# plt.errorbar(energy_centers,data_energy_dist,yerr = np.sqrt(data_energy_dist),fmt='o')
-
-print 'Eval fp_sh = {0}'.format(golem.EvalLLH(fp_sh))
-
-# plt.hist(energy_centers,bins=golem.GetEnergyBinsMC(),
-# weights=np.sum(golem.GetExpectation(fp_sh),axis=(0,1,2,3)),
-# histtype="step", lw = 2, label='test')
-
-# data_energy_dist = np.sum(golem.GetDataDistribution(),axis=(0,1,2,3))
-# energy_centers=golem.GetEnergyBinsData()[:-1]+ np.diff(golem.GetEnergyBinsData())/2.
-# plt.errorbar(energy_centers,data_energy_dist,yerr = np.sqrt(data_energy_dist),fmt='o')
-
-# plt.loglog(nonposy="clip")
-# plt.xlabel(r"Deposited energy/GeV")
-# plt.ylabel(r"Events")
-
-# outname = 'Expectation'
-# if FASTMODE:
-# plt.savefig(outname + 'fastmode.png')
-# else:
-# plt.savefig(outname + '.png')