def process_signature()

in prediction_postprocessing_scripts/merge_multiple_cpds_with_mozilla.py [0:0]


def process_signature(root, sig_path, first_method, other_methods, output_directory, combination_strategy, margin, conf):
    conf_folder_name = conf + '_' + first_method + '_' + second_method
    first_method_conf_dir = os.path.join(root, sig_path, conf + '_' + first_method)
    second_method_conf_dir = os.path.join(root, sig_path, conf + '_' + second_method)
    for first_method_file in os.listdir(first_method_conf_dir):
        first_method_file_path = os.path.join(first_method_conf_dir, first_method_file)
        if os.path.isfile(first_method_file_path) and first_method_file_path.endswith('.json'):
            first_method_json = load_json(first_method_file_path)
            for second_method_file in os.listdir(second_method_conf_dir):
                second_method_file_path = os.path.join(second_method_conf_dir, second_method_file)
                if os.path.isfile(second_method_file_path) and second_method_file_path.endswith('.json'):
                    second_method_json = load_json(second_method_file_path)
                    if first_method_json['status'] == 'SUCCESS' and second_method_json['status'] == 'SUCCESS':
                        result_json = merge_files(first_method_json, second_method_json, first_method, second_method, combination_strategy, margin)
                        store_json(output_directory, sig_path, result_json, conf_folder_name)
                    elif (conf == "default") and not (first_method_json['status'] == 'SUCCESS' and second_method_json['status'] == 'SUCCESS'):
                        result_json = create_fail_file(first_method_json, second_method_json, first_method, second_method)
                        store_json(output_directory, sig_path, result_json, conf_folder_name)