Commit d5bb62ce authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Use noise hiding as default in reports

parent 82821256
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ def compare_lines(f_line, c_line, config, line_num=0, num_len=4, log_file=None):
                                log_line + "</code><span style=\"font-weight: bold; color: rgb(255,0,0)\"><code>"
                                + c_groups[-1] + "</code></span><code>" + c_line[c_ends[-1]:len(c_line) - 2]
                            )
                if ((not config['hide_noise']) or warnings > 0 or errors > 0):
                    if ((not config['hide_noise'] and noisy > 0) or warnings > 0 or errors > 0):
                        log_file.write(log_line + "</code></pre></div>\n")
                        log_file.write(ref_line)
        else: # The two lines contain a different number of numeric values
@@ -429,7 +429,10 @@ def mismatch_severities(str_f_values, str_c_values, config):
                        fractional = scale * (f_values[i] - c_values[i]) / f_values[i]
                        if (fractional < 0.0): fractional *= -1.0
                        if (fractional <= config['warning_threshold']):
                            if (log_f_value > config['data_order']):
                                result[i] = 2
                            else:
                                result[i] = 1
                        else:
                            if (log_f_value > config['data_order']):
                                result[i] = 3
@@ -445,7 +448,10 @@ def mismatch_severities(str_f_values, str_c_values, config):
                        fractional = scale * (c_values[i] - f_values[i]) / c_values[i]
                        if (fractional < 0.0): fractional *= -1.0
                        if (fractional <= config['warning_threshold']):
                            if (log_c_value > config['data_order']):
                                result[i] = 2
                            else:
                                result[i] = 1
                        else:
                            if (log_c_value > config['data_order']):
                                result[i] = 3
@@ -473,7 +479,7 @@ def parse_arguments():
        'fortran_file_name': '',
        'full_log': False,
        'help_mode': False,
        'hide_noise': False,
        'hide_noise': True,
        'html_output': 'pycompare.html',
        'linewise': True,
        'log_html': False,
@@ -499,14 +505,10 @@ def parse_arguments():
            config['data_order'] = float(split_arg[1])
        elif (arg.startswith("--full")):
            config['full_log'] = True
        elif (arg.startswith("--hide-noise")):
            config['hide_noise'] = True
        elif (arg.startswith("--html")):
            config['log_html'] = True
            if (len(split_arg) == 2):
                config['html_output'] = split_arg[1]
        elif (arg.startswith("--warn")):
            config['warning_threshold'] = float(split_arg[1])
        elif (arg.startswith("--help")):
            config['help_mode'] = True
        elif (arg.startswith("--linewise")):
@@ -515,6 +517,10 @@ def parse_arguments():
            config['say_progress'] = False
        elif (arg.startswith("--quick")):
            config['check_all'] = False
        elif (arg.startswith("--show-noise")):
            config['hide_noise'] = False
        elif (arg.startswith("--warn")):
            config['warning_threshold'] = float(split_arg[1])
        else:
            raise Exception("Unrecognized argument \'{0:s}\'".format(arg))
        arg_index += 1
@@ -535,11 +541,11 @@ def print_help():
    print("--data-order=ORDER        Consider data only down to specified order (default order is -99).")
    print("--full                    Print all lines to log file (default prints only mismatches).")
    print("--help                    Print this help and exit.")
    print("--hide-noise              Hide noise in reports (default is to show it).")
    print("--html[=OPT_OUTPUT_NAME]  Enable logging to HTML file (default logs to \"pycompare.html\").")
    print("--linewise                Load only one line at a time. Useful to compare big files (True by default).")
    print("--no-progress             Disable progress logging.")
    print("--quick                   Stop on first mismatch (default is to perform a full check).")
    print("--show-noise              Show noise in reports (default is to hide it).")
    print("--warn                    Set a fractional threshold for numeric warning (default = 0.005).")
    print("                                            ")