Exercise 1: Binomial to Poisson Convergence — Quantitative¶
Task: For , compute the maximum absolute difference between Binomial(, ) and Poisson() PMFs for . Plot the max difference vs on a log-log scale. What is the convergence rate?
Hint: Use binom.pmf and poisson.pmf from scipy.stats. Evaluate over .
Expected output: A log-log plot showing approximately convergence.
Your task¶
Implement the convergence measurement:
For each n, compute both
Binomial(n, λ/n)andPoisson(λ)PMFs over the same k rangeTake the maximum absolute difference across all k values
Collect results and plot on a log-log scale
Fit a line to estimate the convergence rate (slope ≈ -1 means O(1/n))
Exercise 2: Variance-Stabilising Transform¶
Task: The Poisson distribution has signal-dependent noise (). The Anscombe transform approximately stabilises the variance, making it constant regardless of . This transform is used in fluorescence microscopy and astronomical imaging before applying Gaussian denoisers — it converts Poisson-distributed data into a form where standard Gaussian denoising pipelines (NLM, BM3D, Wiener) are valid.
Generate Poisson samples for (10,000 samples each)
Apply the Anscombe transform to each set
Compare the variance before and after the transform
Plot histograms showing how the transform makes all three distributions have similar spread
Hint: After the Anscombe transform, the variance should be approximately 1 for all values.
Expected output: Three pairs of histograms (before/after) showing variance stabilisation.
Your task¶
Implement the Anscombe variance stabilization:
Generate Poisson samples for each λ and compute the raw variance
Apply
f(x) = 2√(x + 3/8)element-wiseCompute the variance of the transformed samples — it should be ≈ 1 for all λ
Plot raw variance vs λ (should grow as λ) and transformed variance vs λ (should be flat)
Exercise 3: Build Your Own Noise Budget¶
Task: You are building an image denoising pipeline for industrial inspection. Given these sensor specs:
Scene illumination: 200 photons/µm²/exposure
Photosite pitch: 3.45 µm (Basler acA1920-40gm)
Quantum efficiency: 0.65
Read noise: 4 electrons
Dark current: 2 electrons (cooled sensor)
Full well: 11,000 electrons
Bit depth: 12
Compute the expected electron count per pixel
Compute each noise source’s contribution (variance)
Compute the total noise and SNR at different signal levels
Determine where Gaussian denoising is valid vs. where Anscombe pre-processing is needed (hint: at what signal level does Poisson ≈ Normal?)
Simulate 10,000 exposures and verify your calculations match
Hint: Photosite area = pitch², expected electrons = flux × area × QE. Gaussian denoising is valid when (typically ).
Expected output: A noise budget table, SNR vs. signal level plot, and histogram confirming theoretical predictions.
Your task¶
Build the noise budget:
Compute expected electron count from photon flux, pixel area, and QE
Sum noise variances: shot + read + dark
Compute SNR = signal / σ_total
Determine the signal level at which shot noise exceeds read noise (the read-noise limit)
Simulate a histogram matching the theoretical distribution and plot both
Exercise 4: CLT Convergence for Different Distributions¶
Task: The CLT convergence rate depends on the skewness of the original distribution. Distributions with higher skewness need more samples to converge.
Generate samples from: Uniform(0,1), Exponential(1), and Pareto(2, 1) — each with increasing skewness
For each, compute the sum of samples for
Measure the KS distance from Gaussian for each case
Plot convergence rate vs for all three distributions
Hint: scipy.stats.kstest(standardised_data, 'norm') gives the KS statistic.
Expected output: Higher-skewness distributions need more terms to converge (Pareto slowest, Uniform fastest).
Your task¶
Implement the skewness-vs-convergence analysis:
For each distribution, compute skewness analytically or from samples
For each n, draw normalized sums and run the KS test against N(0,1)
Plot KS distance vs n for all three distributions on one log-log axes
Rank the distributions by convergence speed and relate to their skewness values