scicom.historicalletters.model

The model class for HistoricalLetters.

Classes

HistoricalLetters

A letter sending model with historical informed initital positions.

Functions

getPrunedLedger(model)

Model reporter for simulation of archiving.

getComponents(model)

Model reporter to get number of components.

getScaledLetters(model)

Return relative number of send letters.

getScaledMovements(model)

Return relative number of movements.

Module Contents

scicom.historicalletters.model.getPrunedLedger(model)

Model reporter for simulation of archiving.

Returns statistics of ledger network of model run and various iterations of statistics of pruned networks.

The routine assumes that the network contains fields of sender, receiver and step information.

Parameters:

model (mesa.Model)

Return type:

pandas.DataFrame

scicom.historicalletters.model.getComponents(model)

Model reporter to get number of components.

The MultiDiGraph is converted to undirected, considering only edges that are reciprocal, ie. edges are established if sender and receiver have exchanged at least a letter in each direction.

Parameters:

model (mesa.Model)

Return type:

int

scicom.historicalletters.model.getScaledLetters(model)

Return relative number of send letters.

Parameters:

model (mesa.Model)

Return type:

float

scicom.historicalletters.model.getScaledMovements(model)

Return relative number of movements.

Parameters:

model (mesa.Model)

Return type:

float

class scicom.historicalletters.model.HistoricalLetters(population=100, moveRange=0.05, letterRange=0.2, similarityThreshold=0.2, longRangeNetworkFactor=0.3, shortRangeNetworkFactor=0.4, regionData=Path(Path(__file__).parent.parent.resolve(), 'data/NUTS_RG_60M_2021_3857_LEVL_2.geojson'), populationDistributionData=Path(Path(__file__).parent.parent.resolve(), 'data/pone.0162678.s003.csv'), *, useActivation=False, useSocialNetwork=False, runPruning=False, debug=False)

Bases: mesa.Model

A letter sending model with historical informed initital positions.

Each agent has an initial topic vector, expressed as a RGB value. The initial positions of the agents is based on a weighted random draw based on data from [1].

Each step, agents generate two neighbourhoods for sending letters and potential targets to move towards. The probability to send letters is a self-reinforcing process. During each sending the internal topic of the sender is updated as a random rotation towards the receivers topic.

[1] J. Lobo et al, Population-Area Relationship for Medieval European Cities,

PLoS ONE 11(10): e0162678.

Parameters:
  • population (int)

  • moveRange (float)

  • letterRange (float)

  • similarityThreshold (float)

  • longRangeNetworkFactor (float)

  • shortRangeNetworkFactor (float)

  • regionData (str)

  • populationDistributionData (str)

  • useActivation (bool)

  • useSocialNetwork (bool)

  • runPruning (bool)

  • debug (bool)

population = 100
moveRange = 0.05
letterRange = 0.2
runPruning = False
useActivation = False
similarityThreshold = 0.2
useSocialNetwork = False
longRangeNetworkFactor = 0.3
shortRangeNetworkFactor = 0.4
socialNetwork
letterLedger = []
movements = 0
scaleSendInput
updatedTopicsDict
updatedPositionDict
space
debug = False
regions = []
meandistance
factors
datacollector
_createSocialEdges(agent, graph)

Create social edges with the different wiring factors.

Define a close range by using the moveRange parameter. Among these neighbors, create a connection with probability set by the shortRangeNetworkFactor.

For all other agents, that are not in this closeRange group, create a connection with the probability set by the longRangeNetworkFactor.

Parameters:
Return type:

None

step_with_data()

One simulation step with data collection.

Return type:

None

step()

One simulation step without data collection.

Return type:

None

run(n)

Run the model for n steps.

Data collection is only run at the end of n steps. This is useful for batch runs accross different parameters.

Parameters:

n (int)

Return type:

None