1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-13 23:12:28 +00:00

Update SOIL Tutorial.ipynb

Cambiado infectados por infected y alguna traducción más
This commit is contained in:
Carlos A. Iglesias 2017-01-19 12:56:28 +01:00 committed by GitHub
parent 584c88b108
commit c3479f224b

View File

@ -179,14 +179,14 @@
],
"source": [
"for x in range(0, settings.number_of_nodes):\n",
" for empresa in models.networkStatus[\"agente_%s\"%x]:\n",
" for enterprise in models.networkStatus[\"agent_%s\"%x]:\n",
" emotionStatusAux=[]\n",
" for tiempo in models.networkStatus[\"agente_%s\"%x][empresa]:\n",
" for time in models.networkStatus[\"agent_%s\"%x][enterprise]:\n",
" prec = 2\n",
" output = math.floor(models.networkStatus[\"agente_%s\"%x][empresa][tiempo] * (10 ** prec)) / (10 ** prec) #Para tener 2 decimales solo\n",
" emotionStatusAux.append((output,tiempo,None))\n",
" output = math.floor(models.networkStatus[\"agent_%s\"%x][enterprise][time] * (10 ** prec)) / (10 ** prec) #Para tener 2 decimales solo\n",
" emotionStatusAux.append((output,time,None))\n",
" attributes = {}\n",
" attributes[empresa] = emotionStatusAux\n",
" attributes[enterprise] = emotionStatusAux\n",
" G.add_node(x, attributes)\n",
"\n",
"\n",
@ -221,31 +221,31 @@
"\n",
"attribute_plot = 'status'\n",
"for time in range(0, settings.max_time):\n",
" value_infectados = 0\n",
" value_infected = 0\n",
" value_neutral = 0\n",
" value_cured = 0\n",
" value_vaccinated = 0\n",
" real_time = time * settings.timeout\n",
" activity= False\n",
" for x in range(0, settings.number_of_nodes):\n",
" if attribute_plot in models.networkStatus[\"agente_%s\" % x]:\n",
" if real_time in models.networkStatus[\"agente_%s\" % x][attribute_plot]:\n",
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 1: ##Representar infectados\n",
" value_infectados += 1\n",
" if attribute_plot in models.networkStatus[\"agent_%s\" % x]:\n",
" if real_time in models.networkStatus[\"agent_%s\" % x][attribute_plot]:\n",
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 1: ##Represent infected\n",
" value_infected += 1\n",
" activity = True\n",
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 0: ##Representar neutrales\n",
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 0: ##Represent neutrals\n",
" value_neutral += 1\n",
" activity = True\n",
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 2: ##Representar cured\n",
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 2: ##Represent cured\n",
" value_cured += 1\n",
" activity = True\n",
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 3: ##Representar vaccinated\n",
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 3: ##Represent vaccinated\n",
" value_vaccinated += 1\n",
" activity = True\n",
"\n",
" if activity:\n",
" x_values.append(real_time)\n",
" infected_values.append(value_infectados)\n",
" infected_values.append(value_infected)\n",
" neutral_values.append(value_neutral)\n",
" cured_values.append(value_cured)\n",
" vaccinated_values.append(value_vaccinated)\n",
@ -353,7 +353,7 @@
" yield self.env.timeout(settings.timeout)\n",
"\n",
" def step(self, now):\n",
" networkStatus['agente_%s'% self.id] = self.a_json()\n",
" networkStatus['agent_%s'% self.id] = self.a_json()\n",
"\n",
" def a_json(self):\n",
" final = {}\n",