hernanat / dcolor

Python Based Domain Coloring
34 stars 9 forks source link

DColor: A Domain Coloring Python Module

What is DColor?

DColor is a Python 3 module for visualizing complex-valued functions using a Domain Coloring scheme.

Requirements

DColor leverages two well-known Python libraries: NumPy and Matplotlib.

Old (pip)

Before being able to use DColor, you must install these using the following commands:

python3 -m pip install -U numpy
python3 -m pip install -U matplotlib
git clone https://github.com/hernanat/dcolor.git

New (poetry)

For development, first, install poetry. Typically, this involves installing pipx followed by pipx install poetry. Arch-based systems can also install the python-poetry package.

Clone the repository and run poetry install. This will install the project and its requirements to a clean virtual environment which can be accessed through poetry shell.

git clone https://github.com/hernanat/dcolor.git
poetry install
poetry shell

Examples

Note that python commands in this section should be run inside the virtual environment.

Default

python dcolorExample.py

It generates a series of examples. When each image appears clicking the close button starts the next example. Lambda expressions are used to define and pass functions to the plot() function. The last example is:

dc.plot(lambda z : ((z**2-1)*(z-2- 1j)**2)/(z**2 +2+ 2j),
    title='((z**2-1)*(z-2- 1j)**2)/(z**2 +2+ 2j)')

Which results in the following plot:

dcolor example

hsvcolor

This is like dcolor except that it does not convert the HSV image to RGB

python hsvcolorExample.py

Will create the images. The last image produces:

hsvcolor example

rgbcolor

This is designed to show the magnitude of abs(z). White means big, shades of green means intermediate, and black means small.

python rgbcolorExample.py

Will create the images. The last image produces:

rgbcolor example

Website and Documentation

Currently, this is a one-person project and so these are still under construction. Contact me by e-mail at roguegdi27@gmail.com if you would like to help out with anything.

Contributing

If you are interested in contributing or have any suggested changes, clone the repo and make a pull request :)