Skip to content

Commit

Permalink
Fixed Docstring formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
appetrosyan committed Oct 11, 2020
1 parent 391a5ae commit 5100566
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
1 change: 0 additions & 1 deletion cobaya/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class CobayaComponent(HasLogger, HasDefaults):
"""
# The next lists of options apply when comparing existing versus new info at resuming.
# When defining it for subclasses, redefine append adding this list to new entries.
_at_resume_prefer_new = [_version]
_at_resume_prefer_old = []

def __init__(self, info=empty_dict, name=None, timing=None, packages_path=None,
Expand Down
34 changes: 19 additions & 15 deletions cobaya/sampler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
.. module:: sampler
""".. module:: sampler
:Synopsis: Base class for samplers and other parameter-space explorers
:Author: Jesus Torrado
Expand Down Expand Up @@ -28,14 +27,15 @@
polychord:
path: /path/to/cosmo/PolyChord
Samplers can in general be swapped in the input file without needing to modify any other
block of the input.
Samplers can in general be swapped in the input file without needing
to modify any other block of the input.
In the cobaya code tree, each sampler is placed in its own folder, containing a file
defining the sampler's class, which inherits from the :class:`cobaya.Sampler`, and a
``[sampler_name].yaml`` file, containing all possible user-specified options for the
sampler and their default values. Whatever option is defined in this file automatically
becomes an attribute of the sampler's instance.
In the cobaya code tree, each sampler is placed in its own folder,
containing a file defining the sampler's class, which inherits from
the :class:`cobaya.Sampler`, and a ``[sampler_name].yaml`` file,
containing all possible user-specified options for the sampler and
their default values. Whatever option is defined in this file
automatically becomes an attribute of the sampler's instance.
To implement your own sampler, or an interface to an external one, simply create a folder
under the ``cobaya/cobaya/samplers/`` folder and include the two files described above.
Expand Down Expand Up @@ -88,10 +88,13 @@ def check_sane_info_sampler(info_sampler):

def check_sampler_info(info_old=None, info_new=None, is_resuming=False):
"""
Checks compatibility between the new sampler info and that of a pre-existing run.
Checks compatibility between the new sampler info and that of a
pre-existing run.
Done separately from `Output.check_compatible_and_dump` because
there may be multiple samplers mentioned in an `updated.yaml`
file, e.g. `MCMC` + `Minimize`.
Done separately from `Output.check_compatible_and_dump` because there may be
multiple samplers mentioned in an `updated.yaml` file, e.g. `MCMC` + `Minimize`.
"""
logger_sampler = logging.getLogger(__name__.split(".")[-1])
if not info_old:
Expand Down Expand Up @@ -336,12 +339,13 @@ def __getitem__(self, k):

@classmethod
def output_files_regexps(cls, output, info=None, minimal=False):
"""
Returns a list of tuples `(regexp, root)` of output files potentially produced.
If `root` in the tuple is `None`, `output.folder` is used.
"""Returns a list of tuples `(regexp, root)` of output files
potentially produced. If `root` in the tuple is `None`,
`output.folder` is used.
If `minimal=True`, returns regexp's for the files that should really not be there
when we are not resuming.
"""
return []

Expand Down
4 changes: 2 additions & 2 deletions cobaya/samplers/mcmc/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@


class mcmc(CovmatSampler):
_at_resume_prefer_new = CovmatSampler._at_resume_prefer_new + [
_at_resume_prefer_new = [_version] + [
"burn_in", "callback_function", "callback_every", "max_tries", "output_every",
"learn_every", "learn_proposal_Rminus1_max", "learn_proposal_Rminus1_max_early",
"learn_proposal_Rminus1_min", "max_samples", "Rminus1_stop", "Rminus1_cl_stop",
"Rminus1_cl_level", "covmat", "covmat_params"]
_at_resume_prefer_old = CovmatSampler._at_resume_prefer_new + [
_at_resume_prefer_old = [_version] + [
"proposal_scale", "blocking"]

# instance variables from yaml
Expand Down
5 changes: 3 additions & 2 deletions cobaya/samplers/polychord/polychord.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,12 @@ def process_raw_output(self):


def products(self):
"""
Auxiliary function to define what should be returned in a scripted call.
"""Auxiliary function to define what should be returned in a scripted
call.
Returns:
The sample ``Collection`` containing the sequentially discarded live points.
"""
if is_main_process():
products = {
Expand Down

0 comments on commit 5100566

Please sign in to comment.