def generate_fig(main): def data_received(tokens_freq_files, tokens_stats_files): if tokens_freq_files: measure_dispersion = settings['generation_settings']['measure_dispersion'] measure_adjusted_freq = settings['generation_settings']['measure_adjusted_freq'] col_dispersion = main.settings_global['measures_dispersion'][measure_dispersion]['col'] col_adjusted_freq = main.settings_global['measures_adjusted_freq'][measure_adjusted_freq]['col'] if settings['fig_settings']['use_data'] == main.tr('Frequency'): wordless_fig_freq.wordless_fig_freq(main, tokens_freq_files, settings = settings['fig_settings'], label_x = main.tr('Tokens')) else: if settings['fig_settings']['use_data'] == col_dispersion: tokens_stat_files = {token: numpy.array(stats_files)[:, 0] for token, stats_files in tokens_stats_files.items()} label_y = col_dispersion elif settings['fig_settings']['use_data'] == col_adjusted_freq: tokens_stat_files = {token: numpy.array(stats_files)[:, 1] for token, stats_files in tokens_stats_files.items()} label_y = col_adjusted_freq wordless_fig_stat.wordless_fig_stat(main, tokens_stat_files, settings = settings['fig_settings'], label_x = main.tr('Tokens'), label_y = label_y) wordless_msg.wordless_msg_generate_fig_success(main) else: wordless_msg_box.wordless_msg_box_no_results(main) wordless_msg.wordless_msg_generate_fig_error(main) dialog_progress.accept() if tokens_freq_files: wordless_fig.show_fig() settings = main.settings_custom['wordlist'] files = main.wordless_files.get_selected_files() if wordless_checking_file.check_files_on_loading(main, files): dialog_progress = wordless_dialog_misc.Wordless_Dialog_Progress_Process_Data(main) worker_process_data = Wordless_Worker_Process_Data_Wordlist_Fig(main, dialog_progress, data_received) thread_process_data = wordless_threading.Wordless_Thread_Process_Data(worker_process_data) thread_process_data.start() dialog_progress.exec_() thread_process_data.quit() thread_process_data.wait() else: wordless_msg.wordless_msg_generate_fig_error(main)
def data_received(keywords_freq_files, keywords_stats_files): if keywords_freq_files: text_test_significance = settings['generation_settings']['test_significance'] text_measure_effect_size = settings['generation_settings']['measure_effect_size'] (text_test_stat, text_p_value, text_bayes_factor) = main.settings_global['tests_significance']['keywords'][text_test_significance]['cols'] text_effect_size = main.settings_global['measures_effect_size']['keywords'][text_measure_effect_size]['col'] if settings['fig_settings']['use_data'] == main.tr('Frequency'): wordless_fig_freq.wordless_fig_freq_ref(main, keywords_freq_files, ref_file = ref_file, settings = settings['fig_settings'], label_x = main.tr('Keywords')) else: if settings['fig_settings']['use_data'] == text_test_stat: keywords_stat_files = {keyword: numpy.array(stats_files)[:, 0] for keyword, stats_files in keywords_stats_files.items()} label_y = text_test_stat elif settings['fig_settings']['use_data'] == text_p_value: keywords_stat_files = {keyword: numpy.array(stats_files)[:, 1] for keyword, stats_files in keywords_stats_files.items()} label_y = text_p_value elif settings['fig_settings']['use_data'] == text_bayes_factor: keywords_stat_files = {keyword: numpy.array(stats_files)[:, 2] for keyword, stats_files in keywords_stats_files.items()} label_y = text_bayes_factor elif settings['fig_settings']['use_data'] == text_effect_size: keywords_stat_files = {keyword: numpy.array(stats_files)[:, 3] for keyword, stats_files in keywords_stats_files.items()} label_y = text_effect_size wordless_fig_stat.wordless_fig_stat_ref(main, keywords_stat_files, ref_file = ref_file, settings = settings['fig_settings'], label_y = label_y) wordless_msg.wordless_msg_generate_fig_success(main) else: wordless_msg_box.wordless_msg_box_no_results(main) wordless_msg.wordless_msg_generate_fig_error(main) dialog_progress.accept() if keywords_freq_files: wordless_fig.show_fig()
def data_received(tokens_freq_files, tokens_stats_files): if tokens_freq_files: measure_dispersion = settings['generation_settings'][ 'measure_dispersion'] measure_adjusted_freq = settings['generation_settings'][ 'measure_adjusted_freq'] col_dispersion = main.settings_global['measures_dispersion'][ measure_dispersion]['col'] col_adjusted_freq = main.settings_global['measures_adjusted_freq'][ measure_adjusted_freq]['col'] if settings['fig_settings']['use_data'] == main.tr('Frequency'): wordless_fig_freq.wordless_fig_freq( main, tokens_freq_files, settings=settings['fig_settings'], label_x=main.tr('Tokens')) else: if settings['fig_settings']['use_data'] == col_dispersion: tokens_stat_files = { token: numpy.array(stats_files)[:, 0] for token, stats_files in tokens_stats_files.items() } label_y = col_dispersion elif settings['fig_settings']['use_data'] == col_adjusted_freq: tokens_stat_files = { token: numpy.array(stats_files)[:, 1] for token, stats_files in tokens_stats_files.items() } label_y = col_adjusted_freq wordless_fig_stat.wordless_fig_stat( main, tokens_stat_files, settings=settings['fig_settings'], label_x=main.tr('Tokens'), label_y=label_y) wordless_msg.wordless_msg_generate_fig_success(main) else: wordless_msg_box.wordless_msg_box_no_results(main) wordless_msg.wordless_msg_generate_fig_error(main) dialog_progress.accept() if tokens_freq_files: wordless_fig.show_fig()
def generate_fig(main): def data_received(keywords_freq_files, keywords_stats_files): if keywords_freq_files: text_test_significance = settings['generation_settings'][ 'test_significance'] text_measure_effect_size = settings['generation_settings'][ 'measure_effect_size'] (text_test_stat, text_p_value, text_bayes_factor) = main.settings_global['tests_significance'][ 'keywords'][text_test_significance]['cols'] text_effect_size = main.settings_global['measures_effect_size'][ 'keywords'][text_measure_effect_size]['col'] if settings['fig_settings']['use_data'] == main.tr('Frequency'): wordless_fig_freq.wordless_fig_freq_ref( main, keywords_freq_files, ref_file=ref_file, settings=settings['fig_settings'], label_x=main.tr('Keywords')) else: if settings['fig_settings']['use_data'] == text_test_stat: keywords_stat_files = { keyword: numpy.array(stats_files)[:, 0] for keyword, stats_files in keywords_stats_files.items() } label_y = text_test_stat elif settings['fig_settings']['use_data'] == text_p_value: keywords_stat_files = { keyword: numpy.array(stats_files)[:, 1] for keyword, stats_files in keywords_stats_files.items() } label_y = text_p_value elif settings['fig_settings']['use_data'] == text_bayes_factor: keywords_stat_files = { keyword: numpy.array(stats_files)[:, 2] for keyword, stats_files in keywords_stats_files.items() } label_y = text_bayes_factor elif settings['fig_settings']['use_data'] == text_effect_size: keywords_stat_files = { keyword: numpy.array(stats_files)[:, 3] for keyword, stats_files in keywords_stats_files.items() } label_y = text_effect_size wordless_fig_stat.wordless_fig_stat_ref( main, keywords_stat_files, ref_file=ref_file, settings=settings['fig_settings'], label_y=label_y) wordless_msg.wordless_msg_generate_fig_success(main) else: wordless_msg_box.wordless_msg_box_no_results(main) wordless_msg.wordless_msg_generate_fig_error(main) dialog_progress.accept() if keywords_freq_files: wordless_fig.show_fig() settings = main.settings_custom['keywords'] files = main.wordless_files.get_selected_files() if wordless_checking_file.check_files_on_loading(main, files): ref_file = main.wordless_files.find_file_by_name( settings['generation_settings']['ref_file'], selected_only=True) files = [ file for file in main.wordless_files.get_selected_files() if file != ref_file ] if files: dialog_progress = wordless_dialog_misc.Wordless_Dialog_Progress_Process_Data( main) worker_process_data = Wordless_Worker_Process_Data_Keywords_Fig( main, dialog_progress, data_received) thread_process_data = wordless_threading.Wordless_Thread_Process_Data( worker_process_data) thread_process_data.start() dialog_progress.exec_() thread_process_data.quit() thread_process_data.wait() else: wordless_msg_box.wordless_msg_box_missing_observed_file(main) wordless_msg.wordless_msg_generate_fig_error(main) else: wordless_msg.wordless_msg_generate_fig_error(main)