- Timestamp:
- 02/01/23 23:03:50 (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksLib.py
r1177 r1196 8 8 9 9 class FramsticksLib: 10 """Communicates directly with Framsticks library (.dll or .so ).10 """Communicates directly with Framsticks library (.dll or .so or .dylib). 11 11 You can perform basic operations like mutation, crossover, and evaluation of genotypes. 12 12 This way you can perform evolution controlled by python as well as access and manipulate genotypes. … … 16 16 Should you want to modify or extend this class, first see and test the examples in frams-test.py. 17 17 18 You need to provide one or two parameters when you run this class: the path to Framsticks where .dll/.so resides19 and, optionally, the name of the Framsticks dll/so (if it is non-standard). See::18 You need to provide one or two parameters when you run this class: the path to Framsticks where .dll/.so/.dylib resides 19 and, optionally, the name of the Framsticks dll/so/dylib (if it is non-standard). See:: 20 20 FramsticksLib.py -h""" 21 21 … … 63 63 print('Using settings:', self.EVALUATION_SETTINGS_FILE) 64 64 assert isinstance(self.EVALUATION_SETTINGS_FILE, list) # ensure settings file(s) are provided as a list 65 65 66 for simfile in self.EVALUATION_SETTINGS_FILE: 67 ec = frams.MessageCatcher.new() # catch potential errors, warnings, messages - just to detect if there are ERRORs 68 ec.store = 2; # store all, because they are caught by MessageCatcher and will not appear on console (which we want) 66 69 frams.Simulator.ximport(simfile, 4 + 8 + 16) 70 ec.close() 71 print(ec.messages) # output all caught messages 72 assert ec.error_count._value() == 0, "Problem while importing file '%s'" % simfile # make missing files fatal because error messages are easy to overlook 67 73 68 74 … … 101 107 if not self.PRINT_FRAMSTICKS_OUTPUT: 102 108 if ec.error_count._value() > 0: # errors are important and should not be ignored, at least display how many 103 print("[ERROR]", ec.error_count, "error(s) and", ec.warning_count , "warning(s) while evaluating", len(genotype_list), "genotype(s)")109 print("[ERROR]", ec.error_count, "error(s) and", ec.warning_count-ec.error_count, "warning(s) while evaluating", len(genotype_list), "genotype(s)") 104 110 ec.close() 105 111 … … 198 204 def parseArguments(): 199 205 parser = argparse.ArgumentParser(description='Run this program with "python -u %s" if you want to disable buffering of its output.' % sys.argv[0]) 200 parser.add_argument('-path', type=ensureDir, required=True, help='Path to the Framsticks library (.dll or .so ) without trailing slash.')201 parser.add_argument('-lib', required=False, help='Library name. If not given, "frams-objects.dll" or "frams-objects.so"is assumed depending on the platform.')206 parser.add_argument('-path', type=ensureDir, required=True, help='Path to the Framsticks library (.dll or .so or .dylib) without trailing slash.') 207 parser.add_argument('-lib', required=False, help='Library name. If not given, "frams-objects.dll" (or .so or .dylib) is assumed depending on the platform.') 202 208 parser.add_argument('-simsettings', required=False, help='The name of the .sim file with settings for evaluation, mutation, crossover, and similarity estimation. If not given, "eval-allcriteria.sim" is assumed by default. Must be compatible with the "standard-eval" expdef.') 203 209 parser.add_argument('-genformat', required=False, help='Genetic format for the demo run, for example 4, 9, or S. If not given, f1 is assumed.')
Note: See TracChangeset
for help on using the changeset viewer.