uncertainty package#
Submodules#
PyHydroGeophysX.uncertainty.posterior module#
Posterior covariance and uncertainty propagation helpers.
- PyHydroGeophysX.uncertainty.posterior.linearized_posterior(J: Any, Cd: Any, Cm_prior: Any) Any[source]#
Compute linearized Gaussian posterior covariance:
Cm_post = (J^T Cd^-1 J + Cm_prior^-1)^-1
None of the three inverses in that expression is formed. Each is applied as a Cholesky solve instead, and the result is symmetrized before it is returned. This is a correctness matter, not a speed one: building the posterior from chained pseudo-inverses returns a matrix that is not a covariance. On a Jacobian with condition number 1e5 the old form came back asymmetric with two negative eigenvalues out of sixty, and feeding it to
propagate_petro_uncertaintybelow made NumPy report “covariance is not symmetric positive-semidefinite” and sample from it anyway.
- PyHydroGeophysX.uncertainty.posterior.model_resolution_spread(R: Any) Any[source]#
Return diagonal resolution spread metrics from a resolution matrix.
- PyHydroGeophysX.uncertainty.posterior.propagate_petro_uncertainty(rho: Any, rho_cov: Any, petro_func: Callable[[ndarray], ndarray], n_samples: int = 500, seed: int | None = None) Dict[str, ndarray][source]#
Propagate resistivity uncertainty through a petrophysical transform.
Uses Monte Carlo sampling by default.
"cov"is always a 2-D (outputs, outputs) matrix, (1, 1) for one cell or a scalar output.
Module contents#
Posterior and uncertainty quantification helpers.
- PyHydroGeophysX.uncertainty.linearized_posterior(J: Any, Cd: Any, Cm_prior: Any) Any[source]#
Compute linearized Gaussian posterior covariance:
Cm_post = (J^T Cd^-1 J + Cm_prior^-1)^-1
None of the three inverses in that expression is formed. Each is applied as a Cholesky solve instead, and the result is symmetrized before it is returned. This is a correctness matter, not a speed one: building the posterior from chained pseudo-inverses returns a matrix that is not a covariance. On a Jacobian with condition number 1e5 the old form came back asymmetric with two negative eigenvalues out of sixty, and feeding it to
propagate_petro_uncertaintybelow made NumPy report “covariance is not symmetric positive-semidefinite” and sample from it anyway.
- PyHydroGeophysX.uncertainty.model_resolution_spread(R: Any) Any[source]#
Return diagonal resolution spread metrics from a resolution matrix.
- PyHydroGeophysX.uncertainty.propagate_petro_uncertainty(rho: Any, rho_cov: Any, petro_func: Callable[[ndarray], ndarray], n_samples: int = 500, seed: int | None = None) Dict[str, ndarray][source]#
Propagate resistivity uncertainty through a petrophysical transform.
Uses Monte Carlo sampling by default.
"cov"is always a 2-D (outputs, outputs) matrix, (1, 1) for one cell or a scalar output.