Skip to main content

An object-oriented python package for structural path analysis

Project description

pyspa

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.

Getting Started

Prerequisites

You will need python to run this package as well as the following python packages:

  1. numpy
  2. pandas

Installing

Download and install the package from pip pip install pyspa

Testing pyspa

Identify the template files in the installed directory, or download them directly from the github repository. The template files include:

  1. A_matrix_template.csv
  2. Infosheet_template.csv
  3. Thresholds_template.csv

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.

sc.export_to_csv('spa_results.csv

To save your SupplyChain object and avoid having to recalculate everything (this uses pickle):

sc.save('supply_chain.sc')

To load a previously saved SupplyChain object:

loaded_sc = pyspa.load_instance_from_file('supply_chain.sc', pyspa.SupplyChain)

Built with:

+pycharm +sourcetree +Sweat, tears, Belgian beers, and coffee from Castro's

Authors and contributors

Authors

+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

License

This project is shared under a GNU General Public License v3.0. See the LICENSE.md file for more information.

Acknowledgments

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyspa, version 1.4
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 hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page