Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
svaberg committed Dec 3, 2019
2 parents 7486080 + e9b7fe7 commit 561baa9
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.ipynb_checkpoints/*
.idea
.DS_Store
__pycache__/
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: python
python:
- "3.5"
install:
- sudo apt-get update
# We do this conditionally because it saves us some downloading if the
# version is the same.
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda config --add channels conda-forge
- conda config --set channel_priority strict
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a

- conda env create -n test-environment python=$TRAVIS_PYTHON_VERSION -f environment.yml
- source activate test-environment

script:
- py.test --nbval
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
![The image slurper](img/imageslurper.small.png)
# ![The image slurper](img/imageslurper.small.png)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/svaberg/imageslurper)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.com/svaberg/imageslurper.svg?branch=master)](https://travis-ci.com/svaberg/imageslurper)

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!
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.

Expand All @@ -17,21 +18,23 @@ Use the mouse to indicate the image area and colorbar area:
<img src="demo/demo.gif" alt="Image slurper demo"/>
</p>


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

```python
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](img/world-temp.jpg-reconstructed-viridis.png)
![inferred errors](img/world-temp.jpg-reconstructed-error.png)

## Comparison with original

The reconstructed image can be plotted using the same colorbar as the original image:
![reconstructed image in original color scale](img/world-temp.jpg-reconstructed-original_colormap.png)

Expand Down
7 changes: 7 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: imageslurper
dependencies:
- numpy
- matplotlib
- pillow
- jupyter
- nbval
Binary file modified img/imageslurper.small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions rectangle_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

import PIL.Image

_boxes = [Rectangle((1, 1), 0, 0, facecolor='green', edgecolor='green', alpha=0.4),
Rectangle((1, 1), 0, 0, facecolor='blue', edgecolor='blue', alpha=0.4)]
# The default rectangles and positions here are chosen to match the default
# slurp target used in imageslurper.ipynb.
_boxes = [Rectangle((50, 50), 950, 500, facecolor='green', edgecolor='green', alpha=0.4),
Rectangle((150, 560), 750, 16, facecolor='blue', edgecolor='blue', alpha=0.4)]

_user_box_count = 0

Expand Down

0 comments on commit 561baa9

Please sign in to comment.