9165979b49
The web server is included as a submodule. The dependencies for the web (tornado) are not installed by default, but they can be installed as an extra: ``` pip install soil[web] ``` Once installed, the soil web can be used like this: ``` soil-web OR python -m soil.web ``` There are other minor changes: * History re-connects to the sqlite database if it is used from a different thread. * Environment accepts additional parameters (so it can run simulations with `visualization_params` or any other in the future). * The simulator class is no longer necessary * Logging is done in the same thread, and the simulation is run in a separate one. This had to be done because it was creating some problems with tornado not being able to find the current thread during logs, which caused hundreds of repeated lines in the web "console". * The player is slightly modified in this version. I noticed that when the visualization was playing, if you clicked somewhere it would change for a second, and then go back to the previous place. The code for the playback seemed too complex, especially speed control, so I rewrote some parts. I might've introduced new bugs. |
6 years ago | |
---|---|---|
.. | ||
static | 6 years ago | |
templates | 6 years ago | |
.gitignore | 6 years ago | |
README.md | 6 years ago | |
TerroristNetworkModel.py | 6 years ago | |
TerroristNetworkModel.yml | 6 years ago | |
__init__.py | 6 years ago | |
__main__.py | 6 years ago | |
config.yml | 6 years ago | |
run.py | 6 years ago |
README.md
Graph Visualization with D3.js
The aim of this software is to provide a useful tool for visualising and analysing the result of different simulations based on graph. Once you run the simulation, you will be able to interact with the simulation in real time.
For this purpose, a model which tries to simulate the spread of information to comprehend the radicalism spread in a society is included. Whith all this, the main project goals could be divided in five as it is shown in the following.
- Simulate the spread of information through a network applied to radicalism.
- Visualize the results of the simulation.
- Interact with the simulation in real time.
- Extract data from the results.
- Show data in a right way for its research.
Deploying the server
For deploying the application, you will only need to run the following command.
python3 run.py [--name NAME] [--dump] [--port PORT] [--verbose]
Where the options are detailed in the following table.
Option | Description |
---|---|
--name NAME |
The name of the simulation. It will appear on the app. |
--dump |
For dumping the results in server side. |
--port PORT |
The port where the server will listen. |
--verbose |
Verbose mode. |
You can dump the results of the simulation in server side. Anyway, you will be able to download them in GEXF or JSON Graph format directly from the browser.
Visualization Params
The configuration of the simulation is based on the simulator configuration. In this case, it follows the SOIL configuration syntax and for visualising the results in a more comfortable way, more params can be added in visualization_params
dictionary.
- For setting a background image, the tag needed is
background image
. You can also add abackground_opacity
andbackground_filter_color
if the image is so clear than you can difficult view the nodes. - For setting colors to the nodes, you can do it based on their properties values. Using the
color
tag, you will need to indicate the attribute key and value, and then the color you want to apply. - The shapes applied to a group of nodes are always the same. This means than it won't change dynamically, so you will have to indicate the property with the
shape_property
tag and add a dictionary calledshapes
in which for each value, you indicate the shape. All shapes have to had been downloaded before in SVG format and added to the server.
An example of this configuration applied to the TerroristNetworkModel is presented.
visualization_params:
# Icons downloaded from https://www.iconfinder.com/
shape_property: agent
shapes:
TrainingAreaModel: target
HavenModel: home
TerroristNetworkModel: person
colors:
- attr_id: 0
color: '#40de40'
- attr_id: 1
color: red
- attr_id: 2
color: '#c16a6a'
background_image: 'map_4800x2860.jpg'
background_opacity: '0.9'
background_filter_color: 'blue'