Closed pathfinder49 closed 5 years ago
Surely there is a suitable function already available somewhere (scipy.stats.poisson.pmf
maybe)?
If not, to avoid issues with numerical precision without having to resort to numerical integration, you might want to calculate the logarithm of the PMF (using gammaln
, xlog1py
, etc.) and then only exponentiate if needed (which isn't the case for a maximum-likelihood fit).
Also, note that for small errors, our readout schemes are not well-described by a sum of two Poissonians because of the limited shelf lifetime, so the usefulness of the extra precision afforded by p_bright
/… is limited.
(Edit: In particular, this, depending on the system collection efficiency and 854/850 leakage, tends to bias the optimal collection time quite significantly towards shorter times.)
See Alice Myerson (née Burrell)'s thesis for a discussion of time-resolved MLE methods, which you might also want to reference for the expression in calc_thresh_rate
.
Surely there is a suitable function already available somewhere (
scipy.stats.poisson.pmf
maybe)?If not, to avoid issues with numerical precision without having to resort to numerical integration, you might want to calculate the logarithm of the PMF (using
gammaln
,xlog1py
, etc.) and then only exponentiate if needed (which isn't the case for a maximum-likelihood fit).
scipy.stats.poisson.pmf
does what I need now. I originally thought I might want to integrate over the poisson distribution, which is why I cared about the non integer generalisation (scipy.stats.poisson.pmf
returns zero for non integer n).
Also, note that for small errors, our readout schemes are not well-described by a sum of two Poissonians because of the limited shelf lifetime, so the usefulness of the extra precision afforded by
p_bright
/… is limited.(Edit: In particular, this, depending on the system collection efficiency and 854/850 leakage, tends to bias the optimal collection time quite significantly towards shorter times.)
I'm aware of this, but thought this would be a good starting point. Lab3 will need this in future, though we're not worried about it yet.
See Alice Myerson (née Burrell)'s thesis for a discussion of time-resolved MLE methods, which you might also want to reference for the expression in
calc_thresh_rate
.
I'll take a look at it.
@dnadlinger are you happy for this to be merged?
Sure (personally I think the usefulness is limited, but it's still good to have a documented place for that one threshold formula). Merged as 0dd1a86e8011419818db7bac0221b43658eaaebe without the Poisson reimplementation, as that currently isn't used by threshold
. (What was the conclusion on the discrepancy you mentioned?)
API docs now at: https://oxfordiontrapgroup.github.io/oitg/threshold.html
Formatting could use some work – see https://oxfordiontrapgroup.github.io/oitg/circuits.html#module-oitg.circuits.protocols.gst for inspiration regarding how to make inline math work. I might get to this at some point later if you don't have time now.
Assumes Poisson distributed bright and dark state. Implents two ways of calculating larger poisson distribution. These allow accurate calculation of poisson probabilaties for n>10. A naive implementation of P(n) breakes down at n=10.