experiment_list = [("environmental_datasets.cfg", "CRU10", "../data/species/occ_data.csv", "peromyscus maniculatus")] # ( "environmental_datasets.cfg", "CRU10", # "../data/species/occ_data.csv", "ursus americanus" ) ] mod = om.OpenModeller() algmd = mod.availableAlgorithms() num = mod.numAvailableAlgorithms() omtest_list = [] # run every experiment for every algorithm available for i in range(0, num): alg_id = algmd[i].id for exp in experiment_list: # append a list with function to be executed, test name # and parameters to be passed to function omtest_list.append( (algorithm_serialization, "%s: %s" % (alg_id, exp[3].capitalize()), [exp[0], exp[1], alg_id, exp[2], exp[3]])) if __name__ == '__main__': omtest.setup_run('algorithm_serialization') omtest.run_tests(omtest_list, omtest.parseOptions()) omtest.summarize()
return ('fail', None) def sample_dummy_blowup(args, options): (a, b) = 0 return ('fail', None) def sample_dummy_skip(args, options): # you can test the command line arguments like that: if not omtest.checkArguments(options, "algorithm", "bioclim"): return ('success', None) else: return ('skip', None) ############################################################################### omtest_list = [ sample_dummy_success, sample_dummy_failure, sample_dummy_blowup, sample_dummy_skip ] if __name__ == '__main__': omtest.setup_run('dummy_test') omtest.run_tests(omtest_list, omtest.parseOptions()) omtest.summarize()
return ('skip', None) mod = om.OpenModeller() try: algMetadata = mod.algorithmMetadata(alg_id) return ('success', None) except: return ('fail', None) ############################################################################### omtest_list = [(check_algorithm, "Bioclim", "Bioclim"), (check_algorithm, "BioclimDistance", "BioclimDistance"), (check_algorithm, "DistanceToAverage", "DistanceToAverage"), (check_algorithm, "MinimumDistance", "MinimumDistance"), (check_algorithm, "CSMBS", "CSMBS"), (check_algorithm, "GARP", "GARP"), (check_algorithm, "DG_GARP", "DG_GARP"), (check_algorithm, "GARP_BS", "GARP_BS"), (check_algorithm, "DG_GARP_BS", "DG_GARP_BS")] if __name__ == '__main__': omtest.setup_run('algorithm_presence_test') omtest.run_tests(omtest_list, omtest.parseOptions()) omtest.summarize()
# Copyright (c) 2003, Frank Warmerdam <*****@*****.**> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. ############################################################################### # import sys sys.path.append( 'pymod' ) import omtest test_list = [ 'algs' ] omtest.setup_run( 'om_user_test_all' ) omtest.run_all( test_list, omtest.parseOptions() ) omtest.summarize()
"../data/species/abs_data.csv", "strix varia")] mod = om.OpenModeller() algmd = mod.availableAlgorithms() num = mod.numAvailableAlgorithms() omtest_list = [] # run every experiment for every algorithm available for i in range(0, num): alg_id = algmd[i].id # find out whether algorithm accepts absence data usesAbsences = algmd[i].absence for exp in experiment_list: # append a list with function to be executed, test name # and parameters to be passed to function omtest_list.append( (algorithm_absences, "%s: %s" % (alg_id, exp[3].capitalize()), [exp[0], exp[1], alg_id, usesAbsences, exp[2], exp[3]])) if __name__ == '__main__': omtest.setup_run('algorithm_absences_test') omtest.run_tests(omtest_list, omtest.parseOptions()) omtest.summarize()
############################################################################### experiment_list = [("environmental_datasets.cfg", "CRU10", "../data/species/abs_data.csv", "strix varia")] mod = om.OpenModeller() algmd = mod.availableAlgorithms() num = mod.numAvailableAlgorithms() omtest_list = [] # run every experiment for every algorithm available for i in range(0, num): alg_id = algmd[i].id for exp in experiment_list: # append a list with function to be executed, test name # and parameters to be passed to function omtest_list.append( (matrix_input, "%s: %s" % (alg_id, exp[3].capitalize()), [exp[0], exp[1], alg_id, exp[2], exp[3]])) if __name__ == '__main__': omtest.setup_run('matrix_input_test') omtest.run_tests(omtest_list, omtest.parseOptions()) omtest.summarize()
("environmental_datasets.cfg", "CRU10", "../data/species/occ_data.csv", "strix varia"), ("environmental_datasets.cfg", "CRU10", "../data/species/occ_data.csv", "mephitis mephitis"), ("environmental_datasets.cfg", "CRU10", "../data/species/occ_data.csv", "ursus americanus")] mod = om.OpenModeller() algmd = mod.availableAlgorithms() num = mod.numAvailableAlgorithms() omtest_list = [] # run every experiment for every algorithm available for i in range(0, num): alg_id = algmd[i].id for exp in experiment_list: # append a list with function to be executed, test name # and parameters to be passed to function omtest_list.append( (algorithm_run, "%s: %s" % (alg_id, exp[3].capitalize()), [exp[0], exp[1], alg_id, exp[2], exp[3]])) if __name__ == '__main__': omtest.setup_run('algorithm_run_test') omtest.run_tests(omtest_list, omtest.parseOptions()) omtest.summarize()