sample

Contents

sample#

scarlet2.sample(scene, observations, *args, seed=0, num_warmup=100, num_samples=200, progress_bar=True, **kwargs)[source]#

Sample parameters of every source in scene to get posteriors given observations.

This method runs the HMC NUTS sampler from numpyro to get parameter posteriors. It uses the likelihood of observations as well as the prior attribute set for every Parameter in parameters.

Parameters:
  • scene (Scene) – The model of the scene.

  • observations (Observation or list) – The observations to fit the models to.

  • *args (list, optional) – Additional arguments passed. Only used for backwards (v0.3) compatibility.

  • seed (int, optional) – RNG seed for the sampler

  • num_warmup (int, optional) – Number of samples during HMC warm-up

  • num_samples (int, optional) – Number of samples to create from tuned HMC

  • progress_bar (bool, optional) – Whether to show a progress bar

  • **kwargs (dict, optional) – Additional keyword arguments passed to the numpyro.infer.NUTS sampler.

Notes

Requires numpyro

Return type:

numpyro.infer.mcmc.MCMC