NOTE: In this notebook I use the stats
sub-module of scipy
for all statistics functions, including generation of random numbers. There are other modules with some overlapping functionality, e.g., the regular python random module, and the scipy.random
module, but I do not use them here. The stats
sub-module includes tools for a large number of distributions, it includes a large and growing set of statistical functions, and there is a unified class structure. (And namespace issues are minimized.) See https://docs.scipy.org/doc/scipy/reference/stats.html.
import numpy as np
from scipy import stats
If we use the minute as our unit of time, the determination of the mean count rate is trivial: it's $R = 270\, \mbox{min$^{−1}$}$. If we choose seconds, it's only slightly less trivial: $R=270/60 = 4.5\, \mbox{s$^{−1}$}$.
We are sampling from a Poisson distribution, so the error given, by the standard deviation, is $\sigma = \sqrt{\bar \mu}$:
sigma = np.sqrt(270)
print('sigma (min^-1) =', sigma, '; sigma (s^-1) = ', sigma/60)
print('fractional error =', sigma/270)
n_expected = 15*270
print('expected in 15 minutes =', n_expected)
The probability of actually getting this number of counts is given by the probability mass function of the Poisson distribution:
probability = stats.poisson.pmf(n_expected,n_expected)
print('probability of getting exactly', n_expected,' counts =', probability)
version_information
is from J.R. Johansson (jrjohansson at gmail.com); see Introduction to scientific computing with Python for more information and instructions for package installation.
version_information
is installed on the linux network at Bucknell
%load_ext version_information
version_information numpy, scipy