Skip to content

Reconstruct data from 2D false-color/heatmap plots and their colorbars

License

Notifications You must be signed in to change notification settings

svaberg/imageslurper

Repository files navigation

The image slurper

Build Status Codacy Coverage Codacy Grade GitHub release (latest by date) License: MIT

Are you tired of asking people for the data behind their published false color plots? Use the image slurper to find the underlying matrix of values from a false-color (heat map) image and its colorbar!

The image slurper can be used on many types of false color plots, and works best on relatively smooth data.

The image slurper is a Jupyter notebook that takes a a false-color image like this one:

original false color image

Use the mouse to indicate the image area and colorbar area:

Image slurper demo

and let the image slurper find the original pixel values by comparing each pixel to the colors of the colorbar, giving a numpy array

array([[232.39477504, 234.42670537, 234.86211901, ..., 234.86211901,
        234.42670537, 233.84615385],
       ...,
       [206.85050798, 207.28592163, 207.57619739, ..., 208.30188679,
        207.28592163, 209.17271408]])

and an associated error estimate, which cmay be plotted with matplotlib: inferred values inferred errors

Comparison with original

The reconstructed image can be plotted using the same colorbar as the original image: reconstructed image in original color scale

For a well executed slurp the input image plot areas should be visually indistinguishable from the result plot area.

The brute force algorithm used is based on this Stack Overflow answer: "Digitize a colormap".