pymcmcstat.utilities package

pymcmcstat.utilities.NumpyEncoder module

Created on Mon Apr 2 08:42:56 2018

@author: prmiles

class pymcmcstat.utilities.NumpyEncoder.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.encoder.JSONEncoder

Encoder used for storing numpy arrays in json files.

default(obj)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)

pymcmcstat.utilities.general module

Created on Tue Jun 26 06:16:02 2018

General functions used throughout package

@author: prmiles

pymcmcstat.utilities.general.message(verbosity, level, printthis)[source]

Display message

Args:
  • verbosity (int): Verbosity of display output.
  • level (int): Print level relative to verbosity.
  • printthis (str): String to be printed.
pymcmcstat.utilities.general.removekey(d, key)[source]

Removed elements from dictionary and return the remainder.

Args:
  • d (dict): Original dictionary.
  • key (str): Keyword to be removed.
Returns:
  • r (dict): Updated dictionary without the keyword, value pair.

pymcmcstat.utilities.progressbar module

pymcmcstat.utilities.progressbar.progress_bar(iters)[source]

Simulation progress bar.

A simple progress bar to monitor MCMC sampling progress. Modified from original code by Corey Goldberg (2010).

Args:
  • iters (int): Number of iterations in simulation.

Example display:

[--------         21%                  ] 2109 of 10000 complete in 0.5 sec

Note

Will display a progress bar as simulation runs, providing feedback as to the status of the simulation. Depending on the available resources, the appearance of the progress bar may differ.