Surveying the Universe
Visualizing noisy images
You have an image. Each pixel has a value with some uncertainty. How do you visualize the uncertainty in each pixel? Like this:
Here’s the Python code
import numpy as np from matplotlib import pyplot as plt class FlickerImage(object): def __init__(self, im, err): self.im = im.copy() self.err = err.copy() finite = np.isfinite(self.im + self.err) self.vmin = (self.im - 2 * self.err)[finite].min() self.vmax = (self.im + 2 * self.err)[finite].max() self.im[np.invert(finite)] = self.vmax self.err[np.invert(finite)] = 0 def flicker(self): fg = plt.imshow(np.zeros(self.im.shape), interpolation='nearest', vmin=self.vmin, vmax=self.vmax) while True: ran = np.random.normal(size=im.shape) fg.set_data(im + err * ran) plt.draw()
And here’s an example script:
import pyfits f = pyfits.open('file.fits') im = f["IMAGE"].data err = f["ERROR"].data flicker_image = FlickerImage(im, err) flicker_image.flicker()
| Print article | This entry was posted by Anthony on 13 May 2009 at 12.51 pm, and is filed under Computing. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

I am a research fellow in