Skip to content

CobayaSampler/example_sampler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example externally-defined sampler for Cobaya

This package contains the bare minimum necessary to implement a Cobaya sampler, or a Cobaya wrapper for an independent sampler. Such a package can contain any code at all, as long is it implements a class inheriting from cobaya.sampler.Sampler (or a derivative of it) and makes it importable from the root of the package.

As an example, check out the definition of the single class defined in my_sampler.py. There you can find code snippets for different ways to interact with Cobaya models and output drivers.

If this code is installed as a Python package with pip, it can be used in a Cobaya input file or dictionary as:

sampler:
  example_sampler.MySampler:
    # ...

Or more simply, if you implement a trivial get_cobaya_class() function that is importable from the root of the package and returns the MySampler class (see __init__.py):

sampler:
  example_sampler:
    # ...

To test it, run cobaya-run with the input files in the examples/ folder.

About

Example code for an external sampler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages