for study in study_list: ax = plt.subplot(2, 3, iplot) if iplot == 1 or iplot == 4: legend = True else: legend = False tl.plot_emp_vs_sim(study, feas_type = feas_type, ax = ax, legend = legend) iplot += 1 plt.subplots_adjust(wspace = 0.29, hspace = 0.29) plt.savefig('Fig1.pdf', dpi = 600) # Figure 2 - compare the full distribution of empirical TLs and those from the feasible sets study_info = tl.get_study_info('study_taxon_type.txt') tl_pars_par = tl.get_tl_par_file('out_files/TL_form_partition.txt') var_par = tl.get_var_sample_file('out_files/taylor_QN_var_predicted_partition_1000_full.txt') var_comp = tl.get_var_sample_file('out_files/taylor_QN_var_predicted_composition_1000_full.txt') par_quad = tl.get_val_ind_sample_file('out_files/TL_quad_p_partition.txt') comp_quad = tl.get_val_ind_sample_file('out_files/TL_quad_p_composition.txt') b_obs, b_par, b_comp, b_type = [], [], [], [] p_obs, p_par, p_comp = [], [], [] pcurv_obs, pcurv_par, pcurv_comp = [], [], [] r2_obs, r2_par, r2_comp = [], [], [] for study in np.unique(var_par['study']): b_obs.append((tl_pars_par['b_obs'][tl_pars_par['study'] == study])[0]) p_obs.append((tl_pars_par['p_obs'][tl_pars_par['study'] == study])[0]) r2_obs.append((tl_pars_par['R2_obs'][tl_pars_par['study'] == study])[0]) pcurv_obs.append((par_quad['emp_val'][par_quad['study'] == study])[0]) b_type.append((study_info['type'][study_info['study'] == study])[0]) sample_par = var_par[var_par['study'] == study] sample_comp = var_comp[var_comp['study'] == study]
from __future__ import division import TL_functions as tl import numpy as np from scipy import stats study_info = tl.get_study_info('study_taxon_type.txt') tl_pars_par = tl.get_tl_par_file('TL_form_partition.txt') tl_pars_comp = tl.get_tl_par_file('TL_form_composition.txt') var_par = tl.get_var_sample_file('taylor_QN_var_predicted_partition_1000_full.txt') var_comp = tl.get_var_sample_file('taylor_QN_var_predicted_composition_1000_full.txt') study_spatial = [study for study in np.unique(var_par['study']) if study_info['type'] [study_info['study'] == study]== 'spatial'] study_temporal = [study for study in np.unique(var_par['study']) if study_info['type'][study_info['study'] == study] == 'temporal'] # 1. Curvature par_quad = tl.get_val_ind_sample_file('TL_quad_p_partition.txt') comp_quad = tl.get_val_ind_sample_file('TL_quad_p_composition.txt') sig_spatial, sig_temporal, sig_par, sig_comp, tot_sig = 0, 0, 0, 0, 0 for study in study_spatial: row_study_par = list(par_quad[par_quad['study'] == study][0]) row_study_comp = list(comp_quad[comp_quad['study'] == study][0]) if row_study_par[1] < 0.05: sig_spatial += 1 sig_par += len([x for x in row_study_par[2:] if x < 0.05]) sig_comp += len([x for x in row_study_comp[2:] if x < 0.05]) tot_sig += len(row_study_comp[2:]) for study in study_temporal: row_study_par = list(par_quad[par_quad['study'] == study][0]) row_study_comp = list(comp_quad[comp_quad['study'] == study][0]) if row_study_par[1] < 0.05: sig_temporal += 1