This package implements the models presented in Fumagalli et al. (2020) (note, that the version from 2020 is implemented). Additionally, extensions from the models are explained in Extension of Fumagalli et al (2020).pdf.
You can either install the package (functionality only) or download the whole repository (with documentation and assets).
Install the latest release from PyPi:
$ pip install Fumagalli-Motta-Tarantino-2020
Or install this package directly from source:
$ pip install git+https://github.com/manuelbieri/Fumagalli_2020.git
The necessary dependencies are automatically installed during the setup.
If you would like to get the whole repository, download it here or clone it with GIT (requires GIT installation):
$ git clone https://github.com/manuelbieri/Fumagalli_2020.git
Install the dependencies for the repository with the following command (Note: Make sure you are operating in the same directory, where the
requirements.txt
is located.):
$ pip install -r requirements.txt
Note: This package requires a working latex installation for the plots!
import Fumagalli_Motta_Tarantino_2020 as FMT20
# initialize the model (here you can adjust the parameters of the model)
# all other models conform to the interface defined in FMT20.OptimalMergerPolicy
model: FMT20.OptimalMergerPolicy = FMT20.OptimalMergerPolicy()
# print a summary of the outcome
print(model.summary())
# plot a model overview
FMT20.Overview(model).show()
# open the API-documentation
FMT20.docs()
# open the GitHub-repository
FMT20.repo()
A tutorial is included with the notebook Tutorial.ipynb. Additionally, find the latest documentation including all the details on manuelbieri.ch/fumagalli_2020.
Note: mybinder.org is currently not supported, since this package needs at least python 3.9.
This sections provides a quick overview for this repository.
Additional files about the code style (scripts), class diagram and a more detailed project overview (Fumagalli_Motta_Tarantino_2020.Project).
Contains the files of the automatically generated API - documentation
Contains the actual code of the package. See Fumagalli_Motta_Tarantino_2020.Models and Fumagalli_Motta_Tarantino_2020.Visualizations for the available models and visualization options. In Fumagalli_Motta_Tarantino_2020.Notebooks are some jupyter notebooks included (e.g., Interactive.ipynb or Tutorial.ipynb).
Run the unittests shipped in Fumagalli_Motta_Tarantino_2020.Tests with the following command (pay attention to the current working directory):
$ python -m unittest discover Fumagalli_Motta_Tarantino_2020.Tests
For explanations about the tests, have a look at Fumagalli_Motta_Tarantino_2020.Tests. See codecov.io for a detailed report about the test coverage.
As the default code style Black is used and
automatically checked and enforced by GitHub - workflows. To run black in the terminal either run assets/code style/run_black.sh
or use the following command:
$ python -m black ./Fumagalli_Motta_Tarantino_2020
This command modifies the source code if the preset rules are not met. You can as well just check, whether the rules are met or not with assets/code style/check_black.sh
or:
$ python -m black ./../../Fumagalli_Motta_Tarantino_2020 --diff
$ pdoc -o docs Fumagalli_Motta_Tarantino_2020 --docformat numpy --math
or run the shell-script docs/build.sh
in the terminal.