Beispiel #1
0
            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()
Beispiel #2
0
#!/usr/bin/python

import sys
sys.path.append('../../../pandora/pyPandora/')
sys.path.append('../../../pandora/')
from pyPandora import SimulationRecord, AgentResults, AgentMean, AgentSum, AgentNum, AgentHDFtoSHP, RasterMean, RasterSum, RasterResults

record = SimulationRecord()
record.loadHDF5('data/results.h5', 1, 1)

agentResults = AgentResults(record, 'agents.csv', 'MyAgent', ';')
agentResults.addAnalysis(AgentNum())
agentResults.addAnalysis(AgentMean('x'))
agentResults.addAnalysis(AgentMean('y'))
agentResults.addAnalysis(AgentMean('resources'))
agentResults.addAnalysis(AgentSum('resources'))
agentResults.addAnalysis(AgentHDFtoSHP('shp/agents.shp', -1))

agentResults.apply()

rasterResults = RasterResults(record, 'rasters.csv', 'resources', ';')
rasterResults.addAnalysis(RasterMean())
rasterResults.addAnalysis(RasterSum())

rasterResults.apply()