source_uncertainty

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 evaluates measurement_fct on every source in every sample to estimate the spread of the measured quantity under the Laplace approximation implied by uncertainties.

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 of uncertainty()).

  • measurement_fct (callable) – Function that takes a Source and returns the quantity of interest, e.g. a function from scarlet2.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:

list of Measurement