params = {'axes.labelsize': 6,
    'font.size': 6,
    'legend.fontsize': 7,
    'xtick.labelsize':6,
    'ytick.labelsize': 6}
plt.rcParams.update(params)

config = json.load(open(sys.argv[1]))
outpath = os.path.join(config['inpath'], 'plots')
if not os.path.exists(outpath):
    os.mkdir(outpath)

# variables for results
plt.close('all')
search_res, max_overview, sc, _ = rdl.read_paramsearch_results(config['inpath'],
                                                               p_selection=config.get('selection', {}))

if config['plot_param_space']:
    for desc in search_res:
        fig = plt.figure()
        plib.plot_search_matrix(fig, search_res[desc], config['fselection'],
                                config['method'], config.get('glomeruli', []))
        fig.savefig(os.path.join(outpath, config['method'] + '_' + desc + '.' + config['format']))

# descriptor method performance plots
fig = plt.figure(figsize=(3.35, 2))
ptype = config['descriptor_plot_type']
plib.new_descriptor_performance_plot(fig, max_overview, config['fselection'],
                                     config['method'],
                                     config.get('glomeruli', []),
                                     ptype)
    'text.usetex': False,
    'mathtext.fontset':'stixsans'}
plt.rcParams.update(params)
print plt.rcParams['mathtext.fontset']
fig = plt.figure(figsize=(2.5, 1.8))
gs = plt.GridSpec(1,2)

inpath = '/home/micha/Projects/EVA/PhyspropVsEVA/data/nusvr_micha'
method = 'svr'
selection = 'linear'
example_desc = 'all'
example_gloms = ['Or43b', 'Or67c']

data_path = os.path.join(os.path.dirname(__file__), '..', 'data')
used_glomeruli = json.load(open(os.path.join(data_path, 'all_glomeruli.json')))
search_res, max_overview, sc, k_best_dict = rdl.read_paramsearch_results(inpath)

out_res = {}
for i, descriptor in enumerate(search_res):

    res = json.load(open(os.path.join(inpath, descriptor + '.json')))

    # param selection values to compare against
    if method == 'forest':
        c_k_best = -1
        c_reg_idx = -1
    else:
        c_k_best = -1              # all features
        c_regularization = 1.0
        c_reg_idx = sc[method].index(c_regularization)      # regularization 1.0