Skip to main content

Unmap data from pseudocolor images.

Project description

unmap

Run tests Build docs PyPI version PyPI versions PyPI license

Unmap data from pseudocolor images, with knowledge of the colourmap (for now!).

Installation

You can install this package with pip:

pip install unmap

Documentation

Read the documentation

Example

We'll grab an image from the web and unmap it:

def get_image_from_web(uri):
    data = requests.get(uri).content
    img = Image.open(BytesIO(data)).convert('RGB')
    rgb_im = np.asarray(img)[..., :3] / 255.
    return rgb_im

# An image from Matteo Niccoli's blog:
# https://mycartablog.com/2014/08/24/what-your-brain-does-with-colours-when-you-are-not-looking-part-1/
img = get_image_from_web('https://i0.wp.com/mycartablog.com/wp-content/uploads/2014/03/spectrogram_jet.png')

import gio

data = gio.unmap(img, cmap='jet')
plt.imshow(data)

Testing

You can run the tests (requires pytest and pytest-cov) with

pytest

Building

This repo uses PEP 517-style packaging. 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.

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

unmap-0.1.0.tar.gz (1.8 MB view hashes)

Uploaded Source

Built Distribution

unmap-0.1.0-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

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