def reportTest(fileName): with open(fileName, "r") as f: s = f.read() chronicles = Chronicles() chronicles.fromJSON(s) report = Report(chronicles) report.image_file_types = [".png"] report.htmlReport("../test/report.html") webbrowser.open("../test/report.html")
def selftest(): with open("../test/Test.json", "r") as f: s = f.read() chronicles = Chronicles("Report.selftest()", "Eckhart Arnold", "Self-test of the Report.py module with artificially generated data.") chronicles.fromJSON(s) report = Report(chronicles) report.htmlReport("../test/report.html") webbrowser.open("../test/report.html")
def Simulation(fileName): chronicles = Chronicles("Test Simulation", "Eckhart Arnold", "A Test of the 'Augmented Experiment' Prototype with a simulation.") world = World(chronicles) agents = [Random() for i in range(2)] + \ [ModerateEgoist() for i in range(10)] + \ [EgoistPunisher() for i in range(10)] + \ [SimpleHeuristics() for i in range(10)] + \ [SimpleHeuristicsPunisher() for i in range(10)] world.setup(agents, PublicGoodsGame(1.6), 30, 20, 20) world.run() #report = Report(chronicles) with open(fileName, "w") as f: f.write(chronicles.toJSON())
def readChroniclesTest(fileName): with open(fileName, "r") as f: s = f.read() chronicles = Chronicles() chronicles.fromJSON(s)