apply_poisson_noise#
- photutils.datasets.apply_poisson_noise(data, seed=None)[source]#
Apply Poisson noise to an array, where the value of each element in the input array represents the expected number of counts.
Each pixel in the output array is generated by drawing a random sample from a Poisson distribution whose expectation value is given by the pixel value in the input array.
- Parameters:
- dataarray_like
The array on which to apply Poisson noise. Every pixel in the array must have a positive value (i.e., counts).
- seedint, optional
A seed to initialize the
numpy.random.BitGenerator
. IfNone
, then fresh, unpredictable entropy will be pulled from the OS.
- Returns:
- result
ndarray
The data array after applying Poisson noise.
- result
See also
Examples
import matplotlib.pyplot as plt from photutils.datasets import (apply_poisson_noise, make_4gaussians_image) data1 = make_4gaussians_image(noise=False) data2 = apply_poisson_noise(data1, seed=0) # plot the images fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(8, 8)) ax1.imshow(data1, origin='lower', interpolation='nearest') ax1.set_title('Original image') ax2.imshow(data2, origin='lower', interpolation='nearest') ax2.set_title('Original image with Poisson noise applied')
(
Source code
,png
,hires.png
,pdf
,svg
)