From e1fa7270eeb9219865446cb8ceb4a5762f6aab9b Mon Sep 17 00:00:00 2001 From: shivesh Date: Mon, 9 Apr 2018 18:39:55 -0500 Subject: add CR values on the plot --- fr.py | 2 +- submitter/make_dag.py | 17 ++++++++++------- utils/plot.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/fr.py b/fr.py index 918f13e..f6d35de 100755 --- a/fr.py +++ b/fr.py @@ -157,7 +157,7 @@ def parse_args(): help='Spectral index for spectral energy dependance' ) parser.add_argument( - '--binning', default=[1e4, 1e7, 10], type=int, nargs=3, + '--binning', default=[1e4, 1e7, 10], type=float, nargs=3, help='Binning for spectral energy dependance' ) parser.add_argument( diff --git a/submitter/make_dag.py b/submitter/make_dag.py index 80bd751..133819b 100644 --- a/submitter/make_dag.py +++ b/submitter/make_dag.py @@ -18,15 +18,15 @@ full_scan_mfr = [ fix_sfr_mfr = [ (1, 1, 1, 1, 0, 0), (1, 1, 1, 0, 1, 0), - # (1, 1, 1, 0, 0, 1), + (1, 1, 1, 0, 0, 1), (1, 1, 1, 1, 2, 0), - # (1, 1, 0, 0, 1, 0), + (1, 1, 0, 0, 1, 0), (1, 1, 0, 1, 2, 0), - # (1, 1, 0, 1, 0, 0), - # (1, 0, 0, 1, 0, 0), + (1, 1, 0, 1, 0, 0), + (1, 0, 0, 1, 0, 0), (0, 1, 0, 0, 1, 0), - # (1, 2, 0, 0, 1, 0), - # (1, 2, 0, 1, 2, 0) + (1, 2, 0, 0, 1, 0), + (1, 2, 0, 1, 2, 0) ] # MCMC @@ -79,7 +79,10 @@ with open(outfile, 'w') as f: for en in energy: print 'energy {0:.0E}'.format(en) - outchain_head = '/data/user/smandalia/flavour_ratio/data/{0}/DIM{1}/{2:.0E}'.format(likelihood, dim, en) + if energy_dependance == 'mono': + outchain_head = '/data/user/smandalia/flavour_ratio/data/{0}/DIM{1}/{2:.0E}'.format(likelihood, dim, en) + elif energy_dependance == 'spectral': + outchain_head = '/data/user/smandalia/flavour_ratio/data/{0}/DIM{1}/SI_{2}'.format(likelihood, dim, spectral_index) for sig in sigma_ratio: print 'sigma', sig diff --git a/utils/plot.py b/utils/plot.py index af713eb..d395342 100644 --- a/utils/plot.py +++ b/utils/plot.py @@ -28,11 +28,20 @@ rc('text', usetex=False) rc('font', **{'family':'serif', 'serif':['Computer Modern'], 'size':18}) +def centers(x): + return (x[:-1]+x[1:])*0.5 + + def calc_nbins(x): n = (np.max(x) - np.min(x)) / (2 * len(x)**(-1./3) * (np.percentile(x, 75) - np.percentile(x, 25))) return np.floor(n) +def calc_bins(x): + nbins = calc_nbins(x) + return np.linspace(np.min(x), np.max(x)+2, num=nbins+1) + + def most_likely(arr): """Return the densest region given a 1D array of data.""" binning = calc_bins(arr) @@ -169,6 +178,25 @@ def chainer_plot(infile, outfile, outformat, args, mcmc_paramset): mpl.pyplot.figtext(0.4, 0.7, fig_text, fontsize=4) else: mpl.pyplot.figtext(0.5, 0.7, fig_text, fontsize=15) + + for i_ax_1, ax_1 in enumerate(g.subplots): + for i_ax_2, ax_2 in enumerate(ax_1): + if i_ax_1 == i_ax_2: + itv = interval(Tchain[:,i_ax_1], percentile=90.) + for l in itv: + ax_2.axvline(l, color='gray', ls='--') + ax_2.set_title(r'${0:.2f}_{{-{1:.2f}}}^{{+{2:.2f}}}$'.format( + itv[1], itv[0], itv[2] + ), fontsize=10) + + # if not args.fix_mixing: + # sc_index = mcmc_paramset.from_tag(ParamTag.SCALE, index=True) + # itv = interval(Tchain[:,sc_index], percentile=90.) + # mpl.pyplot.figtext( + # 0.5, 0.3, 'Scale 90% Interval = [1E{0}, 1E{1}], Center = ' + # '1E{2}'.format(itv[0], itv[2], itv[1]) + # ) + for of in outformat: g.export(outfile+'_angles.'+of) -- cgit v1.2.3