scicom.knowledgespread.utils

Utility functions for initial condition generation.

Classes

GenerateInitalPopulation

Generate sets of initial conditions.

GenerateSocNet

Functions

epistemicRange(baseRange, age)

Return the age dependent search radius for epistemic discovery.

ageFunction(agent, a, b, c, radius)

Return an age dependent radius.

Module Contents

scicom.knowledgespread.utils.epistemicRange(baseRange, age)

Return the age dependent search radius for epistemic discovery.

scicom.knowledgespread.utils.ageFunction(agent, a, b, c, radius)

Return an age dependent radius.

Bell-shaped function with center at c, slop and width of plateau defined by a, b.

Can be used to show age-dependent activity of agents.

Return type:

float

class scicom.knowledgespread.utils.GenerateInitalPopulation(numScientists, timesteps)

Generate sets of initial conditions.

N
Tstep
epistemicFunc(fc, x, y, beta=8)

Epistemic space initial sampling.

timeFunc(dataframe, step, fcT='saturate', slope=5, base=5)

Population growth function.

sample(fcE='complex', fcT='saturate', beta=8, slope=5, base=5)

Generate the sample population and add activation time.

_fullDist(fcE, beta)

Full distribution to sample from.

class scicom.knowledgespread.utils.GenerateSocNet(dataframe, minDist=0.0001)
Parameters:
  • dataframe (pandas.DataFrame)

  • minDist (float)

population
density = ''
allEdges = ''
socialNet = ''
minDist = 0.0001
_getWeighted(row, degree)
initSocNet()

Generates initial social network sample from population.

The dataframe input should contain the colum names: id, x, y, z, t Returns social network sample with from_id, to_id, dist, time

growNodes(time, nEdges)

Add nodes with weighted preferential attachment.

For a time step select all new agents. For each agent query all potential edges to previously active agents. Weight these edges with the degree of the previous social network and the distances. From this select N edges for each new agent. Return the concatenated new edges

growEdges(time, density, densityGrowth)

Add edges with weighted preferential attachement.

For a given time, select the current social network, including newly added nodes. Add weights by current degree and distances. Sample a suffiecient number of edges to keep density at a given level.

run(nEdges=4, density=0.2, densityGrowth=0)