A collection of models of economic Production Networks and their associated measures and functions.
Project description
ProdNet
ProdNet is a collection of models of economic Production Networks and their associated measures and functions. It can be used to perform and compare economic shock propagation simulations.
It is currently in development and functions may be broken, change, or be deleted. Before use contact the authors.
Free software: GNU General Public License v3
Installation
Install using:
pip install ProdNet
Usage
Currently only the Per Bak models are fully implemented. An example of how it can be used is the following. For more see the example notebooks in the examples folder.
import numpy as np
import matplotlib.pyplot as plt
from ProdNet import PerBak
from ProdNet.lib import icdf
import time
# Select economy depth and width, and total number of iterations
L = 1600
T = 1000
# Time performance for reference
start = time.time()
# Initialize simulation object
model = PerBak(L, T)
# Compute p, probability of demand "shock"
model.set_final_demand()
# Simulate
model.simulate()
# Print elapsed time
print(time.time() - start) # current best=37s
# Plot Y distribution
Y = np.sum(model.P, axis=(1, 2))
x, p = icdf(Y)
plt.scatter(x, p)
plt.yscale('log')
plt.xscale('log')
plt.show()
Development
Please work on a feature branch and create a pull request to the development branch. If necessary to merge manually do so without fast forward:
git merge --no-ff myfeature
To build a development environment run:
python3 -m venv env
source env/bin/activate
pip install -e '.[dev]'
For testing:
pytest --cov
Credits
This is a project by Leonardo Niccolò Ialongo and Davide Luzzati, under the supervision of Diego Garlaschelli and Giorgio Fagiolo .
History
0.0.2 (2023-12-02)
First release with working ARIO model.
0.0.1 (2022-07-27)
First release on PyPI. Per Bak models available but not thoroughly tested.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ProdNet-0.0.2.tar.gz
.
File metadata
- Download URL: ProdNet-0.0.2.tar.gz
- Upload date:
- Size: 39.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44898d1a77a5c265f7c1853d7ae3286d04947b1c743b8e7042c47b3cde6f7180 |
|
MD5 | a48efdfd8ee1e5462745977c1ed64709 |
|
BLAKE2b-256 | 27e93d88b793a1f0e4c75768c01b0669e648c6a7cfc997aad87c16ff74ac6c88 |
File details
Details for the file ProdNet-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: ProdNet-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e9b2f2d1858b873dce7cd4d9715921ba1957cf40aee9326e3ea20515fac22e8 |
|
MD5 | 427081df8bd5bcc647aec169c1cab40d |
|
BLAKE2b-256 | 5850e53e433a21f1cf98fba8064533625af266756cb9ed77941520f7bd2423e4 |