From 8d560bf7d1bb78ebf31f23581c51d9a3ac7204c2 Mon Sep 17 00:00:00 2001 From: shivesh Date: Mon, 15 Apr 2019 17:48:46 +0100 Subject: fig2 refactor --- contour.py | 4 +++- fig2.py | 19 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/contour.py b/contour.py index 713bb22..ed566b3 100755 --- a/contour.py +++ b/contour.py @@ -195,7 +195,9 @@ def main(): asimov_paramset, hypo_paramset = get_paramsets(args, define_nuisance()) hypo_paramset.extend(asimov_paramset.from_tag(ParamTag.BESTFIT)) - outfile = args.datadir + '/contour' + gen_identifier(args) + + prefix = '' + outfile = args.datadir + '/contour' + prefix + gen_identifier(args) print '== {0:<25} = {1}'.format('outfile', outfile) print 'asimov_paramset', asimov_paramset diff --git a/fig2.py b/fig2.py index a284e9d..5c071f9 100755 --- a/fig2.py +++ b/fig2.py @@ -67,10 +67,6 @@ def parse_args(args=None): '--datadir', type=str, help='Path to directory containing MultiNest runs' ) - parser.add_argument( - '--outfile', type=str, default='./untitled', - help='Output path' - ) if args is None: return parser.parse_args() else: return parser.parse_args(args.split()) @@ -82,13 +78,13 @@ def main(): paramset = get_paramsets(args, define_nuisance()) n_params = len(paramset) - print n_params + print 'n_params', n_params - chains = np.load('/data/user/smandalia/flavour_ratio/data/contour/contour_REAL.npy') - # chains = np.load('/data/user/smandalia/flavour_ratio/data/contour_emcee/golemfit/real/more_sys_flat/_GOLEMFIT_REAL_emcee_.npy') + prefix = '' + contour_infile = args.datadir + '/contour' + prefix + '_REAL.npy' + contour_chains = np.load(contour_infile) - print chains - flavour_angles = chains[:,-2:] + flavour_angles = contour_chains[:,-2:] flavour_ratios = np.array( map(fr_utils.angles_to_fr, flavour_angles) ) @@ -130,7 +126,10 @@ def main(): ax.legend() - fig.savefig('test_emcee_moresys_flat.png', bbox_inches='tight', dpi=150) + outfile = args.datadir[:5]+args.datadir[5:].replace('data', 'plots') + outfile += '/fig2' + prefix + '.png' + print 'Saving plot as {0}'.format(outfile) + fig.savefig(outfile, bbox_inches='tight', dpi=150) print "DONE!" -- cgit v1.2.3