Skip to content

scienxlab/unmap

Repository files navigation

unmap

Run tests Build docs PyPI version PyPI versions PyPI license

Unmap data from pseudocolor images, with or without knowledge of the colourmap. This tool has 2 main components:

  1. Guess the colourmap that was used for a pseudocolour visualization, in cases where it's unknown and a colourbar is not included in the image.
  2. 'Unmap' a pseudocolour visualization, separating the data from the image; essentially this is the opposite of what plt.imshow() does.

Similar projects

There are some other approaches to both Task 1 (above) and Task 2:

  • unmap (I swear I didn't know about this tool when I named mine!) — does the data ripping part. The colourmap must be provided, but the tool also provides a way to interactively identify a colourbar in the image.
  • Poco et al. (GitHub) attempts to both find the colourbar in a visualization, then use it to perform Task 2. The visualization must contain a colourbar.
  • Yuan et al. attempts Task 1 using deep learning. The prediction from a CNN is refined with either Laplacian eigenmapping (manifold+based dimensionality reduction, for continuous colourmaps) or DBSCAN (for categorical colourmaps).

Of these projects, only Yuan et al. ('deep colormap extraction') requires no a priori knowledge of the colourmap.

Stack Exchange questions about this topic

Installation

You can install this package with pip:

pip install unmap

There are dev, test and docs options for installing dependencies for those purposes, eg pip install unmap[dev].

Documentation

Read the documentation, especially the examples.

Contributing

Take a look at CONTRIBUTING.md.

Testing

After cloning this repository and installing the dependencies required for testing, you can run the tests (requires pytest and pytest-cov) with

pytest

Building

This repo uses PEP 517-style packaging, with the entire build system and requirements defined in the pyproject.toml file. Read more about this and about Python packaging in general.

Building the project requires build, so first:

pip install build

Then to build unmap locally:

python -m build

The builds both .tar.gz and .whl files, either of which you can install with pip.