def export_growth(data, year, A, B): if not is_there_a_strong_tie_method_B(data, year, A, B, strong_tie_def_args(config.STRONG_TIES_LOWER_BOUND, config.STRONG_TIES_UPPER_BOUND)): return CANT_ESTABLISH_TREND actual_export_percentage = data.export_data_as_percentage(year, A, B, True) if actual_export_percentage is None: return CANT_ESTABLISH_TREND (slope, lower_limit, upper_limit) = data.bollinger_band_range(year - args['sliding_window_size'] - 1, year - 1, A, B) if lower_limit is None or upper_limit is None: return CANT_ESTABLISH_TREND elif actual_export_percentage < lower_limit: return DECELERATING elif actual_export_percentage > upper_limit: return ACCELERATING else: return STEADY_RISING if slope > 0 else STEADY_FALLING
def write_out_graph_data_for_traids_vs_degree_plot(data): for year in data.all_years: matrix_for_a_year = strongties.get_relationship_matrix(data, year, is_there_a_strong_tie_method_B, strong_tie_def_args(config.STRONG_TIES_LOWER_BOUND, config.STRONG_TIES_UPPER_BOUND)) csv_write(config.graph_data_file_name(year), strongties.graph_data(matrix_for_a_year))