예제 #1
0
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')
예제 #2
0
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')
예제 #3
0
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():
    """ 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')
예제 #5
0
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')
예제 #6
0
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')
예제 #7
0
#!/usr/bin/python

import sys, random
sys.path.append('../../../pyPandora/')
sys.path.append('../../../')
from pyPandora import SimulationRecord, GlobalAgentStats, AgentNum, AgentMean, AgentSum, AgentStdDev, GlobalRasterStats, RasterMean, RasterSum

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')

예제 #8
0
    def createAgents(self):
        for i in range(0, 10):
            newAgent = MyAgent('id_' + str(i))
            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())
예제 #9
0
	def createAgents(self):
		for i in range (0, 10):
			newAgent = MyAgent('id_'+str(i))
			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())
예제 #10
0
#!/usr/bin/python

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

record = SimulationRecord()
record.loadHDF5('data_test/gujarat.h5', 1, 1)

agentResults = AgentResults(record, 'agents.csv', 'HunterGatherer', ';')
agentResults.addAnalysis(AgentNum())
agentResults.addAnalysis(AgentMean('children'))
agentResults.addAnalysis(AgentSum('children'))
agentResults.addAnalysis(AgentMean('collected resources'))
agentResults.addAnalysis(AgentHDFtoSHP('shp/agents.shp', -1))

agentResults.compute()

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

rasterResults.compute()

예제 #11
0
    def createAgents(self):
        for i in range(0, 10):
            newAgent = MyAgent('id_' + str(i))
            self.addAgent(newAgent)
            newAgent.setRandomPosition()
            newAgent._value = random.randint(0, 10)


myConfig = Config(SizeInt(32, 32), 10)
myWorld = MyWorld(myConfig)
myWorld.initialize()
myWorld.run()

# analysis

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', 'id')
#agentResults.addAnalysis(AgentHDFtoSHP('shp/agents.shp', -1))

rasterResults = GlobalRasterStats(';')
rasterResults.addAnalysis(RasterMean())
rasterResults.addAnalysis(RasterSum())
rasterResults.applyTo(record, 'resources.csv', 'test')
예제 #12
0
#!/usr/bin/python3.3

import sys, random
sys.path.append('/home/xrubio/workspace/pandora/pandora/pyPandora/')
sys.path.append('/home/xrubio/workspace/pandora/pandora/')
from pyPandora import Simulation, Agent, World, Point2DInt, SimulationRecord, GlobalAgentStats, AgentNum, AgentMean, AgentSum, AgentStdDev, GlobalRasterStats, RasterMean, RasterSum

record = SimulationRecord(1, False)
record.loadHDF5('../data/anazasi.h5', True, True)

agentResults = GlobalAgentStats(';')
agentResults.addAnalysis(AgentNum())
#agentResults.addAnalysis(AgentMean('estimates'))
#agentResults.addAnalysis(AgentStdDev('strength x100'))
#agentResults.addAnalysis(AgentSum('strength x100'))
agentResults.applyTo(record,'households.csv', 'Household')

#rasterResults = GlobalRasterStats(';')
#rasterResults.addAnalysis(RasterMean())
#rasterResults.addAnalysis(RasterSum())

#rasterResults.applyTo(record, 'water.csv', 'yield x100')

예제 #13
0
파일: analysis.py 프로젝트: xrubio/models
#!/usr/bin/python3

import sys, random

pandoraDir = '/home/xrubio/workspace/pandoraMaster/'

sys.path.append(pandoraDir+'/pandora/')
sys.path.append(pandoraDir+'/pandora/pyPandora/')

from pyPandora import Simulation, Point2DInt, SimulationRecord, GlobalAgentStats, AgentNum, AgentMean, AgentSum, AgentStdDev, GlobalRasterStats, RasterMean, RasterSum, SizeInt

record = SimulationRecord(1, False)
record.loadHDF5('data/ap.h5', True, True)

agentResults = GlobalAgentStats(';')
agentResults.addAnalysis(AgentNum())
agentResults.addAnalysis(AgentMean('population'))
agentResults.addAnalysis(AgentSum('population'))
"""
agentResults.addAnalysis(AgentMean('starvation rate %'))
agentResults.addAnalysis(AgentMean('number of plots'))
agentResults.addAnalysis(AgentSum('number of animals'))
"""
agentResults.applyTo(record, 'agents.csv', 'ap')