source_uncertainty#
- scarlet2.infer.source_uncertainty(scene, uncertainties, measurement_fct, samples=100, key=None)[source]#
Propagate parameter uncertainties to a per-source measurement.
Draws sample scenes with
get_scene_samples()and evaluatesmeasurement_fcton every source in every sample to estimate the spread of the measured quantity under the Laplace approximation implied byuncertainties.- Parameters:
scene (
Scene) – The (fitted) model of the scene.uncertainties (
dict) – Maps parameter name to its standard deviation, of the same shape as the parameter (e.g. the output ofuncertainty()).measurement_fct (
callable) – Function that takes aSourceand returns the quantity of interest, e.g. a function fromscarlet2.measure.samples (
int, optional) – Number of scene samples to draw for estimating the spread.key (
jax.random.PRNGKey, optional) – A random key for sampling. If None, a new key will be generated.
- Returns:
One Measurement per source in
scene.sources, in the same order, with the mean evaluated on scene directly and the standard deviation estimated across the samples.- Return type:
listofMeasurement