diff options
Diffstat (limited to 'golemflavor')
| -rw-r--r-- | golemflavor/fr.py | 18 | ||||
| -rw-r--r-- | golemflavor/gf.py | 14 | ||||
| -rw-r--r-- | golemflavor/llh.py | 2 | ||||
| -rw-r--r-- | golemflavor/mcmc.py | 20 | ||||
| -rw-r--r-- | golemflavor/misc.py | 2 | ||||
| -rw-r--r-- | golemflavor/mn.py | 2 | ||||
| -rw-r--r-- | golemflavor/param.py | 2 | ||||
| -rw-r--r-- | golemflavor/plot.py | 26 |
8 files changed, 43 insertions, 43 deletions
diff --git a/golemflavor/fr.py b/golemflavor/fr.py index ba9a8e9..6692609 100644 --- a/golemflavor/fr.py +++ b/golemflavor/fr.py @@ -66,11 +66,11 @@ def determinant(x): Examples ---------- - >>> print determinant( + >>> print(determinant( >>> [[-1.65238188-0.59549718j, 0.27486548-0.18437467j, -1.35524534-0.38542072j], >>> [-1.07480906+0.29630449j, -0.47808456-0.80316821j, -0.88609356-1.50737308j], >>> [-0.14924144-0.99230446j, 0.49504234+0.63639805j, 2.29258915-0.36537507j]] - >>> ) + >>> )) (2.7797571563274688+3.0841795325804848j) """ @@ -94,7 +94,7 @@ def angles_to_fr(src_angles): Examples ---------- - >>> print angles_to_fr((0.3, 0.4)) + >>> print(angles_to_fr((0.3, 0.4))) (0.38340579025361626, 0.16431676725154978, 0.45227744249483393) """ @@ -129,7 +129,7 @@ def angles_to_u(bsm_angles): Examples ---------- >>> from fr import angles_to_u - >>> print angles_to_u((0.2, 0.3, 0.5, 1.5)) + >>> print(angles_to_u((0.2, 0.3, 0.5, 1.5))) array([[ 0.66195018+0.j , 0.33097509+0.j , 0.04757188-0.6708311j ], [-0.34631487-0.42427084j, 0.61741198-0.21213542j, 0.52331757+0.j ], [ 0.28614067-0.42427084j, -0.64749908-0.21213542j, 0.52331757+0.j ]]) @@ -184,7 +184,7 @@ def cardano_eqn(ham): >>> [-0.34631487-0.42427084j, 0.61741198-0.21213542j, 0.52331757+0.j ], >>> [ 0.28614067-0.42427084j, -0.64749908-0.21213542j, 0.52331757+0.j ]] >>> ) - >>> print cardano_eqn(ham) + >>> print(cardano_eqn(ham)) array([[-0.11143379-0.58863683j, -0.09067747-0.48219068j, 0.34276625-0.08686465j], [ 0.14835519+0.47511473j, -0.18299305+0.40777481j, 0.31906300+0.82514223j], [-0.62298966+0.07231745j, -0.61407815-0.42709603j, 0.03660313+0.30160428j]]) @@ -247,7 +247,7 @@ def normalise_fr(fr): Examples ---------- >>> from fr import normalise_fr - >>> print normalise_fr((1, 2, 3)) + >>> print(normalise_fr((1, 2, 3))) array([ 0.16666667, 0.33333333, 0.5 ]) """ @@ -347,7 +347,7 @@ def params_to_BSMu(bsm_angles, dim, energy, mass_eigenvalues=MASS_EIGENVALUES, Examples ---------- >>> from fr import params_to_BSMu - >>> print params_to_BSMu((0.2, 0.3, 0.5, 1.5, -20), dim=3, energy=1000) + >>> print(params_to_BSMu((0.2, 0.3, 0.5, 1.5, -20), dim=3, energy=1000)) array([[ 0.18658169 -6.34190523e-01j, -0.26460391 +2.01884200e-01j, 0.67247096 -9.86808417e-07j], [-0.50419832 +2.14420570e-01j, -0.36013768 +5.44254868e-01j, 0.03700961 +5.22039894e-01j], [-0.32561308 -3.95946524e-01j, 0.64294909 -2.23453580e-01j, 0.03700830 +5.22032403e-01j]]) @@ -475,7 +475,7 @@ def test_unitarity(x, prnt=False, rse=False, epsilon=None): ---------- >>> from fr import test_unitarity >>> x = np.identity(3) - >>> print test_unitarity(x) + >>> print(test_unitarity(x)) array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) @@ -512,7 +512,7 @@ def u_to_fr(source_fr, matrix): Examples ---------- >>> from fr import params_to_BSMu, u_to_fr - >>> print u_to_fr((1, 2, 0), params_to_BSMu((0.2, 0.3, 0.5, 1.5, -20), 3, 1000)) + >>> print(u_to_fr((1, 2, 0), params_to_BSMu((0.2, 0.3, 0.5, 1.5, -20), 3, 1000))) array([ 0.33740075, 0.33176584, 0.33083341]) """ diff --git a/golemflavor/gf.py b/golemflavor/gf.py index fbabd49..252e706 100644 --- a/golemflavor/gf.py +++ b/golemflavor/gf.py @@ -16,7 +16,7 @@ import numpy as np try: import GolemFitPy as gf except: - print 'Running without GolemFit' + print('Running without GolemFit') pass from golemflavor.enums import DataType, Likelihood, SteeringCateg @@ -53,8 +53,8 @@ def fit_flags(llh_paramset): gf_nuisance = [] for param in llh_paramset: if param.name in default_flags: - print 'Setting param {0:<15} to float in the ' \ - 'minimisation'.format(param.name) + print('Setting param {0:<15} to float in the ' \ + 'minimisation'.format(param.name)) flags.__setattr__(param.name, False) gf_nuisance.append(param) return flags, ParamSet(gf_nuisance) @@ -85,7 +85,7 @@ def steering_params(args): def setup_asimov(params): - print 'Injecting the model', params + print('Injecting the model', params) asimov_params = gf.FitParameters(gf.sampleTag.MagicTau) for parm in params: asimov_params.__setattr__(parm.name, float(parm.value)) @@ -93,7 +93,7 @@ def setup_asimov(params): def setup_realisation(params, seed): - print 'Injecting the model', params + print('Injecting the model', params) asimov_params = gf.FitParameters(gf.sampleTag.MagicTau) for parm in params: asimov_params.__setattr__(parm.name, float(parm.value)) @@ -112,7 +112,7 @@ def setup_fitter(args, asimov_paramset): seed = args.seed if args.seed is not None else 1 setup_realisation(FITTER, asimov_paramset, seed) elif args.data is DataType.REAL: - print 'Using MagicTau DATA' + print('Using MagicTau DATA') def get_llh(params): @@ -124,7 +124,7 @@ def get_llh(params): def get_llh_freq(params): - print 'setting to {0}'.format(params) + print('setting to {0}'.format(params)) fitparams = gf.FitParameters(gf.sampleTag.MagicTau) for parm in params: fitparams.__setattr__(parm.name, float(parm.value)) diff --git a/golemflavor/llh.py b/golemflavor/llh.py index 93ae3bd..aa5d32d 100644 --- a/golemflavor/llh.py +++ b/golemflavor/llh.py @@ -88,7 +88,7 @@ def triangle_llh(theta, args, asimov_paramset, llh_paramset): 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) + # print('flavour_angles', map(float, flavour_angles)) for idx, param in enumerate(hypo_paramset.from_tag(ParamTag.BESTFIT)): param.value = flavour_angles[idx] diff --git a/golemflavor/mcmc.py b/golemflavor/mcmc.py index 606da2d..4cad6e7 100644 --- a/golemflavor/mcmc.py +++ b/golemflavor/mcmc.py @@ -26,26 +26,26 @@ def mcmc(p0, ln_prob, ndim, nwalkers, burnin, nsteps, args, threads=1): nwalkers, ndim, ln_prob, threads=threads ) - print "Running burn-in" + print("Running burn-in") for result in tqdm.tqdm(sampler.sample(p0, iterations=burnin), total=burnin): pos, prob, state = result sampler.reset() - print "Finished burn-in" + print("Finished burn-in") args.burnin = False - print "Running" + print("Running") for _ in tqdm.tqdm(sampler.sample(pos, iterations=nsteps), total=nsteps): pass - print "Finished" + print("Finished") samples = sampler.chain.reshape((-1, ndim)) - print 'acceptance fraction', sampler.acceptance_fraction - print 'sum of acceptance fraction', np.sum(sampler.acceptance_fraction) - print 'np.unique(samples[:,0]).shape', np.unique(samples[:,0]).shape + print('acceptance fraction', sampler.acceptance_fraction) + print('sum of acceptance fraction', np.sum(sampler.acceptance_fraction)) + print('np.unique(samples[:,0]).shape', np.unique(samples[:,0]).shape) try: - print 'autocorrelation', sampler.acor + print('autocorrelation', sampler.acor) except: - print 'WARNING : NEED TO RUN MORE SAMPLES' + print('WARNING : NEED TO RUN MORE SAMPLES') return samples @@ -115,6 +115,6 @@ def save_chains(chains, outfile): """ make_dir(outfile) - print 'Saving chains to location {0}'.format(outfile+'.npy') + print('Saving chains to location {0}'.format(outfile+'.npy')) np.save(outfile+'.npy', chains) diff --git a/golemflavor/misc.py b/golemflavor/misc.py index 4974775..d83bb99 100644 --- a/golemflavor/misc.py +++ b/golemflavor/misc.py @@ -77,7 +77,7 @@ def parse_bool(s): Examples ---------- >>> from misc import parse_bool - >>> print parse_bool('true') + >>> print(parse_bool('true')) True """ diff --git a/golemflavor/mn.py b/golemflavor/mn.py index e8ff3b4..1e6c9fc 100644 --- a/golemflavor/mn.py +++ b/golemflavor/mn.py @@ -85,7 +85,7 @@ def mn_evidence(mn_paramset, llh_paramset, asimov_paramset, args, prefix='mn'): if args.run_mn: make_dir(prefix) - print 'Running evidence calculation for {0}'.format(prefix) + print('Running evidence calculation for {0}'.format(prefix)) run( LogLikelihood = lnProbEval, Prior = CubePrior, diff --git a/golemflavor/param.py b/golemflavor/param.py index 076386f..941f265 100644 --- a/golemflavor/param.py +++ b/golemflavor/param.py @@ -7,7 +7,7 @@ Param class and functions for the BSM flavour ratio analysis """ -from __future__ import absolute_import, division, print_function +from __future__ import absolute_import, division import sys diff --git a/golemflavor/plot.py b/golemflavor/plot.py index 2fc3210..caaed47 100644 --- a/golemflavor/plot.py +++ b/golemflavor/plot.py @@ -157,10 +157,10 @@ def get_limit(scales, statistic, args, mask_initial=False, return_interp=False): min_idx = np.argmin(scales) null = statistic[min_idx] # if np.abs(statistic_rm[0] - null) > 0.8: - # print 'Warning, null incompatible with smallest scanned scale! For ' \ + # print('Warning, null incompatible with smallest scanned scale! For ' \ # 'DIM {0} [{1}, {2}, {3}]!'.format( # args.dimension, *args.source_ratio - # ) + # )) # null = statistic_rm[0] if args.stat_method is StatCateg.BAYESIAN: reduced_ev = -(statistic_rm - null) @@ -175,16 +175,16 @@ def get_limit(scales, statistic, args, mask_initial=False, return_interp=False): return None re = -(statistic-null)[scales > al[0]] if np.sum(re < np.log(10**(BAYES_K)) - 0.1) >= 2: - print 'Warning, peaked contour does not exclude large scales! For ' \ + print('Warning, peaked contour does not exclude large scales! For ' \ 'DIM {0} [{1}, {2}, {3}]!'.format( args.dimension, *args.source_ratio - ) + )) return None if np.sum(re >= np.log(10**(BAYES_K)) + 0.0) < 2: - print 'Warning, only single point above threshold! For ' \ + print('Warning, only single point above threshold! For ' \ 'DIM {0} [{1}, {2}, {3}]!'.format( args.dimension, *args.source_ratio - ) + )) return None if return_interp: @@ -193,7 +193,7 @@ def get_limit(scales, statistic, args, mask_initial=False, return_interp=False): # Divide by 2 to convert to standard SME coefficient lim = al[0] - np.log10(2.) # lim = al[0] - print 'limit = {0}'.format(lim) + print('limit = {0}'.format(lim)) return lim @@ -323,7 +323,7 @@ def alpha_shape(points, alpha): area = np.sqrt(s*(s-a)*(s-b)*(s-c)) circum_r = a*b*c/(4.0*area) # Here's the radius filter. - #print circum_r + #print(circum_r) if circum_r < 1.0/alpha: add_edge(edges, edge_points, coords, ia, ib) add_edge(edges, edge_points, coords, ib, ic) @@ -562,9 +562,9 @@ def plot_statistic(data, outfile, outformat, args, scale_param, label=None): fig_text = gen_figtext(args) if label is not None: fig_text += '\n' + label - print 'data', data - print 'data.shape', data.shape - print 'outfile', outfile + print('data', data) + print('data.shape', data.shape) + print('outfile', outfile) try: scales, statistic = ma.compress_rows(data).T lim = get_limit(deepcopy(scales), deepcopy(statistic), args, mask_initial=True) @@ -620,7 +620,7 @@ def plot_statistic(data, outfile, outformat, args, scale_param, label=None): def plot_table_sens(data, outfile, outformat, args, show_lvatmo=True): - print 'Making TABLE sensitivity plot' + print('Making TABLE sensitivity plot') argsc = deepcopy(args) dims = args.dimensions @@ -648,7 +648,7 @@ def plot_table_sens(data, outfile, outformat, args, show_lvatmo=True): legend_elements = [] for idim, dim in enumerate(dims): - print '|||| DIM = {0}'.format(dim) + print('|||| DIM = {0}'.format(dim)) argsc.dimension = dim gs0 = gridspec.GridSpecFromSubplotSpec( len(textures), 1, subplot_spec=gs[idim], hspace=0 |
