An object-oriented python package for structural path analysis
pyspa is an object-oriented python package which enables you to conduct a parametric structural path analysis on square A matrices (process or input-output) for any number of environmental, social or economic satellites and for any number of stages upstream in your supply chain (as long you have enough RAM). The package produces a SupplyChain object which includes Pathway and Node objects. Results can be exported to the csv format with a single line of code.
The concept behind pyspa was driven by the lack of open source code to conduct structural path analysis in a robust and object-oriented manner.
You will need python to run this package as well as the following python packages:
Download and install the package from pip
pip install pyspa
Identify the template files in the installed directory, or download them directly from the github repository. The template files include:
Once you have located these files, you need to run a single function that will read the data, conduct the structural path analysis and return a SupplyChain object, as per the following code.
sc = pyspa.get_spa(target_id = 78, max_stage = 6, a_matrix_file_path ='A_matrix_template.csv', infosheet_file_path='Infosheet_template.csv', thresholds_file_path='Thresholds_template.csv')
This will return your SupplyChain object which has numerous methods. Read the documentation for more information.
To export the structural path analysis to a csv file, use the built-in method.
To save your SupplyChain object and avoid having to recalculate everything (this uses pickle):
To load a previously saved SupplyChain object:
loaded_sc = pyspa.load_instance_from_file('supply_chain.sc', pyspa.SupplyChain)
Authors and contributors
+AndrÃ© Stephan - overall design, implementation, testing and debugging - ORCID +Paul-Antoine Bontinck - optimisation, implementation, testing and debugging - ORCID ###Contributors +Robert H Crawford - project leader and theoretical guidance - ORCID
This project is shared under a GNU General Public License v3.0. See the LICENSE.md file for more information.
This project was funded by the Australian Research Council Discovery Project DP150100962 at the University of Melbourne, Australia. As such, we are endebted to Australian taxpayers for making this work possible and to the University of Melbourne for providing the facilities and intellectual space to conduct this research. The code for the base method for conducting the structural path analysis is inspired from the code of late A/Prof Graham Treloar at the University of Melbourne, who pioneered a Visual Basic Script in his PhD thesis to conduct a structural path analysis in 1997.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyspa-1.4-py3-none-any.whl (79.2 kB)||File type Wheel||Python version py3||Upload date||Hashes View|