def main(): record = SimulationRecord(100, False) record.loadHDF5('../data/anazasi.h5', True, True) agentResults = GlobalAgentStats(';') agentResults.addAnalysis(AgentNum()) agentResults.addAnalysis(AgentMean('estimates')) agentResults.applyTo(record, 'households.csv', 'Household') rasterResults = GlobalRasterStats(';') rasterResults.addAnalysis(RasterMean()) rasterResults.addAnalysis(RasterSum()) rasterResults.applyTo(record, 'water.csv', 'yield x100')
def main(): """ this file provides a template that can be used to analyze any Pandora model """ record = SimulationRecord(1, False) record.loadHDF5('data/results.h5', True, True) agentResults = GlobalAgentStats(';') agentResults.addAnalysis(AgentNum()) agentResults.addAnalysis(AgentMean('x')) agentResults.addAnalysis(AgentMean('y')) agentResults.addAnalysis(AgentMean('value')) agentResults.addAnalysis(AgentSum('value')) agentResults.applyTo(record, 'agents.csv', 'HelloAgent') rasterResults = GlobalRasterStats(';') rasterResults.addAnalysis(RasterMean()) rasterResults.addAnalysis(RasterSum()) rasterResults.applyTo(record, 'values.csv', 'values')
def main(): record = SimulationRecord(1, False) record.loadHDF5('../data/results.h5', True, True) agentResults = GlobalAgentStats(';') agentResults.addAnalysis(AgentNum()) agentResults.addAnalysis(AgentMean('strength x100')) agentResults.addAnalysis(AgentMean('aggressiveness x100')) agentResults.addAnalysis(AgentStdDev('strength x100')) agentResults.addAnalysis(AgentStdDev('aggressiveness x100')) agentResults.addAnalysis(AgentSum('strength x100')) agentResults.addAnalysis(AgentSum('aggressiveness x100')) agentResults.applyTo(record, 'farmers.csv', 'Farmer') agentResults.applyTo(record, 'herders.csv', 'Herder') rasterResults = GlobalRasterStats(';') rasterResults.addAnalysis(RasterMean()) rasterResults.addAnalysis(RasterSum()) rasterResults.applyTo(record, 'conflicts.csv', 'conflicts')
self.addAgent(newAgent) newAgent.setRandomPosition() newAgent._value = random.randint(0, 10) mySimulation = Simulation(32, 10) myWorld = MyWorld(mySimulation) myWorld.initialize() myWorld.run() # analysis record = SimulationRecord() record.loadHDF5('data/results.h5', 1, 1) agentResults = AgentResults(record, 'agents.csv', 'id', ';') agentResults.addAnalysis(AgentNum()) agentResults.addAnalysis(AgentMean('x')) agentResults.addAnalysis(AgentMean('y')) agentResults.addAnalysis(AgentMean('value')) agentResults.addAnalysis(AgentSum('value')) agentResults.addAnalysis(AgentHDFtoSHP('shp/agents.shp', -1)) agentResults.apply() rasterResults = RasterResults(record, 'resources.csv', 'test', ';') rasterResults.addAnalysis(RasterMean()) rasterResults.addAnalysis(RasterSum()) rasterResults.apply()