예제 #1
0
        res.plot_all_tests(only="standalone_", exclude=(), profiling_minimum=0)
        savefig(os.path.join(plot_dir, f'speed_test_{test_name}_standalone_timers.png'))
        res.plot_all_tests(only="standalone_",
                           exclude=("standalone_before_", "standalone_after_"),
                           profiling_minimum=0)
        savefig(os.path.join(plot_dir, f'speed_test_{test_name}_standalone_timers_without_extra_diffs.png'))
        if 6 != len(get_fignums()):
            print_flushed(f"WARNING: There were {len(get_fignums())} plots created, but only {6 * (i + 1)} saved.", slack=False)
        for f in get_fignums():
            close(f)

        # pickel results object and csv file to disk
        pkl_file = os.path.join(data_dir, test_name + '.pkl' )
        pickle_results(res, pkl_file)
        try:
            translate_pkl_to_csv(pkl_file)
        except KeyError as e:
            print_flushed(f"ERROR tranlating {pkl_file} to csv:\n\tKeyError: {e}")

        try:
            for key in res.brian_stdouts.keys():
                config_key, st_key, n_key = key
                suffix = f'{st_key}_{config_key}_{n_key}.txt'
                stdout_file = os.path.join(log_dir, f'stdout_{suffix}')
                with open(stdout_file, 'w+') as sfile:
                    sfile.write(res.brian_stdouts[key])
                print_flushed(f"Written {stdout_file}", slack=False)
                stderr_file = os.path.join(log_dir, f'stderr_{suffix}')
                with open(stderr_file, 'w+') as sfile:
                    sfile.write(res.brian_stderrs[key])
                print_flushed(f"Written {stderr_file}", slack=False)
예제 #2
0
import argparse
parser = argparse.ArgumentParser(description=("Extract benchmark data from pickled SpeedTest "
                                              "obejct into csv files from pickle file. Overwrites "
                                              "already existing csv files of same name."))

parser.add_argument('files', nargs='+', type=str,
                    help=(".pkl files to translate. * wildcard supported."))

args = parser.parse_args()

import glob
from helpers import translate_pkl_to_csv

for pattern in args.files:
    for pkl in glob.glob(pattern):
        print(f"Extracting csv files from {pkl}")
        translate_pkl_to_csv(pkl)