Package gmisclib :: Module mcmc_logger
[frames] | no frames]

Module mcmc_logger

source code

Classes
  WildNumber
  logger_c
This class is called from the Markov-Chain stepper and writes the log file.
  logger_A
  logger_N
  lti_c
  NoDataError
Functions
tuple(list(dict(str:str)), dict(str:str))
read_currentlist(fname, trigger=None)
Starting from a file name, read in a log file.
source code
(dict(str:str), list(indexer), list(float))
read_multisample(fname, Nsamp=10, tail=0.0, trigger=None, reader=<function read_currentlist at 0x465eed8>)
Read in a log file: it gives you multiple samples from the log.
source code
Variables
  __package__ = 'gmisclib'

Imports: re, numpy, die, fiatio, dictops, gpkmisc, nice_hash, mcmcP, BadFormatError


Function Details

read_currentlist(fname, trigger=None)

source code 

Starting from a file name, read in a log file.

Parameters:
  • fname (str) - name of a (possibly compressed) log file.
  • trigger - where to start in the log file. See readiter.
Returns: tuple(list(dict(str:str)), dict(str:str))
a list of data lines and header information. A data line is a dictionary, containing parameters and other information from one iteration.

Note: this is very similar to newstem2.newlogger.read_currentlist except that returns a more complicated data structure that has one more level of indirection.

read_multisample(fname, Nsamp=10, tail=0.0, trigger=None, reader=<function read_currentlist at 0x465eed8>)

source code 

Read in a log file: it gives you multiple samples from the log. In other words, it provides a time-series of the changes to the parameters.

Parameters:
  • tail - Where to start in the file? tail=0 means that you start at the trigger or beginning. tail=1-epsilon means you take just the last tiny bit of the file.
  • reader (function(str, trigger) -> (list(dict(str:str)), dict(str:str))) - A function that sucks in the data from the log file, yielding a list of iterations and an overall header.
Returns: (dict(str:str), list(indexer), list(float))
Raises:
  • NoDatError - when the log file is empty.
  • BadFormatError - when a parameter appears mid-way through the optimization or an iteration cannot be read.