You can add configuration settings to your code using configparser. This enables you to quickly change the datasources, algorithms etc without changing the code (say no more to huge commented code blocks).
Concept
- Create
config.ini file that looks like this:
[general]
datafile=path/to/datafile
algorithm=rungekutta8
outuput=path/to/output
[logging]
level=debug
logfile=path/to/logfile
- The flow should be the following (not sure about fallbacks....)
import configparser
config = configparser.ConfigParser()
config.read("config.ini")
...
self.Algorithm = config.get("general", "algorithm", fallback="RungeKutta8")
self.LogFile = config.get("logging", "logfile", fallback=None)
...
if self.Algorithm == "RungeKutta8":
...
You can also add default settings and much more...
You can add configuration settings to your code using
configparser. This enables you to quickly change the datasources, algorithms etc without changing the code (say no more to huge commented code blocks).Concept
config.inifile that looks like this:You can also add default settings and much more...