def crossCorrelateValuesForPlotting(data1, data2, countryIndex, yearOffset): # pprint.pprint(data2[countryIndex]) d1, d2, years = RADS.yearCorrelate(data1[countryIndex], data2[countryIndex], yearOffset=yearOffset) d1 = np.array(d1) d2 = np.array(d2) if (len(d1) > 1) and (len(d2) > 1): return d1, d2 else: # print 'Country ', countryIndex, ' has no data for given indicator.' return d1, d2
#'Tanzania', #'Togo', 'Uganda', 'Zambia', 'Zimbabwe'] def generate_list_of_Countries(data_list): countryList = [] for data in data_list: countryList.append( data[0] ) return countryList dependent = RADS.ourCountries(dependent, country_list) independent = RADS.ourCountries(independent, country_list) ## Re-order the countries in the dependent caraible to the order of the independent variable: dependent_new=[] for country_set in independent: country = country_set[0] for country_set_dependent in dependent: if country_set_dependent[0] == country: dependent_new.append(country_set_dependent) dependent = dependent_new ## Get a list of countries present in each data set: dependent_country_list = generate_list_of_Countries(dependent) independent_country_list = generate_list_of_Countries(independent)
little_plots = True # :Plot the little plots of the scatter data with different time offsets axies_scale = "linear" # :Plot nad compute the values with log/log axies. Options include: 'log_log' variable_name_plot_dependent = "Improved Water Source (% access)" #'Improved Sanitation Facilities (% access)'# variable_name_plot_independent = "% Gross Female Secondary School Enrollment" # [(Country, indicator, [values],[years]), (Country, indicator, [values],[years]),...] dependent = pickle.load(open(data_values[variable_name_plot_dependent], "rb")) independent = pickle.load(open(data_values[variable_name_plot_independent], "rb")) country_list = RADCL.countryList() dependent = RADS.ourCountries(dependent, country_list) independent = RADS.ourCountries(independent, country_list) def crossCorrelateValuesForPlotting(data1, data2, countryIndex, yearOffset): # pprint.pprint(data2[countryIndex]) d1, d2, years = RADS.yearCorrelate(data1[countryIndex], data2[countryIndex], yearOffset=yearOffset) d1 = np.array(d1) d2 = np.array(d2) if (len(d1) > 1) and (len(d2) > 1): return d1, d2 else: # print 'Country ', countryIndex, ' has no data for given indicator.' return d1, d2