Skip to main content

description for polyphy

Project description

header_narrow

PolyPhyHub - PolyPhy License issues - PolyPhy Python Package image Documentation Status REUSE status

PolyPhy

PolyPhy is an unconventional toolkit for reconstructing continuous networks out of sparse 2D or 3D data. Such data can be defined as collections of discrete points, or a continuous sparse scalar field. PolyPhy produces a scalar density field that defines the recovered network structure. With the help of GPU-accelerated simulation and visualization, PolyPhy provides domain experts an interactive way to reconstruct discrete geometric data with an underlying network structure. The reconstruction is driven by the Monte Carlo Physarum Machine algorithm, a metaheuristic inspired by the morphology and dynamics of Physarum polycephalum aka 'slime mold'.

Related Resources

System Requirements

  • Decent GPU, recommended a mid-range discrete one
    • currently running best on NVIDIA GPUs, other brands supported as well (subject to the current capabilities of the Taichi API)
    • CPU fallback available for debugging purposes
  • Recent Windows, Linux or Mac OS
  • Python 3.x, Anaconda recommended

Repository

The main repository is located at the following GitHub URL:
https://github.com/PolyPhyHub/PolyPhy.git

The other repositories are linked from the following "org" page:
https://github.com/PolyPhyHub/

Running PolyPhy

Please note the project is currently undergoing refactoring in order to streamline the use of the software in CLI, improve its modularity (making it easier to implement custom pipelines and extend the existing ones), and add new features (such as the recent addition of batch mode).

To install PolyPhy, clone this repository, open a Python console, navigate to the root of the repo, and run

pip install -r requirements.txt

Afterwards, navigate to ./src/polyphy and run

python polyphy.py 2d_discrete -f "data/csv/sample_2D_linW.csv"

for the standard 2D pipeline using the provided sample 2D dataset, or

python polyphy.py 3d_discrete -f "data/csv/sample_3D_linW.csv"

to invoke the standard 3D discrete pipeline on sample data. You can also specify a custom CSV file (see the sample data for the format details, typically the data are tuples with 2 or 3 spatial coorinates followed by weights for each data point). The functionality of these pipelines is described below.

To display help on the available CLI parameters, simply run the respective command without any arguments.

There is also a number of Jupyter notebooks implementing various experiemtal pipelines (some of which are documented below). These are updated to different degrees, and we are in the process of porting them to the refactored class structure. Updates coming soon.

Functionality

The use-cases currently supported by PolyPhy are divided according to the data workflow they are built around. Each use case has a corresponding (extensible) pipeline specified as a command line parameter under its name. Experimental pipelines not yet implemented in the main build are located in ./experiments/Jupyter. This section reviews them case by case, and the following section provides an extensive tutorial recorded at the recent OSPO Symposium 2022.

  • 2D self-patterning is the most basic use-case implemented within the 2d_discrete pipeline. The ability of MCPM to generate a diversity of patterns with network characteristics is achieved by disabling the data marker deposition, leaving only the MCPM agents to generate the marker responsible for maintaining structure.

    2D_self-patterning

  • 2D procedural pipeline provide an easy environment to experiment with the behavior of PolyPhy in the presence of discrete data with different spatial frequencies. Editing (adding new data points) is also supported. This is invoked by specifying 2d_discrete pipeline without providing any input data file, thus prompting PolyPhy to generate the data procedurally.

    2D_discrete_procedural

  • 2D discrete pipeline implements the canonical way of working with custom data defined by a CSV file. The example below demonstrates fitting to a 2D projection of the SDSS galaxy dataset. It is invoked by specifying 2d_discrete pipeline and a custom input data file.

    2D_discrete_explicit

  • 2D continuous pipeline demonstrates the workflow with a continuous user-provided dataset. Instead of a discrete set of points as in the previous use-cases, the data is defined by a scalar field, which in 2D amounts to a grayscale image. The example below approximates the US road network using only a sparse population density map as the input. This pipeline is implemented in the ./experiments/Jupyter/PolyPhy_2D_continuous_data notebook, to be ported to the main build.

    2D_continuous

  • 3D discrete pipeline represents an equivalent functionality to the original Polyphorm implementation. The dataset consists of SDSS galaxies defined as a weighted collection of 3D points. The visualization is based on volumetric ray marching simultaneously fetching the deposit and the trace fields. This pipeline is invoked through the 3d_discrete parameter.

    3D_discrete_explicit

How to Use PolyPhy

Below is a recording of the PolyPhy Workshop given as part of the OSPO Symposium 2022.
This 90-minute workshop covers PolyPhy's research background, all of the 5 above usecases, and extended technical discussion.

Services

Tox

Tox is a virtual environment management and test tool that allows you to define and run custom tasks that call executables from Python packages. Tox will download the dependencies you have specified, build the package, install it in a virtual environment and run the tests using pytest. Make sure to install tox in the root of your project if you intend to work on the development.

tox # download dependencies, build and install package, run tests
tox -e docs  # to build your documentation
tox -e build  # to build your package distribution
tox -e publish  # to test your project uploads correctly in test.pypi.org
tox -e publish --repository pypi  # to release your package to PyPI
tox -av  # to list all the tasks available

GitHub Actions

GitHub Actions is being used to test on MacOs as well as Linux. It allows for the automation of the building, testing, and deployment pipline.

Codecov

A service that generates a visual report of how much code has been tested. All configuration settings can be found in the codecov.yml file.

Appveyor

A service that can be used to test Windows. All configuration settings can be found in the appveyor.yml file.

Project details


Download files

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

Source Distribution

PolyPhyPy-0.0.1.tar.gz (10.2 MB view details)

Uploaded Source

Built Distribution

PolyPhyPy-0.0.1-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file PolyPhyPy-0.0.1.tar.gz.

File metadata

  • Download URL: PolyPhyPy-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for PolyPhyPy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 771fd6be4315d1f3a6929dacf3153700299244018a7996ff731e7be0e7560663
MD5 0d059ec08a44cb8abebc3da4deddd5b4
BLAKE2b-256 2258e1950e22c379a742e8ea881055495ccdd88cdbe3c593014a425ac7d2c91d

See more details on using hashes here.

File details

Details for the file PolyPhyPy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: PolyPhyPy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for PolyPhyPy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5bc81cda1bb787e862a1dc8e2c1db4c32fcc9bac7752981bb84cdeaee78edd8
MD5 b635e300dc298918042975c284374ff4
BLAKE2b-256 5caf62a5f52cd6fddde4ab99d4caa5f898c3789b7b46f51c0d35de868b01aaa6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page