def run_extract_extremes(): """ Tests whether extract_extremes() from extract_extremes.py works correctly for the given input. """ from extract_extremes import extract_extremes from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) extract_extremes(abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-extremes.txt')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) assert compare_files(abspath(join(base_path, 'test-data', 'archives-extremes.txt')), abspath(join(base_path, 'test-data', 'archives-results', 'archives-extremes.txt')))
def run_archive_difference(): """ Tests whether archive_difference() from archive_difference.py works correctly for the given input. """ from archive_difference import archive_difference from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) archive_difference(abspath(join(base_path, 'test-data', 'archives-input', 'a')), abspath(join(base_path, 'test-data', 'archives-input', 'b')), abspath(join(base_path, 'test-data', 'archives-diff.txt')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) assert compare_files(abspath(join(base_path, 'test-data', 'archives-diff.txt')), abspath(join(base_path, 'test-data', 'archives-results', 'archives-diff.txt')))
def run_archive_split(): """ Tests whether archive_split() from archive_split.py works correctly for the given input. """ from archive_split import archive_split from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) archive_split(abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-split')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) for root, dirs, files in walk(abspath(join(base_path, 'test-data', 'archives-split')), topdown=False): for name in files: assert compare_files(abspath(join(base_path, 'test-data', 'archives-results', name)), abspath(join(base_path, 'test-data', 'archives-split', name)))
def run_extract_extremes(): """ Tests whether extract_extremes() from extract_extremes.py works correctly for the given input. """ from extract_extremes import extract_extremes from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) extract_extremes( abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-extremes.txt')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) assert compare_files( abspath(join(base_path, 'test-data', 'archives-extremes.txt')), abspath( join(base_path, 'test-data', 'archives-results', 'archives-extremes.txt')))
def run_log_reconstruct(): """ Tests whether log_reconstruct() from log_reconstruct.py works correctly for the given input. """ from log_reconstruct import log_reconstruct from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) log_reconstruct(abspath(join(base_path, 'test-data', 'archives-input')), 'reconstruction', 'RECONSTRUCTOR', 'A test for reconstruction of logger output', parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) for root, dirs, files in walk(abspath(join(base_path, 'exdata', 'reconstruction')), topdown=False): for name in files: compare_files(abspath(join(root, name)), abspath(join(root, name)).replace('exdata', 'test-data'))
def run_archive_difference(): """ Tests whether archive_difference() from archive_difference.py works correctly for the given input. """ from archive_difference import archive_difference from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) archive_difference( abspath(join(base_path, 'test-data', 'archives-input', 'a')), abspath(join(base_path, 'test-data', 'archives-input', 'b')), abspath(join(base_path, 'test-data', 'archives-diff.txt')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) assert compare_files( abspath(join(base_path, 'test-data', 'archives-diff.txt')), abspath( join(base_path, 'test-data', 'archives-results', 'archives-diff.txt')))
def run_archive_update(): """ Tests whether merge_archives() from archive_update.py works correctly for the given input. """ from archive_update import merge_archives from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) new_hypervolumes = merge_archives(abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-output')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40'), False) precision = 1e-13 assert len(new_hypervolumes) == 22 assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d02'), 0.107610318984904, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d03'), 0.227870801380100, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d05'), 0.438362398133288, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d10'), 0.742933437184518, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d20'), 0.587349925250638, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d40'), 0.359511886735384, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i06_d05'), 0.038070322787987, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i07_d05'), 0.129884501203751, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i08_d05'), 0.000760506516737, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i09_d05'), 0.025178346536679, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i10_d05'), 0.001064503341995, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f08_i06_d05'), 0.791099512196690, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f16_i02_d05'), 0.888980819178966, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f17_i01_d05'), 0.948755656523708, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f18_i07_d10'), 0.948488874548393, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f24_i10_d03'), 0.985816809701546, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f25_i02_d05'), 0.933561771067860, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f34_i07_d05'), 0.951275562997383, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f48_i07_d02'), 0.985762281913168, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f50_i07_d02'), 0.893071152604545, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f51_i02_d05'), 0.920488608198097, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f52_i07_d02'), 0.920581303184137, precision)
def run_archive_split(): """ Tests whether archive_split() from archive_split.py works correctly for the given input. """ from archive_split import archive_split from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) archive_split(abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-split')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) for root, dirs, files in walk(abspath( join(base_path, 'test-data', 'archives-split')), topdown=False): for name in files: assert compare_files( abspath(join(base_path, 'test-data', 'archives-results', name)), abspath(join(base_path, 'test-data', 'archives-split', name)))
def run_archive_analysis(): """ Tests whether archive_analysis() and summary_analysis() from archive_analysis.py work correctly for the given input. """ from archive_analysis import archive_analysis, summary_analysis from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) archive_analysis(abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-analysis')), -3.5, 5, parse_range('48'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) for root, dirs, files in walk(abspath(join(base_path, 'test-data', 'archives-analysis')), topdown=False): for name in files: assert compare_files(abspath(join(base_path, 'test-data', 'archives-results', name)), abspath(join(base_path, 'test-data', 'archives-analysis', name))) summary_analysis(abspath(join(base_path, 'test-data', 'archives-analysis')), abspath(join(base_path, 'test-data', 'archives-analysis.txt')), -3.5, 5, parse_range('48'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) assert compare_files(abspath(join(base_path, 'test-data', 'archives-analysis.txt')), abspath(join(base_path, 'test-data', 'archives-results', 'archives-analysis.txt')))
def run_archive_analysis(): """ Tests whether archive_analysis() and summary_analysis() from archive_analysis.py work correctly for the given input. """ from archive_analysis import archive_analysis, summary_analysis from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) archive_analysis( abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-analysis')), -3.5, 5, parse_range('48'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) for root, dirs, files in walk(abspath( join(base_path, 'test-data', 'archives-analysis')), topdown=False): for name in files: assert compare_files( abspath(join(base_path, 'test-data', 'archives-results', name)), abspath(join(base_path, 'test-data', 'archives-analysis', name))) summary_analysis( abspath(join(base_path, 'test-data', 'archives-analysis')), abspath(join(base_path, 'test-data', 'archives-analysis.txt')), -3.5, 5, parse_range('48'), parse_range('1-10'), parse_range('2,3,5,10,20,40')) assert compare_files( abspath(join(base_path, 'test-data', 'archives-analysis.txt')), abspath( join(base_path, 'test-data', 'archives-results', 'archives-analysis.txt')))
def run_archive_update(): """ Tests whether merge_archives() from archive_update.py works correctly for the given input. """ from archive_update import merge_archives from cocoprep.archive_load_data import parse_range base_path = dirname(__file__) new_hypervolumes = merge_archives( abspath(join(base_path, 'test-data', 'archives-input')), abspath(join(base_path, 'test-data', 'archives-output')), parse_range('1-55'), parse_range('1-10'), parse_range('2,3,5,10,20,40'), False) precision = 1e-13 assert len(new_hypervolumes) == 22 assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d02'), 0.107610318984904, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d03'), 0.227870801380100, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d05'), 0.438362398133288, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d10'), 0.742933437184518, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d20'), 0.587349925250638, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f01_i04_d40'), 0.359511886735384, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i06_d05'), 0.038070322787987, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i07_d05'), 0.129884501203751, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i08_d05'), 0.000760506516737, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i09_d05'), 0.025178346536679, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f03_i10_d05'), 0.001064503341995, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f08_i06_d05'), 0.791099512196690, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f16_i02_d05'), 0.888980819178966, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f17_i01_d05'), 0.948755656523708, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f18_i07_d10'), 0.948488874548393, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f24_i10_d03'), 0.985816809701546, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f25_i02_d05'), 0.933561771067860, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f34_i07_d05'), 0.951275562997383, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f48_i07_d02'), 0.985762281913168, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f50_i07_d02'), 0.893071152604545, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f51_i02_d05'), 0.920488608198097, precision) assert almost_equal(new_hypervolumes.get('bbob-biobj_f52_i07_d02'), 0.920581303184137, precision)