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() ← Six days and counting Simon Singh sued → Please enable JavaScript to view the comments powered by Disqus. comments powered by Disqus