Installation
Generating hexagon shapefiles is a requirement to generate spatial networks by SHoBNetPy and involves an QGIS installation. QGIS is not needed in case hexagon shapefiles have already been produced for the simulation are and are available for network generation.
Stable release (not yet supported)
To install SHoBNetPy, run this command in your terminal:
$ pip install shobnetpy
This is the preferred method to install SHoBNetPy, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
Install most recent version from Gitlab
You may also install the latest development of SHoBNetPy from the gitlab directly:
$ pip install git+https://gitlab.uni-kassel.de/ines/shobnetpy.git
From sources
The sources for SHoBNetPy can be downloaded from the Gitlab repo.
You can either clone the public repository:
$ git clone https://gitlab.uni-kassel.de/ines/shobnetpy
Once you have a copy of the source, you can install it with:
$ cd <path to shobnetpy git project>
$ python setup.py install
or alternatively
$ cd <path to shobnetpy git project>
$ pip install -e .
Configuration
To make same basic settings and specify important path, editing a configuration toml file is necessary. Switch to the directory your model resides in, or you want SHoBNetPy files for the model to be. Then start the python interpreter:
A template and an appropriate file structure can be obtained by executing the following python code:
import shobnetpy as sn
sn.prepare(<working directory>)
Passing the <working directory> is optional. If not present, shobnetpy will install the files in the subfolder shobnetpy within the user’s home directory.
Then navigate to <working directory>/input and edit settings.toml:
[main]
output_dir = "shobnetpy/output"
project = "Example"
task = "TaskA"
scenario_id = 1
runid = 0
input_path = "@none"
output_path = "@format {this.main.output_dir}/{this.main.project}"
qgis = "@none"
qt5 = "@none"
See inside settings.toml or Settings Documentation for explanations about settings.
Settings qgis and qt5 are required for hexagon creation and need to specify the path to according python packages. Examples for two operating systems:
Windows |
Linux |
|
|---|---|---|
qgis |
C:\Program Files\QGIS 3.36.2\apps\qgis\python |
/usr/lib/python3/dist-packages |
qt5 |
C:\Program Files\QGIS 3.36.2\apps\Python312\Lib\site-packages |
/usr/lib/python3/dist-packages |
The lcoation of settings.toml can also be assigned to the environmental variable SN_SETTINGS_FILE_FOR_DYNACONF.
In ./input you also find a file config_logging.conf to control logging of SHoBNetPy.
Test the configuration
You can use one of the Examples to check whether the plugin works at your machine.