scicom.historicalletters.model ============================== .. py:module:: scicom.historicalletters.model .. autoapi-nested-parse:: The model class for HistoricalLetters. Classes ------- .. autoapisummary:: scicom.historicalletters.model.HistoricalLetters Functions --------- .. autoapisummary:: scicom.historicalletters.model.getPrunedLedger scicom.historicalletters.model.getComponents scicom.historicalletters.model.getScaledLetters scicom.historicalletters.model.getScaledMovements Module Contents --------------- .. py:function:: 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. .. py:function:: 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. .. py:function:: getScaledLetters(model) Return relative number of send letters. .. py:function:: getScaledMovements(model) Return relative number of movements. .. py:class:: 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: :py:obj:`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. .. py:attribute:: population :value: 100 .. py:attribute:: moveRange :value: 0.05 .. py:attribute:: letterRange :value: 0.2 .. py:attribute:: runPruning :value: False .. py:attribute:: useActivation :value: False .. py:attribute:: similarityThreshold :value: 0.2 .. py:attribute:: useSocialNetwork :value: False .. py:attribute:: longRangeNetworkFactor :value: 0.3 .. py:attribute:: shortRangeNetworkFactor :value: 0.4 .. py:attribute:: socialNetwork .. py:attribute:: letterLedger :value: [] .. py:attribute:: movements :value: 0 .. py:attribute:: scaleSendInput .. py:attribute:: updatedTopicsDict .. py:attribute:: updatedPositionDict .. py:attribute:: space .. py:attribute:: debug :value: False .. py:attribute:: regions :value: [] .. py:attribute:: meandistance .. py:attribute:: factors .. py:attribute:: datacollector .. py:method:: _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. .. py:method:: step_with_data() One simulation step with data collection. .. py:method:: step() One simulation step without data collection. .. py:method:: 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.