Coverage for .tox/p311/lib/python3.11/site-packages/scicom/knowledgespread/app.py: 0%
9 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-17 13:30 +0200
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-17 13:30 +0200
1import mesa
2from mesa.experimental import JupyterViz, make_text
3import altair as alt
5from scicom.knowledgespread.agents import ScientistAgent
6from scicom.knowledgespread.model import (
7 KnowledgeSpread,
8 getActiveAgents,
9 getNetworkStructure
10)
11from scicom.knowledgespread.utils import ageFunction
12from scicom.knowledgespread.server import (
13 agent_draw_altair,
14 epiSpace_draw_altair,
15 socialNetwork_draw_altair,
16 chart_draw_altair_agents,
17 chart_draw_altair_communities
18)
20model_params = {
21 "num_scientists": {
22 "type": "SliderInt",
23 "value": 50,
24 "label": "Initial number of scientists",
25 "min": 10,
26 "max": 200,
27 "step": 10
28 },
29 "num_timesteps": {
30 "type": "SliderInt",
31 "value": 10,
32 "label": "How long is the number of agents growing?",
33 "min": 5,
34 "max": 100,
35 "step": 5
36 },
37 "epiInit": {
38 "type": "Select",
39 "value": "complex",
40 "label": "Choose initial conditions for epistemic space",
41 "values": ['complex', "central", "polarized"]
42 },
43 "timeInit": {
44 "type": "Select",
45 "value": "saturate",
46 "label": "Choose initial conditions for population growth.",
47 "values": ['saturate', "linear", "exponential"]
48 },
49 "epiRange": {
50 "type": "SliderFloat",
51 "value": 0.01,
52 "label": "Basic range of visibility in epistemic space",
53 "min": 0.005,
54 "max": 0.3,
55 "step": 0.005
56 }
57}
60page = JupyterViz(
61 KnowledgeSpread,
62 model_params,
63 measures=[socialNetwork_draw_altair, chart_draw_altair_agents, chart_draw_altair_communities],
64 name="Knowledge spread",
65 agent_portrayal=agent_draw_altair,
66 space_drawer=epiSpace_draw_altair
67)