Code Monkey home page Code Monkey logo

magnets's Introduction

MAGNets

https://travis-ci.com/meghnathomas/MAGNets.svg?branch=master Documentation Status PyPI - Downloads

A Python package to aggregate and reduce water distribution network models

Overview

MAGNets (Model AGgregation and reduction of water distribution Networks) is a Python package designed to perform the reduction and aggregation of water distribution network models. The software is capable of reducing a network around an optional operating point and allows the user to customize which junctions they would like retained in the reduced model. MAGNets' reduction approach is based on the variable elimination method proposed by Ulanicki et al (1996).

Installation: Stable release

Python distributions, such as Anaconda, are recommended to manage the Python environment as they already contain (or easily support the installation of) many Python packages (such as SciPy and NumPy) that are used in the MAGNets package.

To install MAGNets, run this command in your terminal:

pip install magnets

This is the preferred method to install MAGNets, 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.

Installation: From sources

The sources for MAGNets can be downloaded from the Github repo.

You can either clone the public repository:

git clone git://github.com/meghnathomas/magnets

Or download the tarball:

curl -OJL https://github.com/meghnathomas/magnets/tarball/master

Once you have a copy of the source, you can install it with:

python setup.py install

Getting Started

Use this jupyter notebook to run some useful examples of MAGNets. Additional example codes and 12 test networks can be found in the examples and publications folders.

To use MAGNets in a project, open a Python IDE and import the package using the following command:

import magnets as mg

The user can then call on the following function to reduce a hydraulic model of a water distribution network.

wn2 = mg.reduction.reduce_model(inp_file, op_pt, nodes_to_keep, max_nodal_degree)

The parameters of the reduce_model function are described as follows:

  1. inp_file: the EPANET-compatible .inp file of the water distribution network model.
  2. op_pt: (optional, default = 0) the operating point, or the reporting time step of the hydraulic simulation at which the non-linear headloss equations are linearized.
  3. nodes_to_keep: (optional, default = []) a list of nodes the user wishes to retain in the reduced model.
  4. max_nodal_degree: (optional, default = None) the maximum nodal degree of nodes being removed from the model. The nodal degree of a node is equal to the number of pipes incident to the node.

wn2 contains the water network model object of the reduced model. A .inp file of the reduced model is also written into the directory that contains the .inp file of the original network.

Requirements

MAGNets has been tested on Python version 3.6, 3.7, and 3.8. It requires the installation of the following dependencies:

  • wntr >= 0.3.0
  • numpy
  • scipy
  • pandas
  • matplotlib
  • networkx
  • cycler
  • decorator
  • kiwisolver
  • Pillow
  • pyparsing
  • python-dateutil
  • pytz
  • six

Contact

Meghna Thomas - [email protected]

Lina Sela - [email protected]

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

magnets's People

Contributors

meghnathomas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.