pyfli.analysis.precision.fisher_crlb#

Generic Fisher information and Cramér-Rao lower bound (CRLB) tools.

Functions

crlb_covariance(info)

Cramér-Rao bound on the covariance, I^-1 per batch entry.

crlb_cv(info, value, index)

Smallest achievable coefficient of variation std / value of parameter index.

crlb_std(info, index)

Smallest achievable standard deviation of parameter index, per batch entry.

estimator_efficiency(cv_measured, cv_bound)

Statistical efficiency (cv_bound / cv_measured) ** 2: 1 when an estimator reaches the CRLB, smaller otherwise (a biased estimator can exceed 1).

f_value(cv, n_photons)

Photon-economy F-value CV * sqrt(N): 1 for an ideal photon-counting measurement, larger for any real instrument or estimator.

fisher_information(model, params[, noise, ...])

Fisher matrices (P, K, K) of a batched model at params (P, K).

gaussian_fisher_information(sigma, jacobian)

Fisher matrices (P, K, K) for independent Gaussian channels with known noise standard deviation sigma (scalar, (T,) or (P, T)).

numerical_jacobian(model, params[, ...])

Central-difference Jacobian dmu/dtheta of a batched model.

poisson_fisher_information(mu, jacobian)

Fisher matrices (P, K, K) for independent Poisson channels with means mu (P, T) and Jacobian (P, K, T).

select_parameters(info, indices)

Fisher sub-matrices for the parameters in indices, i.e. the information when every other parameter is known exactly and not estimated.

numerical_jacobian(model, params, rel_step=1e-4, abs_step=1e-8)[source]#

Central-difference Jacobian dmu/dtheta of a batched model.

Parameters:
  • model (Callable) – model(params) with params (P, K) returning channel means (P, T).

  • params (np.ndarray) – Parameter vectors (P, K) (or (K,) for a single one).

  • rel_step (float) – Step for parameter k is max(rel_step * |theta_k|, abs_step).

  • abs_step (float) – Step for parameter k is max(rel_step * |theta_k|, abs_step).

Returns:

Jacobian of shape (P, K, T).

Return type:

np.ndarray

poisson_fisher_information(mu, jacobian)[source]#

Fisher matrices (P, K, K) for independent Poisson channels with means mu (P, T) and Jacobian (P, K, T). Channels with mu <= 0 carry no information and are skipped.

Parameters:
Return type:

ndarray

gaussian_fisher_information(sigma, jacobian)[source]#

Fisher matrices (P, K, K) for independent Gaussian channels with known noise standard deviation sigma (scalar, (T,) or (P, T)).

Parameters:
Return type:

ndarray

fisher_information(model, params, noise='poisson', sigma=None, jacobian=None, rel_step=1e-4, abs_step=1e-8)[source]#

Fisher matrices (P, K, K) of a batched model at params (P, K).

Parameters:
  • model (Callable) – model(params) -> channel means (P, T).

  • params (np.ndarray) – Parameter vectors (P, K).

  • noise (str) – "poisson" (counts; the means come from the model) or "gaussian" (needs sigma).

  • sigma (Any) – Noise standard deviation for noise="gaussian".

  • jacobian (np.ndarray | None) – Analytic Jacobian (P, K, T); computed numerically when None.

  • rel_step (float) – Finite-difference steps (see numerical_jacobian()).

  • abs_step (float) – Finite-difference steps (see numerical_jacobian()).

Return type:

ndarray

select_parameters(info, indices)[source]#

Fisher sub-matrices for the parameters in indices, i.e. the information when every other parameter is known exactly and not estimated.

Parameters:
Return type:

ndarray

crlb_covariance(info)[source]#

Cramér-Rao bound on the covariance, I^-1 per batch entry. A (near-)singular Fisher matrix – an unidentifiable parameter – falls back to the pseudo-inverse.

Parameters:

info (ndarray)

Return type:

ndarray

crlb_std(info, index)[source]#

Smallest achievable standard deviation of parameter index, per batch entry.

Parameters:
Return type:

ndarray

crlb_cv(info, value, index)[source]#

Smallest achievable coefficient of variation std / value of parameter index.

Parameters:
Return type:

ndarray

f_value(cv, n_photons)[source]#

Photon-economy F-value CV * sqrt(N): 1 for an ideal photon-counting measurement, larger for any real instrument or estimator. Applies equally to a measured CV and to a CRLB CV.

Parameters:
Return type:

ndarray

estimator_efficiency(cv_measured, cv_bound)[source]#

Statistical efficiency (cv_bound / cv_measured) ** 2: 1 when an estimator reaches the CRLB, smaller otherwise (a biased estimator can exceed 1).

Parameters:
  • cv_measured (Any)

  • cv_bound (Any)

Return type:

ndarray