def get_good_study(data_list, sig = True): """Return a list of studies that pass the criteria check""" study_list_data = sorted(list(set(data_list['study']))) good_study_list = [] for study in study_list_data: data_study = data_list[data_list['study'] == study] if tl.inclusion_criteria(data_study, sig = sig): good_study_list.append(study) return good_study_list
import matplotlib.pyplot as plt import TL_functions as tl import numpy as np from scipy import stats import random # Figure 1 - visual representation using three studies study_list = ['1_1', '10_1', '52_11'] fig = plt.figure(figsize = (10.5, 7)) iplot = 1 for feas_type in ['partition', 'composition']: 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 = [], [], []
"""Print the summary for Results""" 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])
from __future__ import division import TL_functions as tl import multiprocessing def get_good_study(data_list, sig = True): """Return a list of studies that pass the criteria check""" study_list_data = sorted(list(set(data_list['study']))) good_study_list = [] for study in study_list_data: data_study = data_list[data_list['study'] == study] if tl.inclusion_criteria(data_study, sig = sig): good_study_list.append(study) return good_study_list data_lit = tl.get_QN_mean_var_data('data_literature.txt') data_glenda = tl.get_QN_mean_var_data('data_Glenda.txt') good_list_lit = get_good_study(data_lit, sig = False) good_list_glenda = get_good_study(data_glenda) def map_lit_partition(study): tl.TL_analysis(data_lit, study) def map_lit_composition(study): tl.TL_analysis(data_lit, study, analysis = 'composition') def map_glenda_partition(study): tl.TL_analysis(data_glenda, study) def map_glenda_composition(study): tl.TL_analysis(data_glenda, study, analysis = 'composition')