%% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[letterpaper,10pt,english]{sphinxmanual}
\ifdefined\pdfpxdimen
   \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
\fi \sphinxpxdimen=.75bp\relax

\PassOptionsToPackage{warn}{textcomp}
\usepackage[utf8]{inputenc}
\ifdefined\DeclareUnicodeCharacter
% support both utf8 and utf8x syntaxes
\edef\sphinxdqmaybe{\ifdefined\DeclareUnicodeCharacterAsOptional\string"\fi}
  \DeclareUnicodeCharacter{\sphinxdqmaybe00A0}{\nobreakspace}
  \DeclareUnicodeCharacter{\sphinxdqmaybe2500}{\sphinxunichar{2500}}
  \DeclareUnicodeCharacter{\sphinxdqmaybe2502}{\sphinxunichar{2502}}
  \DeclareUnicodeCharacter{\sphinxdqmaybe2514}{\sphinxunichar{2514}}
  \DeclareUnicodeCharacter{\sphinxdqmaybe251C}{\sphinxunichar{251C}}
  \DeclareUnicodeCharacter{\sphinxdqmaybe2572}{\textbackslash}
\fi
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amstext}
\usepackage{babel}
\usepackage{times}
\usepackage[Bjarne]{fncychap}
\usepackage{sphinx}

\fvset{fontsize=\small}
\usepackage{geometry}

% Include hyperref last.
\usepackage{hyperref}
% Fix anchor placement for figures with captions.
\usepackage{hypcap}% it must be loaded after hyperref.
% Set up styles of URL: it should be placed after hyperref.
\urlstyle{same}
\addto\captionsenglish{\renewcommand{\contentsname}{Contents:}}

\addto\captionsenglish{\renewcommand{\figurename}{Fig.\@ }}
\makeatletter
\def\fnum@figure{\figurename\thefigure{}}
\makeatother
\addto\captionsenglish{\renewcommand{\tablename}{Table }}
\makeatletter
\def\fnum@table{\tablename\thetable{}}
\makeatother
\addto\captionsenglish{\renewcommand{\literalblockname}{Listing}}

\addto\captionsenglish{\renewcommand{\literalblockcontinuedname}{continued from previous page}}
\addto\captionsenglish{\renewcommand{\literalblockcontinuesname}{continues on next page}}
\addto\captionsenglish{\renewcommand{\sphinxnonalphabeticalgroupname}{Non-alphabetical}}
\addto\captionsenglish{\renewcommand{\sphinxsymbolsname}{Symbols}}
\addto\captionsenglish{\renewcommand{\sphinxnumbersname}{Numbers}}

\addto\extrasenglish{\def\pageautorefname{page}}

\setcounter{tocdepth}{1}



\title{SMCPy Documentation}
\date{Apr 23, 2019}
\release{1.0}
\author{Patrick Leser}
\newcommand{\sphinxlogo}{\vbox{}}
\renewcommand{\releasename}{Release}
\makeindex
\begin{document}

\pagestyle{empty}
\sphinxmaketitle
\pagestyle{plain}
\sphinxtableofcontents
\pagestyle{normal}
\phantomsection\label{\detokenize{index::doc}}



\chapter{Introduction}
\label{\detokenize{introduction:introduction}}\label{\detokenize{introduction:introduction-section}}\label{\detokenize{introduction::doc}}
Uncertainty quantification (UQ) is necessary to provide meaningful and reliable predictions of real-world system performance. One major obstacle for the implementation of statistical methods for UQ is the use of expensive computational models. Classical UQ methods such as Markov chain Monte Carlo (MCMC) generally require thousands to millions of model evaluations, and, when coupled with an expensive model, result in excessive solve times that can render the analysis intractable. These methods are also inherently serial, which prohibits speedup by high performance computing. Recently, Sequential Monte Carlo (SMC) has emerged as a alternative to MCMC. In contrast, this method uses parallel model evaluations to realize significant speedup.

This software is an implementation of SMC that uses the Message Passing Interface (MPI) to provide users general access to parallel UQ methods in Python 2.7. The algorithm used is based on the work by Nguyen et al. {[}“Efficient Sequential Monte-Carlo Samplers for Bayesian Inference” IEEE Transactions on Signal Processing, Vol. 64, No. 5 (2016){]}. To operate the code, the user supplies a computational model built in Python 2.7, defines prior distributions for each of the model parameters to be estimated, and provides data to be used for calibration. SMC sampling can then be conducted with ease through instantiation of the SMC class and a call to the sample() method. The output of this process is an approximation of the parameter posterior probability distribution conditioned on the data provided.


\chapter{Example - Spring Mass System}
\label{\detokenize{example:example-spring-mass-system}}\label{\detokenize{example::doc}}
This example provides a simple demonstration of SMCPy functionality. The goal
is to inversely determine the uncertainty in the model parameters given a set
of noisy observations of the spring mass system using Sequential Monte Carlo
(SMC) and to compare the results to Markov chain Monte Carlo (MCMC). As SMC
relies on a MCMC kernel, a fully functional MCMC sampler is included in the
SMCPy package. In this example, it is used for verification of the SMC sampler.
The example covers all steps for implementing SMC and MCMC samplers using
SMCPy, including the creation of a user-defined computational model (spring
mass numerical integrator) that uses the standardized SMCPy interface, defining
prior distributions, initializing the samplers, computing statistical moments
with the resulting estimators, and plotting the results. The full source code
for this example can be found in the SMCPy repository:
\sphinxcode{\sphinxupquote{/SMCPy/examples/spring\_mass/spring\_mass\_example.py}} and
\sphinxcode{\sphinxupquote{/SMCPy/examples/spring\_mass/mcmc\_verify/spring\_mass\_mcmc.py}} for the SMC and
MCMC samplers, respectively. Data generation was conducted using
\sphinxcode{\sphinxupquote{/SMCPy/examples/spring\_mass/generate\_noisy\_data.py}}.

\begin{figure}[htbp]
\centering

\noindent\sphinxincludegraphics[width=2in]{{images/spring_mass_diagram}.png}
\end{figure}


\section{Problem Specification}
\label{\detokenize{example:problem-specification}}
The governing equation of motion for the system is given by
\begin{equation}\label{equation:example:springmass}
\begin{split}m_s \ddot{z}  = -k_s z + m_s g\end{split}
\end{equation}
where \(m_s\) is the mass, \(k_s\) is the spring stiffness, \(g\)
is the acceleration due to gravity, \(z\) is the vertical displacement of
the mass, and \(\ddot{z}\) is the acceleration of the mass. The true
stiffness and gravitational constant are unknown. The goal of this example is
to, by observing the motion of the mass over time, \(z_t\), estimate both
\(K_s\) and \(G\), which are random variables representing the
uncertainty in the value of spring stiffness and the gravitational constant,
respectively. For reasons outside the scope of this example, the problem
becomes ill-posed unless the stiffness is normalized by mass such that
\(k_s^* = k_s/m_s\) and \(k_s^*\) are realizations of the random
variable of interest \(K_s^*\). The equation of motion given by Equation
(1) is now
\begin{equation}\label{equation:example:springmass_mod}
\begin{split}\ddot{z}  = -k_s^* z + g.\end{split}
\end{equation}
Given observations \(z_t\) which, assuming measurement noise exists, are realizations of the random variable \(Z_t\), the relationship between the computational model, measurement noise, and observations is
\begin{equation}\label{equation:example:springmass_stat_model}
\begin{split}Z_t = f_t(K_s^*, G) + \epsilon_t\end{split}
\end{equation}
Here, \(\epsilon_t\) is the measurement noise associated with each observation of displacement taken over time (also a random variable), and \(f_t\) is the computational model response at time \(t\), which involves numerical integration of Equation (2).

The inverse solution of equations in the form of (2) is the posterior
distribution, or, in the context of this example, the joint distribution of
\(K_s^*\) and \(G\) conditional on the observed data, \(z_t\). While
difficult to solve directly, the posterior distribution can be approximated via
sampling methods such as SMC and MCMC. This example covers this process using
the SMCSampler and MCMCSampler classes in the SMCPy Python module. In
particular, the objective is to approximate the expected value of the model
parameters given observations \(z_t\).

The MCMC sampler draws samples from the unknown posterior distribution
by forming a Markov chain through the parameter space whose stationary
distribution is the posterior. The samples forming the chain can then be used
to build an estimator of the expected value
\begin{equation*}
\begin{split}E[X] = \frac{1}{N} \sum_{i=1}^N X_i\end{split}
\end{equation*}
where \(X_i\) is the random variable of interest, and \(i=1,\ldots,N\), with \(N\) being the number of equally-weighted samples drawn using the MCMC sampler.

While MCMC is a proven approach to evaluting the quantities of interest, it can
be slow if the computational model is expensive. The Markovian nature of MCMC
means it is inherently a serial process. SMC, on the other hand, is a
parallelizable alternative that uses weighted samples called “particles.” In
SMC, a sequence of target distributions is defined that gradually transitions
from the typically-known prior distribution to the posterior distribution of
interest. A particle filtering framework based on importance sampling and a
MCMC transition kernel can then be introduced that allows for recursive
estimation of each target in the sequence. Taking the final particle state, the
SMC estimator is
\begin{equation*}
\begin{split}E[X] = \sum_{j=1}^M W_j X_j\end{split}
\end{equation*}
where \(W_j\) is the normalized weight associated with the \(j^{th}\) particle and \(M\) is the total number of particles.

For this example, synthetic data will be generated by adding noise to a model response for a given set of “true” parameters. Next, MCMC and SMC will be used to estimate the expected value of these parameters with the expectation that these estimates are close to the true parameter values. Note that the code used to generate results in this example is actually split between two files in the SMCPy package. The two will be combined here and redundant code will be skipped.


\section{Step 1: Initialization; define the model and generate the data}
\label{\detokenize{example:step-1-initialization-define-the-model-and-generate-the-data}}
Begin by importing the needed Python modules, including SMCPy sampler classes
and the SpringMassModel class that defines the spring mass numerical
integrator:

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{k+kn}{import} \PYG{n+nn}{numpy} \PYG{k+kn}{as} \PYG{n+nn}{np}
\PYG{k+kn}{from} \PYG{n+nn}{smcpy.smc.smc\PYGZus{}sampler} \PYG{k+kn}{import} \PYG{n}{SMCSampler}
\PYG{k+kn}{from} \PYG{n+nn}{smcpy.mcmc.mcmc\PYGZus{}sampler} \PYG{k+kn}{import} \PYG{n}{MCMCSampler}
\PYG{k+kn}{from} \PYG{n+nn}{spring\PYGZus{}mass\PYGZus{}models} \PYG{k+kn}{import} \PYG{n}{SpringMassModel}
\end{sphinxVerbatim}

Below is a snippet of the SpringMassModel class; the entire class can be found in the SMCPy repo (\sphinxcode{\sphinxupquote{/SMCPy/examples/spring\_mass/spring\_mass\_model.py}}):

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{k+kn}{from} \PYG{n+nn}{smcpy.model.base\PYGZus{}model} \PYG{k+kn}{import} \PYG{n}{BaseModel}

\PYG{o}{.}\PYG{o}{.}\PYG{o}{.}

\PYG{k}{class} \PYG{n+nc}{SpringMassModel}\PYG{p}{(}\PYG{n}{BaseModel}\PYG{p}{)}\PYG{p}{:}
    \PYG{l+s+sd}{\PYGZsq{}\PYGZsq{}\PYGZsq{}}
\PYG{l+s+sd}{    Defines Spring Mass model with 2 free params (spring stiffness, k \PYGZam{}}
\PYG{l+s+sd}{    mass, m)}
\PYG{l+s+sd}{    \PYGZsq{}\PYGZsq{}\PYGZsq{}}
    \PYG{k}{def} \PYG{n+nf+fm}{\PYGZus{}\PYGZus{}init\PYGZus{}\PYGZus{}}\PYG{p}{(}\PYG{n+nb+bp}{self}\PYG{p}{,} \PYG{n}{state0}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{,} \PYG{n}{time\PYGZus{}grid}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{)}\PYG{p}{:}
\end{sphinxVerbatim}

Note that user-defined models in SMCPy must inherit from the SMCPy abstract class \sphinxcode{\sphinxupquote{BaseModel}} and implement an  \sphinxcode{\sphinxupquote{evaluate}} function that accepts and returns numpy arrays for inputs and outputs, respectively. Here, the \sphinxcode{\sphinxupquote{state0}} argument defines the initial state of the spring mass system, and \sphinxcode{\sphinxupquote{time\_grid}} defines the times at which to return displacement.

The first step in an analysis is to obtain data from which to make an
inference. In this example, this data will come in the form of observations of
the z-displacement of the mass made over time. For demonstration purposes, the
data will be generated from the spring mass model, and noise will be added by
sampling from a zero-mean Gaussian distribution and adding these values to the
model output. While not a realistic case, it is typical to generate and use
synthetic data in this manner for verification purposes when performing inverse
uncertainty quantification. The following code snippet is from
\sphinxcode{\sphinxupquote{generate\_noisy\_data.py}} and demonstrates the generation of data assuming the
ground truth parameters, or those that are unknown and are to be estimated, are
\(k_s^*=1.67\) and \(g^*=4.62\):

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{c+c1}{\PYGZsh{} Initialize model}
\PYG{n}{state0} \PYG{o}{=} \PYG{p}{[}\PYG{l+m+mf}{0.}\PYG{p}{,} \PYG{l+m+mf}{0.}\PYG{p}{]}                        \PYG{c+c1}{\PYGZsh{}initial conditions}
\PYG{n}{measure\PYGZus{}t\PYGZus{}grid} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{arange}\PYG{p}{(}\PYG{l+m+mf}{0.}\PYG{p}{,} \PYG{l+m+mf}{5.}\PYG{p}{,} \PYG{l+m+mf}{0.2}\PYG{p}{)}  \PYG{c+c1}{\PYGZsh{}time}
\PYG{n}{model} \PYG{o}{=} \PYG{n}{SpringMassModel}\PYG{p}{(}\PYG{n}{state0}\PYG{p}{,} \PYG{n}{measure\PYGZus{}t\PYGZus{}grid}\PYG{p}{)}

\PYG{c+c1}{\PYGZsh{} Define the ground truth}
\PYG{n}{true\PYGZus{}params} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{K}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{l+m+mf}{1.67}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{g}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{l+m+mf}{4.62}\PYG{p}{\PYGZcb{}}

\PYG{c+c1}{\PYGZsh{} Load data}
\PYG{n}{noise\PYGZus{}stddev} \PYG{o}{=} \PYG{l+m+mf}{0.5}
\PYG{n}{displacement\PYGZus{}data} \PYG{o}{=} \PYG{n}{model}\PYG{o}{.}\PYG{n}{generate\PYGZus{}noisy\PYGZus{}data\PYGZus{}with\PYGZus{}model}\PYG{p}{(}\PYG{n}{noise\PYGZus{}std\PYGZus{}dev}\PYG{p}{,} \PYG{n}{truth\PYGZus{}params}\PYG{p}{)}
\end{sphinxVerbatim}

Once the data has been generated, the only remaining task is to use the SMC and MCMC sampler classes to generate estimates of the parameter expected values.


\section{Step 2: Perform Parameter Estimation using SMCPy}
\label{\detokenize{example:step-2-perform-parameter-estimation-using-smcpy}}
To instance the SMC sampler class, the data, model and parameter prior
distributions must be passed to the constructor. The first two have been
defined already. The parameter priors can be defined using the SMCPy standard
format. In this case, both prior distributions will be defined as Uniform
bounded from 0.0 to 10.0.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{c+c1}{\PYGZsh{} Define prior distributions}
\PYG{n}{param\PYGZus{}priors} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{K}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{Uniform}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{10.0}\PYG{p}{]}\PYG{p}{,}
                \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{g}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{Uniform}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+m+mf}{0.0}\PYG{p}{,} \PYG{l+m+mf}{10.0}\PYG{p}{]}\PYG{p}{\PYGZcb{}}
\end{sphinxVerbatim}

Other options, such as Normal or Truncated Normal distributions are supported.

All that is left now is to use the \sphinxcode{\sphinxupquote{sample()}} method, which requires the number of particles, number of time steps (i.e., the number of target distributions to define in the sequence) and the number of MCMC proposals to make when implementing the MCMC transition kernel between targets. Another optional but useful argument used here is the effective sample size (ESS) threshold. The ESS is a measure of how many particles in the overall population have significant weight. If this number falls below the ESS threshold, the particles are resampled with replacement to reduce degeneracy.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{c+c1}{\PYGZsh{} SMC sampling}
\PYG{n}{num\PYGZus{}particles} \PYG{o}{=} \PYG{l+m+mi}{5000}
\PYG{n}{num\PYGZus{}time\PYGZus{}steps} \PYG{o}{=} \PYG{l+m+mi}{20}
\PYG{n}{num\PYGZus{}mcmc\PYGZus{}steps} \PYG{o}{=} \PYG{l+m+mi}{1}
\PYG{n}{smc} \PYG{o}{=} \PYG{n}{SMCSampler}\PYG{p}{(}\PYG{n}{displacement\PYGZus{}data}\PYG{p}{,} \PYG{n}{model}\PYG{p}{,} \PYG{n}{param\PYGZus{}priors}\PYG{p}{)}
\PYG{n}{pchain} \PYG{o}{=} \PYG{n}{smc}\PYG{o}{.}\PYG{n}{sample}\PYG{p}{(}\PYG{n}{num\PYGZus{}particles}\PYG{p}{,} \PYG{n}{num\PYGZus{}time\PYGZus{}steps}\PYG{p}{,} \PYG{n}{num\PYGZus{}mcmc\PYGZus{}steps}\PYG{p}{,} \PYG{n}{noise\PYGZus{}stddev}\PYG{p}{,}
                    \PYG{n}{ess\PYGZus{}threshold}\PYG{o}{=}\PYG{n}{num\PYGZus{}particles}\PYG{o}{*}\PYG{l+m+mf}{0.5}\PYG{p}{)}
\end{sphinxVerbatim}

The object returned by the sampler is referred to as a “particle chain,” which
is just a data storage object that contains all particle values, weights, and
likelihoods computed at each step in the sampling process. This object has some useful methods, such as plotting tools and estimators. One such estimator is that of Equation (5), the quantity of interest for this example.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{c+c1}{\PYGZsh{} Calculate smc\PYGZhy{}estimated means}
\PYG{n}{smc\PYGZus{}means} \PYG{o}{=} \PYG{n}{pchain}\PYG{o}{.}\PYG{n}{get\PYGZus{}mean}\PYG{p}{(}\PYG{p}{)}
\end{sphinxVerbatim}

These values will be stored to compare with MCMC in the next section.

Before moving on, a pairwise plot can be generated to visualize parameter uncertainty and correlation using the \sphinxcode{\sphinxupquote{plot\_pairwise\_weights()}} method of the particle chain object. The particles are represented as colored dots, with the colorbar showing normalized particle weight. The mean value of each parameter is shown as a dotted orange line.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{pchain}\PYG{o}{.}\PYG{n}{plot\PYGZus{}pairwise\PYGZus{}weights}\PYG{p}{(}\PYG{n}{save}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{,} \PYG{n}{show}\PYG{o}{=}\PYG{n+nb+bp}{False}\PYG{p}{)}
\end{sphinxVerbatim}

\begin{figure}[htbp]
\centering

\noindent\sphinxincludegraphics[width=3.5in]{{pairwise}.png}
\end{figure}


\section{Step 3: Perform Parameter Estimation using MCMCPy}
\label{\detokenize{example:step-3-perform-parameter-estimation-using-mcmcpy}}
Repeating the estimation of parameter means is similar with the MCMCPy submodule. Instancing the \sphinxcode{\sphinxupquote{MCMCSampler}} class is done in the same way as before.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{mcmc} \PYG{o}{=} \PYG{n}{MCMCSampler}\PYG{p}{(}\PYG{n}{displacement\PYGZus{}data}\PYG{p}{,} \PYG{n}{model}\PYG{p}{,} \PYG{n}{param\PYGZus{}priors}\PYG{p}{)}
\end{sphinxVerbatim}

Additional parameters have to be set prior to sampling, however. In this
example, it is assumed that the measurement noise variance is known, so the
variance will be fixed and provided in the form of the standard deviation used
when generating the data, previously. Additionally, an initial guess (i.e.,
where to initialize the Markov chain within the parameter space) are specified.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{initial\PYGZus{}guess} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{K}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{l+m+mf}{1.0}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{g}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{:} \PYG{l+m+mf}{1.0}\PYG{p}{\PYGZcb{}}
\PYG{n}{mcmc}\PYG{o}{.}\PYG{n}{generate\PYGZus{}pymc\PYGZus{}model}\PYG{p}{(}\PYG{n}{q0}\PYG{o}{=}\PYG{n}{initial\PYGZus{}guess}\PYG{p}{,} \PYG{n}{std\PYGZus{}dev0}\PYG{o}{=}\PYG{n}{noise\PYGZus{}stddev}\PYG{p}{,} \PYG{n}{fix\PYGZus{}var}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{)}
\end{sphinxVerbatim}

When using the \sphinxcode{\sphinxupquote{sample()}} method, the number of samples, \(N\), must be
defined along with the number of those samples that will be discarded as
burn-in. Burn-in is defined as the samples generated prior to the Markov chain
reaching its stationary condition. In practice, the number of samples in the
burn-in period is unknown and conservatively estimated.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{num\PYGZus{}samples} \PYG{o}{=} \PYG{l+m+mi}{100000}
\PYG{n}{num\PYGZus{}samples\PYGZus{}burnin} \PYG{o}{=} \PYG{l+m+mi}{5000}
\PYG{n}{mcmc}\PYG{o}{.}\PYG{n}{sample}\PYG{p}{(}\PYG{n}{num\PYGZus{}samples}\PYG{p}{,} \PYG{n}{num\PYGZus{}samples\PYGZus{}burnin}\PYG{p}{)}
\end{sphinxVerbatim}

The MCMC module is a wrapper built around the PyMC package (\sphinxurl{https://github.com/pymc-devs/pymc}). The stored samples can be accessed through the PyMC trace object as follows: \sphinxcode{\sphinxupquote{\textless{}mcmc\_object\textgreater{}.MCMC.trace(\textless{}param\_name\textgreater{}){[}:{]}}}. The means can be calculated from the trace.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{Kmean} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{mean}\PYG{p}{(}\PYG{n}{mcmc}\PYG{o}{.}\PYG{n}{MCMC}\PYG{o}{.}\PYG{n}{trace}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{K}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}\PYG{p}{[}\PYG{p}{:}\PYG{p}{]}\PYG{p}{)}
\PYG{n}{gmean} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{mean}\PYG{p}{(}\PYG{n}{mcmc}\PYG{o}{.}\PYG{n}{MCMC}\PYG{o}{.}\PYG{n}{trace}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{g}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}\PYG{p}{[}\PYG{p}{:}\PYG{p}{]}\PYG{p}{)}
\end{sphinxVerbatim}

A pairwise plot can also be generated with the MCMC results. Note that the samples are not weighted in this case.

\begin{sphinxVerbatim}[commandchars=\\\{\}]
\PYG{n}{mcmc}\PYG{o}{.}\PYG{n}{plot\PYGZus{}pairwise}\PYG{p}{(}\PYG{n}{keys}\PYG{o}{=}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{K}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{g}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{]}\PYG{p}{,} \PYG{n}{filename}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}}\PYG{l+s+s1}{mcmc\PYGZus{}pairwise.png}\PYG{l+s+s1}{\PYGZsq{}}\PYG{p}{)}
\end{sphinxVerbatim}

\begin{figure}[htbp]
\centering

\noindent\sphinxincludegraphics[width=3.25in]{{pairwise1}.png}
\end{figure}


\section{Comparing the Results}
\label{\detokenize{example:comparing-the-results}}
The mean values obtained for a given run of the example scripts is shown below.
Note that both SMC and MCMC sampling involve random numbers, meaning these
numbers will be slightly different for every run. The true parameters set in the data generation step were \(k_s^* = 1.67\) and \(g^* = 4.62\).


\begin{savenotes}\sphinxattablestart
\centering
\begin{tabulary}{\linewidth}[t]{|T|T|T|}
\hline
\sphinxstyletheadfamily 
Parameter
&\sphinxstyletheadfamily 
MCMC-estimated Mean
&\sphinxstyletheadfamily 
SMC-estimated mean
\\
\hline
\(k_s^*\)
&
1.5397276686462869
&
1.5567662328730911
\\
\hline
\(g^*\)
&
4.231683157045673
&
4.276694515489001
\\
\hline
\end{tabulary}
\par
\sphinxattableend\end{savenotes}


\section{Running the SMCSampler in Parallel with mpi4py}
\label{\detokenize{example:running-the-smcsampler-in-parallel-with-mpi4py}}
As mentioned, the \sphinxcode{\sphinxupquote{SMCSampler}} class was designed with high performance computing in mind. The sampler uses the mpi4py package (\sphinxurl{https://bitbucket.org/mpi4py/mpi4py}) to run model evaluations at each SMC step in parallel. The SMC example script can be run in parallel using \sphinxcode{\sphinxupquote{mpirun -np \textless{}number of processors\textgreater{} python spring\_mass\_example.py}}.


\chapter{Source Code Documentation}
\label{\detokenize{source_code:source-code-documentation}}\label{\detokenize{source_code:sourcecode-section}}\label{\detokenize{source_code::doc}}
Documentation for the primary SMCPy classes.


\section{SMC Module Documentation}
\label{\detokenize{source_code:module-smcpy.smc.smc_sampler}}\label{\detokenize{source_code:smc-module-documentation}}\index{smcpy.smc.smc\_sampler (module)@\spxentry{smcpy.smc.smc\_sampler}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRessED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNess FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLess THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{SMCSampler (class in smcpy.smc.smc\_sampler)@\spxentry{SMCSampler}\spxextra{class in smcpy.smc.smc\_sampler}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_sampler.SMCSampler}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.smc.smc\_sampler.}}\sphinxbfcode{\sphinxupquote{SMCSampler}}}{\emph{data}, \emph{model}, \emph{param\_priors}}{}
Class for performing parallel Sequential Monte Carlo sampling.
\index{load\_step\_list() (smcpy.smc.smc\_sampler.SMCSampler method)@\spxentry{load\_step\_list()}\spxextra{smcpy.smc.smc\_sampler.SMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_sampler.SMCSampler.load_step_list}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{load\_step\_list}}}{\emph{h5\_file}}{}
Loads and returns a step list stored using the HDF5Storage
class.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{hdf5\_to\_load}} (\sphinxstyleliteralemphasis{\sphinxupquote{string}}) \textendash{} file path of a step\_list saved using the
self.save\_step\_list() methods.

\item[{Returns}] \leavevmode
A list of SMCStep class instances that contains all particles
at each time step.

\end{description}\end{quote}

\end{fulllineitems}

\index{sample() (smcpy.smc.smc\_sampler.SMCSampler method)@\spxentry{sample()}\spxextra{smcpy.smc.smc\_sampler.SMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_sampler.SMCSampler.sample}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{sample}}}{\emph{num\_particles}, \emph{num\_time\_steps}, \emph{num\_mcmc\_steps}, \emph{measurement\_std\_dev}, \emph{ess\_threshold=None}, \emph{proposal\_center=None}, \emph{proposal\_scales=None}, \emph{restart\_time\_step=0}, \emph{hdf5\_to\_load=None}, \emph{autosave\_file=None}}{}
Driver method that performs Sequential Monte Carlo sampling.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{num\_particles}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} number of particles to use during sampling

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{num\_time\_steps}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} number of time steps in temperature schedule that
is used to transition between prior and posterior distributions.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{num\_mcmc\_steps}} \textendash{} number of mcmc steps to take during mutation

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{num\_mcmc\_steps}} \textendash{} int

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{measurement\_std\_dev}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} standard deviation of the measurement error

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{ess\_threshold}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{ or }}\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} threshold equivalent sample size; triggers
resampling when ess \textgreater{} ess\_threshold

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{proposal\_center}} (\sphinxstyleliteralemphasis{\sphinxupquote{dict}}) \textendash{} initial parameter dictionary, which is used to
define the initial proposal distribution when generating particles;
default is None, and initial proposal distribution = prior.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{proposal\_scales}} (\sphinxstyleliteralemphasis{\sphinxupquote{dict}}) \textendash{} defines the scale of the initial proposal
distribution, which is centered at proposal\_center, the initial
parameters; i.e. prop \textasciitilde{} MultivarN(q1, (I*proposal\_center*scales)\textasciicircum{}2).
Proposal scales should be passed as a dictionary with keys and
values corresponding to parameter names and their associated scales,
respectively. The default is None, which sets initial proposal
distribution = prior.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{restart\_time\_step}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} time step at which to restart sampling;
default is zero, meaning the sampling process starts at the prior
distribution; note that restart\_time\_step \textless{} num\_time\_steps. The
step at restart\_time is retained, and the sampling begins at the
next step (t=restart\_time\_step+1).

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{hdf5\_to\_load}} (\sphinxstyleliteralemphasis{\sphinxupquote{string}}) \textendash{} file path of a step list

\end{itemize}

\item[{Returns}] \leavevmode
A list of SMCStep class instances that contains all particles
and their past generations at every time step.

\end{description}\end{quote}

\end{fulllineitems}

\index{save\_step\_list() (smcpy.smc.smc\_sampler.SMCSampler method)@\spxentry{save\_step\_list()}\spxextra{smcpy.smc.smc\_sampler.SMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_sampler.SMCSampler.save_step_list}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{save\_step\_list}}}{\emph{h5\_file}}{}
Saves self.step to an hdf5 file using the HDF5Storage class.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{hdf5\_to\_load}} (\sphinxstyleliteralemphasis{\sphinxupquote{string}}) \textendash{} file path at which to save step list

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}

\phantomsection\label{\detokenize{source_code:module-smcpy.smc.smc_step}}\index{smcpy.smc.smc\_step (module)@\spxentry{smcpy.smc.smc\_step}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRessED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNess FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLess THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{SMCStep (class in smcpy.smc.smc\_step)@\spxentry{SMCStep}\spxextra{class in smcpy.smc.smc\_step}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep}}\pysigline{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.smc.smc\_step.}}\sphinxbfcode{\sphinxupquote{SMCStep}}}
A single step of the sequential monte carlo (SMC) method that contains
a list of Particle instances
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{particles}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}) \textendash{} list of particle instances

\end{description}\end{quote}
\index{add\_particle() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{add\_particle()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.add_particle}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{add\_particle}}}{\emph{particle}}{}
Add a single particle to the step.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{particle}} (\sphinxstyleliteralemphasis{\sphinxupquote{Particle class object}}) \textendash{} single instance of an SMC particle

\end{description}\end{quote}

\end{fulllineitems}

\index{calculate\_covariance() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{calculate\_covariance()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.calculate_covariance}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{calculate\_covariance}}}{}{}
Estimates the covariance matrix for the step.

\end{fulllineitems}

\index{compute\_ess() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{compute\_ess()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.compute_ess}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{compute\_ess}}}{}{}
Computes the effective sample size (ess) of the step based on log weight

\end{fulllineitems}

\index{copy() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{copy()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.copy}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{copy}}}{}{}
Returns a copy of the entire step class.

\end{fulllineitems}

\index{get\_likes() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_likes()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_likes}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_likes}}}{}{}
Returns a list of likelihoods for each particle in the step

\end{fulllineitems}

\index{get\_log\_likes() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_log\_likes()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_log_likes}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_log\_likes}}}{}{}
Returns a list of log(likelihoods) for each particle in the step

\end{fulllineitems}

\index{get\_log\_weights() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_log\_weights()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_log_weights}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_log\_weights}}}{}{}
Returns a list of the log weights of each particle in the step

\end{fulllineitems}

\index{get\_mean() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_mean()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_mean}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_mean}}}{}{}
Returns the mean of each parameter within the step

\end{fulllineitems}

\index{get\_param\_dicts() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_param\_dicts()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_param_dicts}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_param\_dicts}}}{}{}
Retrieves the entire parameter dictionary for every particle

\end{fulllineitems}

\index{get\_params() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_params()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_params}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_params}}}{\emph{key}}{}
Retrieves parameter values in every particle of a specific parameter
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{key}} (\sphinxstyleliteralemphasis{\sphinxupquote{str}}) \textendash{} parameter name

\end{description}\end{quote}

\end{fulllineitems}

\index{get\_particles() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{get\_particles()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.get_particles}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_particles}}}{}{}
Retrieves the list of particles within the step object

\end{fulllineitems}

\index{normalize\_step\_log\_weights() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{normalize\_step\_log\_weights()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.normalize_step_log_weights}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{normalize\_step\_log\_weights}}}{}{}
Normalizes log weights, and then transforms back into to log space for
all particles inside the step

\end{fulllineitems}

\index{normalize\_step\_weights() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{normalize\_step\_weights()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.normalize_step_weights}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{normalize\_step\_weights}}}{}{}
Normalizes log weights of all particles inside the step

\end{fulllineitems}

\index{plot\_marginal() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{plot\_marginal()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.plot_marginal}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{plot\_marginal}}}{\emph{key}, \emph{save=False}, \emph{show=True}, \emph{prefix='marginal\_'}}{}
Plots a single marginal approximation for param given by \textless{}key\textgreater{}.

\end{fulllineitems}

\index{plot\_pairwise\_weights() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{plot\_pairwise\_weights()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.plot_pairwise_weights}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{plot\_pairwise\_weights}}}{\emph{param\_names=None}, \emph{labels=None}, \emph{save=False}, \emph{show=True}, \emph{param\_lims=None}, \emph{label\_size=None}, \emph{tick\_size=None}, \emph{nbins=None}, \emph{prefix='pairwise'}}{}
Plots pairwise distributions of all parameter combos. Color codes each
by weight.

\end{fulllineitems}

\index{print\_particle\_info() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{print\_particle\_info()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.print_particle_info}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{print\_particle\_info}}}{\emph{particle\_num}}{}
Prints the particle number and its information
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{particle\_num}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} index of the desired particle

\end{description}\end{quote}

\end{fulllineitems}

\index{resample() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{resample()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.resample}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{resample}}}{}{}
Resamples the step based on normalized weights. Assigns discrete
probabilities to each particle (sum to 1), resample from this discrete distribution using the particle’s copy() method.

\end{fulllineitems}

\index{set\_particles() (smcpy.smc.smc\_step.SMCStep method)@\spxentry{set\_particles()}\spxextra{smcpy.smc.smc\_step.SMCStep method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.smc_step.SMCStep.set_particles}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{set\_particles}}}{\emph{particles}}{}
Fill a list of particles in the step with ID.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{particles}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}) \textendash{} list of particle instances

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}

\phantomsection\label{\detokenize{source_code:module-smcpy.smc.particle_initializer}}\index{smcpy.smc.particle\_initializer (module)@\spxentry{smcpy.smc.particle\_initializer}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRessED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNess FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLess THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{ParticleInitializer (class in smcpy.smc.particle\_initializer)@\spxentry{ParticleInitializer}\spxextra{class in smcpy.smc.particle\_initializer}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.particle_initializer.ParticleInitializer}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.smc.particle\_initializer.}}\sphinxbfcode{\sphinxupquote{ParticleInitializer}}}{\emph{mcmc}, \emph{temp\_schedule}, \emph{mpi\_comm=\textless{}smcpy.utils.single\_rank\_comm.SingleRankComm instance\textgreater{}}}{}
Class to initialize particles prior to Sequential Monte Carlo sampling.
\index{initialize\_particles() (smcpy.smc.particle\_initializer.ParticleInitializer method)@\spxentry{initialize\_particles()}\spxextra{smcpy.smc.particle\_initializer.ParticleInitializer method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.particle_initializer.ParticleInitializer.initialize_particles}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{initialize\_particles}}}{\emph{measurement\_std\_dev}, \emph{num\_particles}}{}
Initializes first set of particles based on the prior and proposal
distributions.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{measurement\_std\_dev}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} standard deviation of the measurement error

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{num\_particles}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} number of particles to use during sampling

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{set\_proposal\_distribution() (smcpy.smc.particle\_initializer.ParticleInitializer method)@\spxentry{set\_proposal\_distribution()}\spxextra{smcpy.smc.particle\_initializer.ParticleInitializer method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.particle_initializer.ParticleInitializer.set_proposal_distribution}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{set\_proposal\_distribution}}}{\emph{proposal\_center}, \emph{proposal\_scales=None}}{}
Given the proposal center and (optionally) the proposal scales, sets
the proposal distribution for the initial batch of particles
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{proposal\_center}} (\sphinxstyleliteralemphasis{\sphinxupquote{dict}}) \textendash{} initial parameter dictionary, which is used to
define the initial proposal distribution when generating particles;
default is None, and initial proposal distribution = prior.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{proposal\_scales}} (\sphinxstyleliteralemphasis{\sphinxupquote{dict}}) \textendash{} defines the scale of the initial proposal
distribution, which is centered at proposal\_center, the initial
parameters; i.e. prop \textasciitilde{} MultivarN(q1, (I*proposal\_center*scales)\textasciicircum{}2).
Proposal scales should be passed as a dictionary with keys and
values corresponding to parameter names and their associated scales,
respectively. The default is None, which sets initial proposal
distribution = prior.

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}

\phantomsection\label{\detokenize{source_code:module-smcpy.smc.particle_updater}}\index{smcpy.smc.particle\_updater (module)@\spxentry{smcpy.smc.particle\_updater}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRessED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNess FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLess THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{ParticleUpdater (class in smcpy.smc.particle\_updater)@\spxentry{ParticleUpdater}\spxextra{class in smcpy.smc.particle\_updater}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.particle_updater.ParticleUpdater}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.smc.particle\_updater.}}\sphinxbfcode{\sphinxupquote{ParticleUpdater}}}{\emph{step}, \emph{ess\_threshold}, \emph{mpi\_comm=\textless{}smcpy.utils.single\_rank\_comm.SingleRankComm instance\textgreater{}}}{}
Class for updating particles at each step of Sequential Monte Carlo sampling
with methods for updating log weights and resampling if ess under threshold.

\end{fulllineitems}

\phantomsection\label{\detokenize{source_code:module-smcpy.smc.particle_mutator}}\index{smcpy.smc.particle\_mutator (module)@\spxentry{smcpy.smc.particle\_mutator}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRessED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNess FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLess THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{ParticleMutator (class in smcpy.smc.particle\_mutator)@\spxentry{ParticleMutator}\spxextra{class in smcpy.smc.particle\_mutator}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.particle_mutator.ParticleMutator}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.smc.particle\_mutator.}}\sphinxbfcode{\sphinxupquote{ParticleMutator}}}{\emph{step}, \emph{mcmc}, \emph{num\_mcmc\_steps}, \emph{mpi\_comm=\textless{}smcpy.utils.single\_rank\_comm.SingleRankComm instance\textgreater{}}}{}
Class for mutating particles at each step of Sequential Monte Carlo sampling
with the main \sphinxtitleref{mutate\_new\_particles} method, which uses the MCMC kernal to
determine the distribution along the temperature schedule path.
\index{mutate\_new\_particles() (smcpy.smc.particle\_mutator.ParticleMutator method)@\spxentry{mutate\_new\_particles()}\spxextra{smcpy.smc.particle\_mutator.ParticleMutator method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.smc.particle_mutator.ParticleMutator.mutate_new_particles}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{mutate\_new\_particles}}}{\emph{covariance}, \emph{measurement\_std\_dev}, \emph{temperature\_step}}{}
Predicts next distribution along the temperature schedule path using
the MCMC kernel.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{covariance}} (\sphinxstyleliteralemphasis{\sphinxupquote{numpy Nd array}}) \textendash{} covariance of the parameters between particles,
computed with their respective weights.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{measurement\_std\_dev}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} standard deviation of the measurement error

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{temperature\_step}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} difference in temp schedule between steps

\end{itemize}

\item[{Returns}] \leavevmode
An SMCStep class instance that contains all particles after
mutation.

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}



\section{Particle Module Documentation}
\label{\detokenize{source_code:module-smcpy.particles.particle}}\label{\detokenize{source_code:particle-module-documentation}}\index{smcpy.particles.particle (module)@\spxentry{smcpy.particles.particle}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{Particle (class in smcpy.particles.particle)@\spxentry{Particle}\spxextra{class in smcpy.particles.particle}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.particles.particle.Particle}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.particles.particle.}}\sphinxbfcode{\sphinxupquote{Particle}}}{\emph{params}, \emph{log\_weight}, \emph{log\_like}}{}
Class defining data structure of an SMC particle (a member of an SMC
particle chain).
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{params}} (\sphinxstyleliteralemphasis{\sphinxupquote{dictionary}}) \textendash{} parameters associated with particle; keys = parameter
name and values = parameter value.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{weight}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{ or }}\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} the computed weight of the particle

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{log\_like}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{ or }}\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} the log likelihood of the particle

\end{itemize}

\end{description}\end{quote}
\index{copy() (smcpy.particles.particle.Particle method)@\spxentry{copy()}\spxextra{smcpy.particles.particle.Particle method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.particles.particle.Particle.copy}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{copy}}}{}{}
Returns a deep copy of self.

\end{fulllineitems}

\index{print\_particle\_info() (smcpy.particles.particle.Particle method)@\spxentry{print\_particle\_info()}\spxextra{smcpy.particles.particle.Particle method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.particles.particle.Particle.print_particle_info}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{print\_particle\_info}}}{}{}
Prints particle parameters, weight, and log likelihood to screen.

\end{fulllineitems}


\end{fulllineitems}



\section{MCMC Module Documentation}
\label{\detokenize{source_code:module-smcpy.mcmc.mcmc_sampler}}\label{\detokenize{source_code:mcmc-module-documentation}}\index{smcpy.mcmc.mcmc\_sampler (module)@\spxentry{smcpy.mcmc.mcmc\_sampler}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{MCMCSampler (class in smcpy.mcmc.mcmc\_sampler)@\spxentry{MCMCSampler}\spxextra{class in smcpy.mcmc.mcmc\_sampler}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.mcmc.mcmc\_sampler.}}\sphinxbfcode{\sphinxupquote{MCMCSampler}}}{\emph{data}, \emph{model}, \emph{params}, \emph{working\_dir='./'}, \emph{storage\_backend='pickle'}}{}
Class for MCMC sampling; based on PyMC (\sphinxurl{https://github.com/pymc-devs/pymc}).
Uses Bayesian inference, MCMC, and a model to estimate parameters with
quantified uncertainty based on a set of observations.

Set data and model class member variables, set working directory,
and choose storage backend.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{data}} (\sphinxstyleliteralemphasis{\sphinxupquote{array\_like}}) \textendash{} data to use to inform MCMC parameter estimation;
should be same type/shape/size as output of model.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{model}} (\sphinxstyleliteralemphasis{\sphinxupquote{object}}) \textendash{} model for which parameters are being estimated via MCMC;
should return output in same type/shape/size as data. A baseclass
exists in the Model module that is recommended to define the model
object; i.e., model.\_\_bases\_\_ == \textless{}class model.Model.Model\textgreater{},)

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{params}} (\sphinxstyleliteralemphasis{\sphinxupquote{dict}}) \textendash{} map where keys are the unknown parameter 
names (string) and values are lists that define the prior
distribution of the parameter {[}dist name, dist. arg \#1, dist. arg
\#2, etc.{]}. The distribution arguments are defined in the PyMC
documentation: \sphinxurl{https://pymc-devs.github.io/pymc/}.

\end{itemize}

\item[{Storage\_backend}] \leavevmode
determines which format to store mcmc data,
see self.avail\_backends for a list of options.

\end{description}\end{quote}
\index{fit() (smcpy.mcmc.mcmc\_sampler.MCMCSampler method)@\spxentry{fit()}\spxextra{smcpy.mcmc.mcmc\_sampler.MCMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler.fit}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{fit}}}{\emph{q0=None}, \emph{plot\_residuals=False}, \emph{plot\_fit=False}, \emph{opt\_method='L-BFGS-B'}, \emph{repeats=1}, \emph{save\_results=False}, \emph{fname='opt\_results.p'}}{}
Fits the deterministic model given in self.model to the data in
self.data using ordinary least squares regression. Returns a parameter
map containing the optimized model parameters and the associated sum
of squared error.

The optional input, q0, should be an initial guess for the parameters
in the form of a parameter map (dict).

The optional input repeats dictates the number of times the optimization
process is repeated, each time using the previous result as the new q0.

\end{fulllineitems}

\index{generate\_pymc\_() (smcpy.mcmc.mcmc\_sampler.MCMCSampler method)@\spxentry{generate\_pymc\_()}\spxextra{smcpy.mcmc.mcmc\_sampler.MCMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler.generate_pymc_}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{generate\_pymc\_}}}{\emph{params}, \emph{q0=None}}{}
Creates PyMC objects for each param in  dictionary

NOTE: the second argument for normal distributions is VARIANCE
\begin{description}
\item[{Prior option:}] \leavevmode
An arbitrary prior distribution derived from a set of samples (e.g.,
a previous mcmc run) can be passed with the following syntax:
\begin{quote}

= \{\textless{}name\textgreater{} : {[}‘KDE’, \textless{}pymc\_database\textgreater{}, \textless{}param\_names\textgreater{}{]}\}
\end{quote}

where \textless{}name\textgreater{} is the name of the distribution (e.g., ‘prior’ or
‘joint\_dist’), \textless{}pymc\_database\textgreater{} is the pymc database containing the
samples from which the prior distribution will be estimated, and
\textless{}param\_names\textgreater{} are the children parameter names corresponding to the
dimension of the desired sample array. This method will use all
samples of the Markov chain contained in \textless{}pymc\_database\textgreater{} for all
traces named in \textless{}param\_names\textgreater{}. Gaussian kernel-density estimation
is used to derive the joint parameter distribution, which is then
treated as a prior in subsequent mcmc analyses using the current
class instance. The parameters named in \textless{}param\_names\textgreater{} will be
traced as will the multivariate distribution named \textless{}name\textgreater{}.

\end{description}

\end{fulllineitems}

\index{generate\_pymc\_model() (smcpy.mcmc.mcmc\_sampler.MCMCSampler method)@\spxentry{generate\_pymc\_model()}\spxextra{smcpy.mcmc.mcmc\_sampler.MCMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler.generate_pymc_model}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{generate\_pymc\_model}}}{\emph{q0=None}, \emph{ssq0=None}, \emph{std\_dev0=None}, \emph{fix\_var=False}, \emph{model\_output\_stored=False}}{}
PyMC stochastic model generator that uses the parameter dictionary,
self. and optional inputs:
\begin{itemize}
\item {} \begin{description}
\item[{q0}] \leavevmode{[}a dictionary of initial values corresponding to keys {]}
in

\end{description}

\item {} 
std\_dev0  : an estimate of the initial standard deviation

\item {} \begin{description}
\item[{ssq0}] \leavevmode{[}the sum of squares error using q0 and self.data. Only{]}
used if initial var, var0, is None.

\end{description}

\item {} \begin{description}
\item[{fixed\_var}] \leavevmode{[}determines whether or not variance will be sampled{]}
(i.e., fixed\_var == False) or fixed.

\end{description}

\end{itemize}

\end{fulllineitems}

\index{pymcplot() (smcpy.mcmc.mcmc\_sampler.MCMCSampler method)@\spxentry{pymcplot()}\spxextra{smcpy.mcmc.mcmc\_sampler.MCMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler.pymcplot}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{pymcplot}}}{}{}
Generates a pymc plot for each parameter in self.. This plot
includes a trace, histogram, and autocorrelation plot. For more control
over the plots, see MCMCplots module. This is meant as a diagnostic
tool only.

\end{fulllineitems}

\index{sample() (smcpy.mcmc.mcmc\_sampler.MCMCSampler method)@\spxentry{sample()}\spxextra{smcpy.mcmc.mcmc\_sampler.MCMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler.sample}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{sample}}}{\emph{num\_samples}, \emph{burnin}, \emph{step\_method='adaptive'}, \emph{interval=1000}, \emph{delay=0}, \emph{tune\_throughout=False}, \emph{scales=None}, \emph{cov=None}, \emph{thin=1}, \emph{phi=None}, \emph{verbose=0}}{}
Initiates MCMC sampling of posterior distribution using the
model defined using the generate\_pymc\_model method. Sampling is
conducted using the PyMC module. Parameters are as follows:
\begin{itemize}
\item {} 
num\_samples : number of samples to draw (int)

\item {} 
burnin : number of samples for burn-in (int)

\item {} 
adaptive : toggles adaptive metropolis sampling (bool)

\item {} \begin{description}
\item[{step\_method}] \leavevmode{[}step method for sampling; options are:{]}
o adaptive - regular adaptive metropolis
o DRAM - delayed rejection adaptive metropolis
o metropolis - standard metropolis aglorithm

\end{description}

\item {} \begin{description}
\item[{interval}] \leavevmode{[}defines frequency of covariance updates (only{]}
applicable to adaptive methods)

\end{description}

\item {} \begin{description}
\item[{delay}] \leavevmode{[}how long before first cov update occurs (only applicable{]}
to adaptive methods)

\end{description}

\item {} \begin{description}
\item[{tune\_throughout}] \leavevmode{[}True \textgreater{} tune proposal covariance even after{]}
burnin, else only tune proposal covariance during burn in

\end{description}

\item {} \begin{description}
\item[{scales}] \leavevmode{[}scale factors for the diagonal of the multivariate{]}
normal proposal distribution; must be dictionary with
keys = .keys() and values = scale for that param.

\end{description}

\item {} 
phi : cooling step; only used for SMC sampler

\end{itemize}

\end{fulllineitems}

\index{save\_model() (smcpy.mcmc.mcmc\_sampler.MCMCSampler method)@\spxentry{save\_model()}\spxextra{smcpy.mcmc.mcmc\_sampler.MCMCSampler method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.mcmc.mcmc_sampler.MCMCSampler.save_model}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{save\_model}}}{\emph{fname='model.p'}}{}
Saves model in pickle file with name working\_dir + fname.

\end{fulllineitems}


\end{fulllineitems}



\section{HDF5 Module Documentation}
\label{\detokenize{source_code:module-smcpy.hdf5.hdf5_storage}}\label{\detokenize{source_code:hdf5-module-documentation}}\index{smcpy.hdf5.hdf5\_storage (module)@\spxentry{smcpy.hdf5.hdf5\_storage}\spxextra{module}}
Notices:
Copyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.

Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF
ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR
FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE
SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS,
RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS
RESULTING FROM USE OF THE SUBJECT SOFTWARE.  FURTHER, GOVERNMENT AGENCY
DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF
PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”

Waiver and Indemnity:  RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT.  IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY
LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE,
INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S
USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE
UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW.  RECIPIENT’S SOLE REMEDY FOR
ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS
AGREEMENT.
\index{HDF5Storage (class in smcpy.hdf5.hdf5\_storage)@\spxentry{HDF5Storage}\spxextra{class in smcpy.hdf5.hdf5\_storage}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class }}\sphinxcode{\sphinxupquote{smcpy.hdf5.hdf5\_storage.}}\sphinxbfcode{\sphinxupquote{HDF5Storage}}}{\emph{h5\_filename}, \emph{mode}}{}~\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{h5\_filename}} (\sphinxstyleliteralemphasis{\sphinxupquote{string}}) \textendash{} name of hdf5 file in which to save or from which
to load a particle, a collection of particles, referred to as a
particle step, or collection of steps, referred to as a particle
chain.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{mode}} (\sphinxstyleliteralemphasis{\sphinxupquote{string}}) \textendash{} mode used when opening hdf5 file specified by h5\_filename;
can be ‘w’, ‘r’, ‘r+’, or ‘a’. See h5py docs for details.

\end{itemize}

\end{description}\end{quote}
\index{get\_num\_particles\_in\_step() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{get\_num\_particles\_in\_step()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.get_num_particles_in_step}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_num\_particles\_in\_step}}}{\emph{step\_index}}{}
Returns the number of particles in a particular step.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{step\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of step that the particle belongs too

\end{description}\end{quote}

\end{fulllineitems}

\index{get\_num\_steps() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{get\_num\_steps()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.get_num_steps}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{get\_num\_steps}}}{}{}
Returns number of steps currently stored in the hdf5 file.

\end{fulllineitems}

\index{read\_particle() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{read\_particle()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.read_particle}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{read\_particle}}}{\emph{step\_index}, \emph{particle\_index}}{}
Loads and returns a particle identified by specific step and particle
indices.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{step\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of step that the particle belongs too

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{particle\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of particle within a given step

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{read\_step() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{read\_step()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.read_step}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{read\_step}}}{\emph{step\_index}}{}
Loads and returns a step (and all particles in that step) identified by         a specific step index.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{step\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of step that the particle belongs too

\end{description}\end{quote}

\end{fulllineitems}

\index{read\_step\_list() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{read\_step\_list()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.read_step_list}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{read\_step\_list}}}{}{}
Loads and returns an entire step list (which consists of all
available steps and particles within each step).

\end{fulllineitems}

\index{write\_particle() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{write\_particle()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.write_particle}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{write\_particle}}}{\emph{particle}, \emph{step\_index}, \emph{particle\_index}}{}
Writes a single particle object (params, weight and log likelihood)
to the hdf5 file.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{particle}} (\sphinxstyleliteralemphasis{\sphinxupquote{Particle class instance}}) \textendash{} particle object storing a single parameter vector and
associated weight and log likelihood.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{step\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of step that the particle belongs too

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{particle\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of particle within a given step

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{write\_step() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{write\_step()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.write_step}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{write\_step}}}{\emph{step}, \emph{step\_index}}{}
Writes a step, which is a collection of particles, to the hdf5 file.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode\begin{itemize}
\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{step}} (\sphinxstyleliteralemphasis{\sphinxupquote{list of Particle class instances}}) \textendash{} a list of particle objects, each of which stores a single
parameter vector and associated weight and log likelihood.

\item {} 
\sphinxstyleliteralstrong{\sphinxupquote{step\_index}} (\sphinxstyleliteralemphasis{\sphinxupquote{integer}}) \textendash{} index of step being written

\end{itemize}

\end{description}\end{quote}

\end{fulllineitems}

\index{write\_step\_list() (smcpy.hdf5.hdf5\_storage.HDF5Storage method)@\spxentry{write\_step\_list()}\spxextra{smcpy.hdf5.hdf5\_storage.HDF5Storage method}}

\begin{fulllineitems}
\phantomsection\label{\detokenize{source_code:smcpy.hdf5.hdf5_storage.HDF5Storage.write_step_list}}\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{write\_step\_list}}}{\emph{step\_list}}{}
Write a step list, which is a list of steps, each of which being a
list of particles, to the hdf5 file.
\begin{quote}\begin{description}
\item[{Parameters}] \leavevmode
\sphinxstyleliteralstrong{\sphinxupquote{particle\_chain}} \textendash{} a list of steps, each of which is a list of
particle objects.

\end{description}\end{quote}

\end{fulllineitems}


\end{fulllineitems}



\chapter{Indices and tables}
\label{\detokenize{index:indices-and-tables}}\begin{itemize}
\item {} 
\DUrole{xref,std,std-ref}{genindex}

\item {} 
\DUrole{xref,std,std-ref}{modindex}

\item {} 
\DUrole{xref,std,std-ref}{search}

\end{itemize}


\renewcommand{\indexname}{Python Module Index}
\begin{sphinxtheindex}
\let\bigletter\sphinxstyleindexlettergroup
\bigletter{s}
\item\relax\sphinxstyleindexentry{smcpy.hdf5.hdf5\_storage}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.hdf5.hdf5_storage}}
\item\relax\sphinxstyleindexentry{smcpy.mcmc.mcmc\_sampler}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.mcmc.mcmc_sampler}}
\item\relax\sphinxstyleindexentry{smcpy.particles.particle}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.particles.particle}}
\item\relax\sphinxstyleindexentry{smcpy.smc.particle\_initializer}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.smc.particle_initializer}}
\item\relax\sphinxstyleindexentry{smcpy.smc.particle\_mutator}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.smc.particle_mutator}}
\item\relax\sphinxstyleindexentry{smcpy.smc.particle\_updater}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.smc.particle_updater}}
\item\relax\sphinxstyleindexentry{smcpy.smc.smc\_sampler}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.smc.smc_sampler}}
\item\relax\sphinxstyleindexentry{smcpy.smc.smc\_step}\sphinxstyleindexpageref{source_code:\detokenize{module-smcpy.smc.smc_step}}
\end{sphinxtheindex}

\renewcommand{\indexname}{Index}
\printindex
\end{document}