示例#1
0
    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()
示例#2
0
    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()