- Timestamp:
- 02/06/23 20:29:12 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
framspy/FramsticksLib.py
r1199 r1200 32 32 33 33 34 # This function is not needed because in python, "For efficiency reasons, each module is only imported once per interpreter session."34 # This function is not needed because in Python, "For efficiency reasons, each module is only imported once per interpreter session." 35 35 # @staticmethod 36 36 # def getFramsModuleInstance(): … … 60 60 frams.Simulator.expdef = "standard-eval" # this expdef (or fully compatible) must be used by EVALUATION_SETTINGS_FILE 61 61 if sim_settings_files is not None: 62 self.EVALUATION_SETTINGS_FILE = sim_settings_files 62 self.EVALUATION_SETTINGS_FILE = sim_settings_files # overwrite defaults 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 … … 71 71 print(ec.messages) # output all caught messages 72 72 if ec.error_count._value() > 0: 73 raise ValueError("Problem while importing file '%s'" % simfile) # make missing files or incorrect paths fatal because they would not stop Framsticks from further processing, and error messages are easy to overlook in output73 raise ValueError("Problem while importing file '%s'" % simfile) # make missing files or incorrect paths fatal because error messages are easy to overlook in output, and these errors would not prevent Framsticks simulator from performing genetic operations, starting and running in evaluate() 74 74 75 75 … … 89 89 if not self.PRINT_FRAMSTICKS_OUTPUT: 90 90 ec = frams.MessageCatcher.new() # mute potential errors, warnings, messages 91 ec.store = 2; # store all, because they are caught by MessageCatcher and will not appear on console 91 92 92 93 frams.GenePools[0].clear() … … 107 108 108 109 if not self.PRINT_FRAMSTICKS_OUTPUT: 109 if ec.error_count._value() > 0: # errors are important and should not be ignored, at least display how many110 print("[ERROR]", ec.error_count, "error(s) and", ec.warning_count-ec.error_count, "warning(s) while evaluating", len(genotype_list), "genotype(s)")111 110 ec.close() 111 if ec.error_count._value() > 0: 112 print(ec.messages) # if errors occurred, output all caught messages for debugging 113 raise RuntimeError("[ERROR] %d error(s) and %d warning(s) while evaluating %d genotype(s)" % (ec.error_count._value(), ec.warning_count._value()-ec.error_count._value(), len(genotype_list))) # make errors fatal; by default they stop the simulation anyway so let's not use potentially incorrect or partial results and fix the cause first. 112 114 113 115 results = []
Note: See TracChangeset
for help on using the changeset viewer.