\chapter{Case Study -- Analysis of Power Consumption Dataset}

In recent years, we observe widespread IoT technologies in everyday life due to the decreasing price of smart sensors and high-quality network availability. Electricity distribution and consumption are no exception, and smart electric meters are now standard components in modern households. It eventually leads to a large amount of sensor data structured as time series, and there is a need for efficient analysis tools to process this information.

As a part of our research in Gauss Algorithmic \footnote{\url{https://www.gaussalgo.com/}}, we got an opportunity to analyze such a dataset. Our assignment was to analyze, find clusters, and detect anomalies in a large dataset of power consumption curves, emphasizing their long-term behavior. We decided to prepare an end-to-end analytic pipeline for this dataset, from the initial data processing to the final outcomes,  that can be further used by other data scientists in their studies.

This chapter will go through all steps in our analytic pipeline on the power consumption dataset using techniques mentioned in the previous chapters and will propose a novel approach for time series transformation.

\section{Dataset Description}
First we will describe in detail the dataset that was used within this thesis. Our dataset consists of a large set of power consumption curves for customers located in Slovakia. Because of the strong emphasis on customers' privacy, all data are completely anonymous. We have only randomly generated numbers from our contracting authority representing customer labels and power consumption curves for every consumer. Thus, we lack information about the customer's location or type (apartment, household, company). We have over 20~000 time series from the February 1st 2017 to August 1st 2018. The sampling rate of our time series is one value in 15 minutes.

This initial step in our analysis aims to determine the quality of input data in terms of missing values, extremes, and dataset size. We found a high rate of incorrect or missing data. There are entirely missing days throughout the period and even several months in 2018 (Fig.~\ref{fig:dataset-example}). On average, we have approximately 52~000 data points, which corresponds to almost 547 days for each customer. In the end, we removed a portion of power consumption curves because they had only a few to none uncorrupted values, leaving us with over 12~000 time series for further analysis.
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{img/dataset-example.png}
    \caption{Example of power consumption curves with missing values and significantly different behavior.}
    \label{fig:dataset-example}
\end{figure}

\section{Requirements}

With our dataset's detailed overlook, we will divide our work into two objectives to accomplish our assignment. The first objective is to process the dataset into a form that could be easily analyzed (\textit{Data Engineering}), and the second goal is to perform the analysis -- clustering and anomaly detection with an emphasis on their long-term behavior (\textit{Data Analysis}).

\begin{enumerate}
    \item \textbf{Data Engineering:} A combination of rapidly changing customer power consumption, sensor errors, changes based on external factors, such as time of the year, and lack of information about a customer makes this task remarkably challenging. Another critical detail is the size of our dataset and the length of individual time series. To explore and analyze this data, we have to prepare the following steps: propose preprocessing and feature extraction resistant to missing data, extract long-term behavior, and maintain reasonable time and space complexity for all steps.
    \item \textbf{Data Analysis:} After the data preparation, we want to analyze our dataset and find outliers. As we are working with a large dataset of time series, we want to prepare meaningful views and visualizations, which will guide a user towards clusters and anomalous data.
\end{enumerate}

\section{Preprocessing}
We are working with a large number of data coming from smart electric meters. It is not unusual to encounter missing or unrealistic values due to sensor or network error. Therefore, it is essential to handle these types of defects in the preprocessing stage so they do not influence the results of the subsequent data analysis.

In our dataset, we distinguish between two unrealistic value cases: values with negative power consumption and sudden dramatic change in power consumption only for a single data point. It is not uncommon to observe a combination of both in one power consumption curve. We assume that this type of error is due to sensor or network failure. To deal with values below zero, we replace them with float \textit{nan} (not a number), representing the missing value. To remove value jumps, we compute our power curve's second derivation and replace values with a disproportionately large absolute value of the second derivation by \textit{nan} values.

We are not replacing the missing values with real numbers in our preprocessing step. Instead, we use the feature extraction technique that is resistant to them. We will address this problem in more detail in the next section.

\section{Feature Extraction}
Consumers' power consumption tends to change rapidly due to sudden extensive usage of electric devices, but it should be more stable in the long-term behavior. Thus we want to extract features that will reflect the long-term behavior and will not be significantly affected by swift changes. These features will provide a better overview of user behavior and make it possible to find users with similar power consumption. To overcome fluctuations of power in short periods, we want to study long-term periodic and non-periodic behavior. We do this by extracting seasonalities (periodic behavior) and trends (non-periodic behavior) in customer power consumption.

Due to the geological location and climate in Slovakia, power consumption is generally changing during the year. The main factors are changes in temperature and sunlight hours through seasons. To capture these changes, we extract weekly seasonality separately for every meteorological season. Another characteristic comes from daily seasonality, where we distinguish between free days and workdays. We also want to utilize trends and yearly seasonalities of our data. As holidays have a substantial impact on power consumption, we want to capture their effect in the model.

For extracting these seasonalities and trends from our data, we are using the Prophet by Facebook \cite{exp:FbProphet}. It uses a decomposable time series model with three main components: trend, seasonality, and holidays \cite{exp:lin-model}. It is formally defined as:
\begin{equation}
    y(t) = g(t) + s(t) + h(t) + \epsilon_t
\end{equation}
Where $g(t)$ is the trend function, $s(t)$ is the seasonality function, $h(t)$ corresponds to the effects of holidays, and $\epsilon_t$ is noise keeping the normal distribution.

Prophet provides an interface to detect changepoints in trends automatically. However, because our data is relatively short, only eighteen months of data, we do not expect any significant trend changes in our data. Thus we are using a linear trend with zero change points. The Prophet uses the Fourier series representation to model multiple periodic effects (seasonalities) with different lengths. We use yearly seasonality, free day and workday daily seasonality, and weekly seasonality for every meteorological season. To include the effects of holidays, it uses a matrix of regressors corresponding to every holiday. This effect is also applied to days before and after the holiday. Other essential features are the ability to deal with missing values, computational speed, and scalability.

In this work, we manually define seasonalities based on the expected behavior of different customers based on the consultation with our contracting authority. First, we expect a different behavior on free days (holidays, weekends) and workdays. Then, because of the weather changes during the year, there can be a change in weekly behavior, so we are using a weekly seasonality for every season. Finally, we want to see the trend and the yearly seasonality. We can see the example of this decomposition in Fig.~\ref{fig:seasonalities}. Using this feature extraction allows us to find customers with similar properties in one seasonality but significantly different behavior in others -- for example, two customers with almost identical seasonalities but significantly higher power consumption could be a sign of energy theft.
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{img/seasonalities.png}
    \caption{Example of seasonalities extracted from a single power consumption curve (top-most curve) from our dataset using the Prophet.}
    \label{fig:seasonalities}
\end{figure}

In summary, we are describing our original time series with eight new time series: free day and workday seasonalities, spring, summer, winter, and autumn weekly seasonalities, yearly seasonality, and trend. In the next section, we will provide techniques for combining information from time series with multiple components with different lengths (\textit{multi-component} or \textit{multi-model} time series) into a single representation.

\section{Interactive Feature Space Building}
Once we use seasonalities and trends, our dataset changes from univariate time series into a multi-component time series consisting of eight time series with different lengths and temporal resolution. Because of the lack of knowledge about the customer, we are working with unsupervised learning on a large dataset of multi-component time series. In our solution, we will first propose a technique for transforming this type of data into a spatial representation and then propose an optimized version of the technique for work with large datasets.

\subsection{Multi-Component Feature DTW Transformation}
We propose a novel technique called \textit{Multi-Component Feature DTW transformations (MCFDTW)} to transform the dataset of multi-component time series into a spatial representation. As Kate \cite{met:fDTW} has shown, it is possible to combine multiple Feature DTW transformations (FDTW). Similarly to his approach, the MCFDTW is a union of FDTW transformations for every component  of our multi-component time series.

Having a dataset $S = {T_0, T_1, \dots, T_n}$ of multi-component time series $T_n = (a_{n0}, a_{n1}, \dots, a_{nj})$, where $a_{nj}$ are time series of an arbitrary length and $A_j = (a_{0j}, a_{1j}, \dots, a_{nj})$ are tuples of time series from one component, we define the MCFDTW transformation as:
\begin{equation}
 MCFDTW(S) = ( FDTW(A_{0}) | FDTW(A_{1}) | \dots | FDTW(A_{j}) )
\end{equation}
where $|$ denotes a concatenation of feature matrices from FDTW transformations.

To increase the efficiency of MCFDTW, instead of the original FDTW transformation, we can use the Prototyped Feature DTW (PFDTW) as it is not computing whole distance matrices.

\subsection{Prototype Selection}
The prototypes are crucial for the success of PFDTW transformation, but their correct selection is a challenging task. Iwana et al. \cite{met:protofDTW} proposed two ways for the prototype selection from the full distance matrix for the dataset. The first one is using statistics to remove statistically insignificant feature vectors from the full distance matrix. This technique is usable in supervised and unsupervised learning, but it is impractical on large datasets because it requires the full distance matrix as a starting point. The second approach uses the AdaBoost algorithm to select the best features for classification, making it available only for supervised learning.

Because in our task, we are working with a large dataset and applying an unsupervised learning approach, we  are proposing several bottom-up methods for the prototype selection:
\begin{enumerate}
    \item Random selection
    \item Manual selection
    \item Selection by density
    \item Selection by Predicted Correlation
\end{enumerate}

\subsubsection{Random Selection}
The first and most straightforward option is to use randomly selected prototypes. This approach is very efficient, and if our sample is large enough, it covers a sufficient portion of the full feature space. Based on our tests on the UCR datasets \cite{exp:UCRArchive2018}, a random prototype selection seems to be a very efficient approach that still produces comparable results in terms of classification accuracy (Appendix~\ref{sec:app-ucr}). Because of these advantages, we recommend using this method of prototype selection as a starting point.

\subsubsection{Manual Selection}
The second approach is selecting specific time series as prototypes by hand. It is usable if the user has deep knowledge about the data and could pinpoint the significant time series. As the resulting feature vectors are the distances to these specific time series, it is easily interpretable for the user.

Even though using only manually selected prototypes has the advantage of additional explainability, the user could miss some important time series. To minimize this problem, we recommend combing manual selection with a random selection. If randomly selected prototypes improved the final results, we could suspect either that we selected improper prototypes or that our selection is too small.

In our pipeline, we are using the combination of dimensionality reduction methods and visualization for the manual selection of new prototypes (see \ref{sec:inter-fsb}~\nameref{sec:inter-fsb}).

\subsubsection{Selection by Density}
Another approach comes from an observation that we need more points to describe a dense region than the sparse one, similar to the Kohonen map \cite{exp:Kohonen1982}. This strategy starts with a random sample and then uses data visualization to select new prototypes from the dense regions and remove prototypes that are far away.

Because after the MCFDTW transformation, the transformed feature matrix has the number of dimensions equal to the number of selected prototypes, we can encounter the Curse of Dimensionality \cite{exp:curse-of-dim}. This is problematic for density-based techniques. Because there is no conventional solution to this issue, instead of using a fully automatic solution, we recommend to use a combination of dimensionality reduction and visualization techniques (see \ref{sec:inter-fsb}~\nameref{sec:inter-fsb}). Based on the work with our dataset, this approach yields stable results.

\subsubsection{Selection by Predicted Correlation}
As two strongly correlated feature vectors do not give much information from a statistical point of view, the last strategy we propose comes from an assumption that we could predict the correlation of potential new prototypes. To do so, we are using the correlations between currently selected prototypes and their feature vectors.

We start with the random prototype selection and transform the dataset into a feature matrix. Then we use Spearman's rank correlation coefficient and compute the correlation matrix between the feature vectors produced from our prototypes. Afterwards, we use the feature matrix and correlation coefficient of other prototypes to train a regressor to predict the correlation on other time series for each prototype. Finally, we select the prototypes with the lowest average predicted correlation.

Unfortunately, this method did not prove significantly better during our tests than the randomized selection of similar size. The prediction of the correlation of new prototypes was reasonably accurate, but it seems that the correlation was not the most reliable predictor of prototype quality. We think that there is an opportunity for future research direction.

\subsection{Interactive Feature Space Building}
\label{sec:inter-fsb}
Considering the techniques used for prototype selection, we split our feature space building process into an interactive iterative pipeline. The pipeline consists of six steps:
\begin{enumerate}
    \item Select a subsample of the dataset.
    \item Build a Prototyped Feature DTW space.
    \item Vizualize the dataset.
    \item Choose new or remove prototypes using the visualization.
    \item Repeat steps 2-4 until we are satisfied with the result or do not evidence any change.
    \item Apply MCFDTW to the whole dataset.
\end{enumerate}

Because our dataset consists of a large number of multi-component time series, we will randomly select a fraction of our dataset in the first step. We are using approximately one-third of our dataset, which allows us to work in real-time. As we expect large groups of similar power curves, the selection of this portion should consist of all major consumer groups, thus minimize the negative effect of not using the whole dataset.

In the second step, we are building the new feature space by using MDFDTW. In the first iteration, we are using the random selection of prototypes. After the first iteration, the feature space building is fully automatic based on the prototypes selected or removed in next step. As we are using the iterative approach, we do not recalculate already computed feature vectors, which increases the efficiency.

In the third step, we are selecting new prototypes using data visualizations. Firstly, we use PCA and UMAP/densMAP to visualize our dataset's global and local structures. As displayed in Fig.~\ref{fig:prototypes}, we can study the local and global structure of the dataset, including prototypes' positions. One point in Fig.~\ref{fig:prototypes} represents a single customer -- one multi-component time series. Using interactive zoom and selection, we can select time series to inspect them directly, study their position and surrounding in the UMAP and PCA transformations, and closely examine their seasonalities and trends (Fig.~\ref{fig:selected-seasonalities}).
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{img/prototypes.png}
    \caption{Visualization of the subsample of Power Consumption dataset using PCA and UMAP. Grey hexagons highlight prototypes.}
    \label{fig:prototypes}
\end{figure}
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{img/selected-seasonalities.png}
    \caption{Example of inspection of seasonalities and trends of selected customers using the interactive selection.}
    \label{fig:selected-seasonalities}
\end{figure}

To help with the inspection, we are providing multiple coloring options. Firstly, it is possible to select, group, and color time series manually. As this coloring is persistent throughout iterations, we can use it to study the change of positions of our time series in terms of their surroundings. Another option is to use coloring by automatic clustering or anomaly detection score. We will discuss this in the next section.

Once we are satisfied with the selected prototypes, we repeat steps 2-4 until we do not see evidence of any significant change in our visualization. Because UMAP/densMAP are stochastic, there are always some changes, but they should not be global (mixing of manually selected groups). Afterwards, we apply the MCFDTW transformation to the whole dataset.

\section{Clustering and Anomaly Detection}
As our dataset is transformed into a feature matrix, we can practically use any clustering algorithm for spatial data. In our application, the user can choose from all methods available in \textit{Scikit-learn} or \textit{HDBSCAN}. To overcome the curse of dimensionality from MCFDTW transformation and to reduce the computational time, we are using two clustering pipelines:
\begin{enumerate}
    \item We are using \textit{PCA} to reduce the number of dimensions into 50-100 dimensions based on the explained variance ratio for \textit{distance-based} clustering methods. Even though these clustering methods are not as affected by high dimensionality as \textit{density-based} methods, they usually perform better on lower dimensions.
    \item For \textit{density-based} methods \textit{OPTICS} and \textit{HDBSCAN}, we use PCA transformation into 50 dimensions followed by UMAP/densMAP embedding into 30 dimensions. As these embeddings preserve the local structure in the data, they help to overcome the sparsity of high-dimensional space.
\end{enumerate}

After the clustering, we can visualize the results in the original visualization of our dataset or its subsample (Fig.~\ref{fig:coloring-cluster}). We can use this view in prototype selection, for example, using prototypes closest to the K-means centers or discovering dense regions using HDBSCAN.
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{img/clustering.png}
    \caption{Using clustering from the K-means method as coloring in the visualization of a subsample of our dataset.}
    \label{fig:coloring-cluster}
\end{figure}

For detecting the anomalies in our dataset, we are using \textit{Isolation Forest} and \textit{LODA}. It is possible to use them on a whole dataset or a selected subsample. As both these methods are very efficient, we use them directly on the MCFDTW feature vector without any dimensionality reduction. Another option for anomaly detection comes from clustering with OPTICS or HDBSCAN, as both methods select certain points as noise.

Similarly to the clustering, we can plot the results of anomaly detection in our visualizations to either study their location within the dataset or to use them for identifying new potential prototypes (Fig.~\ref{fig:anomaly-detection}).
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{img/anomaly_detection.png}
    \caption{Coloring the data points by their anomaly score from the Isolation Forest method. The lower the value, the more anomalous is the data point.}
    \label{fig:anomaly-detection}
\end{figure}

\section{Implementation}
Our solution is mainly usable by data scientists, so we tried to use the tools that are typical and common in this field. We are using the Python programming language, and our solution is distributed as a single open-source package.

We implemented the Feature DTW and related algorithms using the well-known API defined by the \textit{Scikit-learn} project \cite{exp:sklearn_api,exp:scikit-learn}, which is the most used tool for machine learning in Python. As \textit{Scikit-learn} does not natively support work with time series, we stick to the time series interface defined by the \textit{Tslearn} library \cite{exp:tslearn}. We are using \textit{dtaidistance} \cite{exp:dtaid}, \textit{fastdtw} \cite{exp:fast-dtw-pack}, \textit{dtw-python} \cite{exp:dtw-1}, and \textit{Tslearn} \cite{exp:tslearn} python packages for computing the DTW distance and its various approximations.

Based on our knowledge of data science work, the most significant part is in the \textit{IPython} \cite{exp:ipython} and \textit{Jupyter notebooks} \cite{exp:jupyter}, and so our implementation is fully integrated into these technologies. For the visualization and rendering, we use the combination of \textit{Matplotlib} package \cite{exp:matplotlib} for smaller non-interactive visualizations, \textit{Bokeh} server \cite{exp:bokeh} for interactive visualizations, and \textit{Datashader} \cite{vis:datashader} for processing and rendering the large time series.

Even though there are some implementations of the LODA anomaly detection method, none of them is complete, and all of them lack the feature to explain the cause of the anomaly. We prepared an open-source \textit{anlearn} anomaly detection python package \footnote{\url{https://github.com/gaussalgo/anlearn}} with our implementation of LODA, that is, to the best of our knowledge, the only one containing sparse projections and the ability to explain cause of the anomaly.

As we want our work to be fully replicable, we are using the \textit{Nix} package manager \cite{exp:dolstra2008nixos} in combination with pinned requirements for all Python packages and their dependencies. This allows us to have a fully replicable work environment with the exact version of Python and all the used packages.

We were using only open-source packages in our work, and all of our source codes, including all notebooks from experiments, are available in our Github repository \footnote{\url{https://github.com/H00N24/visual-analysis-of-big-time-series-datasets}}.

\section{Results}
In our analysis, we prepared a complete processing pipeline for the large dataset of power consumption curves, starting from feature extraction and ending with data visualization, clustering, and anomaly detection.

When manually comparing time series close together in the UMAP visualization, we can see similarities in seasonalities, trends, and statistical properties. Because of this fact, we can assume that the Multi-Component Feature DTW transformation maintained properties necessary for further analysis of multi-component time series.

Upon a visual exploration, we can see two obvious larger well-separated clusters in our data (Fig.~\ref{fig:all-data-umap}). In K-means clustering, we can see that both visual clusters are divided into convex similar-sized clusters (Fig.~\ref{fig:all_data_kmeans}). In HDBSCAN clustering, we can see six clusters and a relatively large portion of noise data points (Fig.~\ref{fig:all-data-hdbscan}). Interestingly, the two large clusters from the visualization are divided very unequally. The first consists only of a single cluster, while the second one of multiple smaller clusters with noise between them.
\begin{figure}[H]
 \centering
 \begin{subfigure}[b]{0.495\textwidth}
    \centering
    \includegraphics[width=\textwidth]{img/all-data-umap-kmeans.png}
    \caption{}
    \label{fig:all_data_kmeans}
 \end{subfigure}
 \hfill
 \begin{subfigure}[b]{0.495\textwidth}
    \centering
    \includegraphics[width=\textwidth]{img/all-data-umap-hdbscan.png}
    \caption{}
    \label{fig:all-data-hdbscan}
 \end{subfigure}
\caption{
    (a) displays the K-means clustering on power consumption dataset. (b) shows the HDBSCAN clustering. Cluster labels are positive numbers, in HDBSCAN clustering $-1$ corresponds to noise.
}
\label{fig:all-data-umap}
\end{figure}

In anomaly detection, we used Isolation Forest and LODA methods. The results are slightly different, but we can see overlap in the group of most anomalous points. As the anomalous points have visually different power consumption curves, seasonalities, trends, and statistical properties than the rest of the points, we can consider these users to have an anomalous behavior (Fig. \ref{fig:anomalous-users}).
\begin{figure}[htp!]
    \centering
    \includegraphics[width=\textwidth]{img/anomalous-users.png}
    \caption{Example of anomalous consumers detected by Isolation Forest and LODA methods. Color denotes a single customer.}
    \label{fig:anomalous-users}
\end{figure}


% METHOD
%=============================================================================
% Light curve simulations
%   - Intro
%   - Planet injections
%   - Planet detection
%   - Optimizing cadence and observing strategy
% Results
%   - Prospects: yields and predictions
% Discussion & Conclusion
%   - Caveats and challenges
%   - Implications
%=============================================================================

\section{Method}

% Light curve simulations - Intro
We tested the potential for finding extra-galactic planets and small stars in
this survey by simulating light curves with a cadence of five minutes and a
white noise amplitude of 5.3\%, estimated using the DECam exposure time
calculator.
We assumed that observations would take place continuously over 6 hours per
night, for 9 nights.
% We also used these simulations to optimize our observing strategy.
%   - Planet injections
We generated transit signals for planets with a range of randomly generated
radii and orbital periods, all orbiting Sun-like stars.
The orbital periods of these planets ranged from around 8 hours to 10 days and
the planet sizes ranged from 0.5 to 2 times the radius of Jupiter.
2000 Exoplanet transit signals were generated using the {\tt batman} code
\citep{kreidberg2015}, and injected into a set of 2000 simulated light curves.

%   - Planet detection
In order to detect the planets in our simulated data set we used the
box-least-squares, {\it BLS}, algorithm built into {\tt astropy}
\citep{astropy}.
This algorithm fits an upside-down tophat, or `box' function, approximating
the shape of an exoplanet transit, to a light curve over a grid of orbital
periods, transit epochs and transit durations.
It reports the log-likelihood (-$1/2\chi^2$) of the light curve data, at each
value of orbital period, transit epoch and duration.
In high signal-to-noise cases the log-likelihood is greatest at the period of
the injected transit.
However, when the transit depth is small compared to the white noise in the
light curve, and/or when its orbital period is long, the log-likelihood may not
necessarily have a significant peak at the true period.
When attempting to detect planet transits in our simulated light curves, we
required that the maximum BLS log-likelihood was greater than 15 (this
threshold was established from simulated light curves with {\it no} injected
exoplanet transit).
If a light curve met this criterion, we measured the difference between the
maximum-likelihood period and the true orbital period of the planet and, if
the difference was less than 10\% of the period we injected, we classed that
as a `successful' planet detection.
Figure \ref{fig:completeness} shows a completeness map of planet detectability
as a function of injected radius and orbital period.
The color of each grid rectangle represents the fraction of planets that were
successfully recovered within that radius and period range.
The fraction of detected planets increases with increasing planet size and
decreasing orbital period due.
In this experiment we successfully detected 113 out of the 2000 injected
planets, preferentially recovering the larger planets on shorter orbital
periods.
This gives an overall completeness of around 6\%, integrated over the entire
orbital period and planet radius range tested here.
Of the 113 detected planets, 5 were smaller than Jupiter.
Our pipeline completeness for planets smaller than Jupiter is therefore around
0.25\%.

% To generate these results we simulated light curves with a 3 minute cadence,
% over two sets of 9 consecutive nights, separated by a lunar month.
% These results indicate that we may be able to detect inflated hot Jupiters
% (planets with radii between 1 and 1.5 $R_{\mathrm{Jup}}$) with orbital periods
% between 8 hours and 4 days.

\begin{figure}
  \caption{The completeness of our exoplanet transit detection pipeline as a
    function of planet radius and orbital period.
    This figure summarizes the results of our injection and recovery tests and
    indicates that our planet detection pipeline is sensitive to inflated hot
    Jupiters (planets with radii between 1 and 1.5 $R_{\mathrm{Jup}}$) with
    orbital periods from around 8 hours up to 4 days.
    This figure shows the results of a simulated DECam survey with a cadence
    of 5 minutes over 6 hours of observations per night.  Observations are
    simulated over 9 consecutive nights.
}
  \centering
    \includegraphics[width=1\textwidth]{completeness.pdf}
\label{fig:completeness}
\end{figure}

% %   - Optimizing cadence and observing strategy
% % We tested a range of cadences by injecting planets into light curves with
% % different cadences and corresponding white noise amplitudes and running BLS on
% % these light curves.
% We simulated DECam light curves with a range of cadences and corresponding
% white noise amplitudes.
% We tested cadences of 3, 5, 8 and 10 minutes with SNRs of 7.0\%, 5.3\%, 4.2\%
% and 3.8\% respectively and found that the most rapid cadence, 3 minute
% integrations, resulted in the largest number of successfully detected
% exoplanets by a marginal amount, despite having the worst photometric
% precision per exposure.
% We also tested a range of observing strategies.
% We simulated light curves for 2 sets of 9 consecutive nights separated by a
% lunar month and 4 sets of 9 nights where observations are conducted
% every-other-night, separated by a lunar month.
% We found that closely spacing nights of observations resulted in a slightly
% larger overall number of recovered planets, with slightly more small planets.
% Spreading the same number of nights over a longer baseline with gaps in
% between resulted in slightly better recovery of planets on longer orbital
% periods, although a smaller number of planets were recovered overall.
% % Since our sensitivity to planet transits rapidly decreases with increasing
% % orbital period, and our planet detection pipeline we structure our observing strategy

% found that targeting the
% L \& SMC over multiple series of consecutive nights resulted in a greater number
% of detected exoplanets than spreading the same number of nights over a longer
% time baseline.

% Results
%   - Prospects: yields and predictions

% Discussion & Conclusion
%   - Caveats and challenges
There are some caveats and limitations to the simulations conducted here.
Firstly, we only included white noise in our simulated light curves, however
time series photometry obtained from the DECam is likely to have correlated
noise due to changes in the point spread function as the instruments flex with
shifting attitude, temperature and pressure.
In addition, planet transits and eclipses may be superposed on time-variable
signals from the host star due to its rotation.
Another caveat to this study is that we only simulated transit signals with
zero impact parameter, \ie\ planets transit across the center of the star and
have the longest duration (and deepest) possible transit.
Finally, we did not convolve transit light curves with the integration window.
Transit features are therefore sharper (and easier to detect) than they would
be in a realistic survey.

%   - Implications
% These simulations indicate that we will be able to detect small stars or giant
% planets orbiting Sun-like stars with Large and Small Magellanic clouds.


%%% result.tex
%% displays experimental setup, and description of matrices
We performed a series of experiments to test robustness and overhead of our algorithm described in~\refsec{sec:connected}.

%ODED - this subsection should be part of the experimental setup/
\subsection{Fault Injection Methodology}
Since memory accesses are most performance critical part in~\sv computation, we inject faults in memory access pattern. There are two main memory accesses in~\sv iteration: traversing adjacency list for each vertex; and
accessing $CC$ array for each vertex in adjacency list.

%ODED - in our meeting yesterday you stated that f was not a rate (between 0 and 1) rather it represented the actual number of errors.  Here is seems that it is rate.
In the first case, before each~\sv sweep, we randomly select $f|E|$ edges, where $f$ is fault-rate. Let $e=(v,u)$ be  one of the selected edges. When we encounter $e$ while traversing adjacency list of $v$, we flip one of the bits of $u$---the vertex which $e$ is pointing---randomly.
Therefore, due to the fault, $v$ will visit flipped vertex $\hat{u}$, instead of accessing $u$.

In the second case, we will again choose another set of $f|E|$ edges. Let $e=(v,u)$ be  one of the selected edges. When we encounter $e$ while traversing adjacency list of $v$, we flip one of the bits of $CC[u]$.
Therefore, due to the fault, $v$ will visit the correct vertex, however, it see incorrect value of  $CC[u]$.
It should be noted that $CC[u]$ will be accessed multiple times in a~\sv iteration, and we assume that
all accesses to $CC[u]$ in an iteration are independent. In other words, if $CC[u]$ is accesses while visiting
vertex $v_{1},\ v_{2}$, and if $CC[u]$ is corrupted while visiting $v_{1}$, then $CC[u]$ may or may not be corrupted when it is accessed while visiting $v_{2}$.

\subsection{Experimental Setup}

%ODED - the term "matrix" should never appear in the paper. We should only use the term "network" or "graph"
% type of matrices
\paragraph{Test Graphs}
The graphs used in our tests are listed in~\reftab{tab:graphs}.
These graphs are taken from the 10th Dimacs Implementation Challenge~\cite{Bader-dimacs-graph2014}, come from various real and synthetic applications.
\input{matrix_table}

\paragraph{Testbed}
\input{sysinfo_table}
We prototyped baseline and fault tolerant implementation using $C$ language.
We used the Intel C Compiler (ICC 15.0.0), with highest level of
 optimization $-O3$ to compile our benchmarks.
%ODED - instead of using a table for this system, I would probably just put the properties in text.
%ODED - be specific on the type of processor being Intel Xeon XYZW
We ran all our experiments on SNB16c, key properties of the systems are listed in~\reftab{tab:sys_info}

\subsection{Convergence in presence of faults}

\begin{figure}[tbp]
\includegraphics[width=.5\textwidth]{plots/plot_conv.eps}
\caption{\label{fig:con-plot}
\small Comparison of model-driven work partitioning scheme to
two static work partitioning scheme}
\end{figure}

First, we try to understand the convergence property of~\sv algorithm
in presence of faults.
Recall that in the worst case, an \emph{acceptable} fault that is not detected by~\refalg{alg:FTSV_ALG}, may delay the convergence by one iteration. On the other hand, one additional iteration means additional faults, which may necessitate an additional iteration for convergence.
Thus, it is expected that with increasing fault rate, convergence might slow down. To understand practicality of our algorithm, it becomes essential to understand such slow down in convergence.

% what do we do
In~\reffig{fig:con-plot}, we show the convergence of \sv~algorithm in presence of faults for four graphs. We vary the fault rate from $2^-{10} \times |E|$ bit flips in every~{\sv}~ iteration to $2^-{1} \times |E|$ bit flips. Note that this fault injection rate is extremely high and, we do so to stress test the proposed algorithm.

%what do we observe
In~\reffig{fig:con-plot}, we observe that for all practical fault rates($<2^{-6}|E|$) , algorithm converges without any additional iteration.
Additionally, except~\graphname{astro-ph}, all other graphs converge to correct solution within 5\% additional iteration at the highest fault rate. As such, we conclude that our proposed algorithm can withstand high fault rates, with minimal additional iteration overhead.

% why do we observe that
The difference in behavior between graph~\graphname{astro-ph}, and other graphs is due to two reasons. First, the graph~\graphname{astro-ph} has  the smallest diameter all four test cases, and it only takes 10 iterations in fault free case to converge. If a fault that might cause an additional iteration occurs, it provides fewer opportunity to be corrected in later iterations. Secondly, ...

\subsection{Overhead of fault detection and correction}

\begin{figure}[ht]
\includegraphics[width=.6\textwidth]{plots/plot_zero_overhead.eps}
\caption{\label{fig:zero-oh-plot}
\small Comparison of model-driven work partitioning scheme to
two static work partitioning scheme}
\end{figure}

\paragraph{Overhead with increasing Faults}

%% compare it with double modular redundancy
In addition to extra iteration to converge, extra computation that goes in
fault detection  and correction can be also a source of significant overhead.
We analyze overhead of fault detection and correction in two parts.
 First, we evaluate the overhead of algorithm \ftsv when no faults are injected.
  Then, we evaluate how overhead of proposed algorithm behaves at different fault rates.

\paragraph{Zero-Overhead} Zero-overhead denotes the overhead of the algorithm
in absence of any injected faults. In this case, all the additional computation
 goes into fault detection. We compare the zero-overhead of~\refalg{alg:FTSV_ALG}, with
 fault free execution of~\refalg{alg:SV_ALG}.

 %
 In~\reffig{fig:zero-oh-plot}, we show the \emph{relative} zero-overhead of~\refalg{alg:FTSV_ALG}
 different test graphs. In all the test cases, zero-overhead remains smaller than 25\%.
 In the graphs with smaller $|E|/|V|$ ratio, for instance~\graphname{citationCiteseer} ($|E|/|V|=4.3$),
 \graphname{coAuthorsDBLP} (3.3), \graphname{rgg\_n\_2\_18\_s0} (5.9), have large zero-overhead. On the other hand graphs with large $|E|/|V|$ ratio such as \graphname{kron\_g500-simple-logn18} ($|E|/|V|=40$), we observe small zero-overhead. This variation of zero-overhead with $|E|/|V|$ ratio, us expected as asymptomatic complexity of fault detection in an ~\ftsv iteration is $\mathcal{O}(V)$, while cost of an ~\sv iteration is $\mathcal{O}(|V|+|E|)$.

\paragraph{Overhead of~\ftsv in presence of faults}

\begin{figure}[ht]
\includegraphics[width=.5\textwidth]{plots/plot_overhead_fault.eps}
\caption{\label{fig:oh-plot}
\small Comparison of model-driven work partitioning scheme to
two static work partitioning scheme}
\end{figure}

We evaluated overhead of~\ftsv in presence of faults to understand scalability of the proposed algorithm
with increasing fault rates. To do so, we vary fault rates from $2^-{18}|E|$ to $2^-{6}|E|$ distinct bit
flips in every iteration for all test graphs. In~\reffig{fig:oh-plot}, we show the the relative overhead
of ~\ftsv algorithm with respect to increasing fault rates for four matrices.
We expect that overhead will increase linearly with increasing fault rates.
For all the four matrices, overhead of fault detection is small for fault rates upto $2^{-10}|E|$ bit flips
in every iteration. Beyond $2^{-10}|E|$, we see overhead increasing slowly, however increase in all the cases
is sub-linear.
This is due to many graphs considered in our study follows power law distribution of for degree of vertices, thus
these graphs have very high number of vertices with very small degrees, thus correction
for large number of vertices are $\mathcal{O}(1)$ operations.
Among all the graphs tested, the graph \graphname{kron\_g500-simple-logn18} showed steepest increase in overhead with increasing
 fault rates. The graph \graphname{kron\_g500-simple-logn18} is a random Kronecker geometric graph and
  has very uniform distribution of degree among vertices, and
  thus with fault rate, correction cost shows  linear increase.
In all cases even in the highest fault rates considered in the paper, net overhead of \ftsv were smaller than 35\%.
 In contrast to that, naive redundency based fault tolerance algorithm will have overhead of more than 100\%.
 Thus, we see that \ftsv can tolerate efficiently withstand high fault rates.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Probability and Statistics Analysis}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{center}
  \begin{minipage}{0.5\textwidth}
    \begin{small}
       I suppose this could be a quote about how ice has changed? When in doubt, look at the stats
    \end{small}
  \end{minipage}
  \vspace{0.5cm}
\end{center}

\noindent The statistic quantities returned during the analysis of the broadband noise

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction to Statistical Analysis}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% this may not be the best name?

A broadband analysis of the ambient sound level (ANL) recorded by the SHRUS was performed using the data from SHRU5. To keep consistency with \cite{BonnelMain}, the data for this analysis comes from SHRU5 as it had the least self noise compared to other SHRUS. Each band was 50 Hz wide and centered on frequencies from 50 to 1900, 50 Hz apart for a total of 40 frequency bands bands.
\begin{enumerate}
\item  Why choose the 50-1900 band? The original sampling rate of the SHRUS is $f_{s}$ 3906.2 Hz so by the Nyquist sampling frequency, the maximum reliable frequency that can be analysed is 1900.
\item While the original paper examined a frequency band around 300 Hz of 250-350 Hz, It can be assumed that the
\end{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Probability and Statistics Methods and Results}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Ambient Noise Histogram}
\textbf{Description: }
This is an image of one histogram ranging of the ambient noise level at each bin of time from 50 to 1900 Hz. The y axis is the count of the (probability distributed function) pdf normalized histogram bin, the x-axis is the ambient noise level (ANL) in dB referenced to  $1 \mu Pa/Hz$. The blue histograms are ice with duct, the red buckets are ice without the duct, and the yellow bucket is no ice and no duct. This coloring convention by environmental  hold for all statistic figures. The number in the bins isn’t as important as the distribution of the histograms.

\textbf{Analysis: }
There is a general trend of shifting down in ANL across all frequencies, with 50 Hz’s no ice being the loudest above 100 dB and ice without duct being the quietest at about 50 dB. It would appear that the quietest ambient under ice sound is about 55 dB and is quietest in the ice without duct bins. Loudest is No Ice
In terms of shape, the 'no ice' condition histogram is more normal or Gaussian in form over most of the frequencies. Ice with duct (blue) in normal in shape from 50 to about 550 Hz, above 600 Hz is begins to be skewed right. Ice without duct (red) is normal from 50 to about 250 Hz, after which is becomes skewed right as well.
The largest stratification between the three bins are between the frequencies of 150 Hz to 500 Hz

\textbf{What does this mean?}
It is commonly said that it is quiet under ice, and this figure directly reflects that through the distribution of sound levels in these three different bins. Metrics such as mean ambient noise level and pairwise difference reflect the differences between these sound metrics. Similar to the original paper's 300 Hz histogram\autocite{BonnelMain}, there are three distinct peaks of ANL at 500 Hz. This phenomena of three

\textbf{chang this fig to be closer to peaks, unlock lims}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{Figures/ambient_hist_450_550.jpg}
\caption{Histogram of normalized ANL at 500 Hz band for conditions Ice with duct (blue) }
\label{fig_hist500}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% order above?
\subsection{Ambient Noise Histogram Comparison}
For this section, four fistograms at frequencies lwo mid mid high will be compared so we can see what happs

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Average ANL}
\textbf{Description}
This Figure shows the average ambient noise level generated using the mean function of MATLAB. ANL in dB referenced to $ 1 \mu Pa^{2}/Hz$ are the units of the y axis and frequency is on the x axis. The averages for ice with duct are in blue, the averages for ice without duct are in red, and the no ice is in yellow

\textbf{Analysis}
The general negative trend is present across all three types, with no ice behaving linearly and ice with/without duct behaving more exponentially
In this band, and with these environmental conditions, as frequency increases, ANL decreases. Beyond 1900, the SHRUs were above the Nyquist frequency necessary to record samples so that data isn’t valid.
There are little spikes every four points or so in the data, probably caused by the n-50 band being slightly more active at that point.

\textbf{What does this Mean}
What’s really important, and what we want to take away from this Figure 2 is WHY the ANL decreases with frequency. It’s probably because most of the ambient noise in the Arctic when there is ice is generated by the movement of the ice itself - grinding, slipping, and shearing. When there is no ice, then there is shipping, which has lots of ambient propeller noise
Things to consider: what else functions in these bandwidths of activity, like whales and other biologic factors? Is what we do going to negatively impact them?

add grid, cutoff earlier

\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{Figures/Average_ANL_cutoff.jpg}
\caption{Average ANL at frequencies from 50 to 1900 Hz.}
\label{fig_avg_anl}
\end{figure}

\subsection{Total Variation Distance}
\textbf{Description}
Total variation distance is a distance in probability theory and is the absolute area between two curves. The equation is

% equation for infinite
\begin{equation} \label{totalvardist}
\delta(,Q)=sup_{A\epsilon F}\mid P(A)-Q(A)\mid
\end{equation}

where P and Q are probability measures on a sigma-algebra F of subsets of the sample space omega, Ω. The sigma algebra (σ-algebra/σ-filed) of a larger set A is a collection of subsets called F. For a finite data set such as this, the total variation distance is related to the L1 norm (the 1st norm for a finite dimension vector space) by the following identity:

% equation for finite
\begin{equation} \label{eq:finitetotvar}
\delta(P,Q)=\frac{1}{2}\mid P(\omega)-Q(\omega) \mid
\end{equation}

Where $\omega$ is the finite subset of the sample space omega: $\Omega$
Total variation distance looks at all the data across all the frequencies, with the count of each bin as a proportion. It takes every value of the probability of that bin and takes the sum of the absolute difference. The range of this value for total variation distance is not constrained, and represents the “largest possible difference between the probabilities that the two probability distributions can assign to the same event,” which we can approximately translate to the largest possible difference in occurrence that a frequency can have between the two acoustic conditions. It is NOT a measure of ANL in dB but probability of occurrence between two conditions. 1 means 100\% different, 0 means 0\% different.
This data set was normalized in the function 'histcounts' using ‘Normalization’, ‘pdf’. But because its probability does that no longer become an issue
For the purposes of this analysis, the total variation distance uses the following equation:

% equation used for our annalysis
\begin{equation} \label{eq:actualtotvar}
\delta(Duct, No Duct)=\frac{1}{2} \Sigma \mid Duct(f) - No Duct(f) \mid
\end{equation}

Where N\_duct is the number in each bin of the duct condition, and N\_no\_duct is the number in each bin of the no duct condition. The integer i is equivalent to the subset of the entire set of data, and in this case refers to the specific frequency of the subset. One number is returned by this equation that sums up the total variation distance between the two conditions. The values passed to the 'histcounts' function were normalized pdf.

\textbf{Analysis}
This metric shows the probability between each data set overlapping. Since totally variation distance uses all of the data points, it only makes sense to view this frequency by frequency. The highest variation distance between the conditions ‘Ice with Duct and Ice Without duct’ occurs at 50 Hz at a value of 0.44. The highest variation distance between “ice with Duct and No Ice” occurs at 600 Hz with a distance of 0.63. The highest variation distance for “no-ice and no-duct” occurs at 600 Hz and at a value of 0.72.

\textbf{What does this Mean?}
Interpreting this graph is kind of difficult, but the easiest way to interpret it is by acoustic environment. There is a high difference between “no ice and no duct”; a mid level difference between “ice with duct and no ice”. There is the least amount of difference between “ice with duct and no duct” - the sound conditions are most similar here.
Yellow = really different conditions. Blue = more similar conditions

\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{Figures/recolor_total_var_dist_norm_pdf.jpg}
\caption{Total Variation distance frequencies from 50 to 1900 Hz.}
\label{fig_totvardist}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Pairwise Difference}
\textbf{Description}
Pairwise difference is the length between the two bins at the same frequency between the two noise types being analyzed. It is different from total variation distance in that this metric is not probability but is actually the difference between the peak of each acoustic condition. Pairwise difference in the context of this analysis means the difference between each condition's histogram peaks or mode, the maximum probability occurrence of hydrophones. Because the data is being compared  is why the resulting parameter is in terms of Hz, and not a probability.
The pairwise difference was calculated using the following equation:

%pair_dist_duct_noduct(i)=edges_duct(ind_duct(i))-edges_no_duct(ind_no_duct(i))
\[Pd(f)=mode_{condition}(f)-mode_{condition}(f)\] 	% this is not actual stat distance
% argmax of hist-argmaxofhist, repeat equation

Where mode\_{condition} refers to the ANL bin of maximum count of that histogram, \textit{f} is the frequency of interest, and edges*. The differences are between the three conditions and are made to product positive differences (absolutes)
The xaxis of this graph is frequency in Hz, the y-axis is the difference in ANL in dB. Red denotes the difference between “no ice and ice without duct”, the yellow denotes the difference between “no ice and ice without duct” and blue denotes the difference between “ice with duct and ice without duct”

\textbf{Analysis}
The conditions with the highest overall difference are “no ice and no duct”. The condition with the lowest overall difference is “ice with duct and no duct”. The highest difference is at 450 Hz with a 23.8 db difference. The lowest difference is at 1400,1600-1800 with a difference of 0.
“No ice/ice no duct” goes up then decreases after the 450 peak; “no ice/ ice no duct” increases from 50 to 1100 Hz and mostly plateaus after. “Ice with duct and ice without duct” peaks from 200-500 then drops, going to zero in the higher frequencies

\textbf{What does this Mean?}
Similar to above, there is the least amount of difference between “Ice with duct and ice without duct.” There is the biggest difference between “ice no duct and no ice”. This means that the conditions ice with duct and ice no duct are very similar, while the conditions “ice no duct and no ice” are the most different in ANL.
Yellow = high difference in condition - Blue = very similar condition. Peak band for all 100-900

\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{Figures/recolor_pairwise_dist_ANLs.jpg}
\caption{Pairwise distance for frequencies from 50 to 1900 Hz.}
\label{fig_pairwisedist}
\end{figure}

\subsection{ANL Modes}
\textbf{Description}
This is an image of the mode or most highly occurring bin of each histogram and therefore the approximate ‘most likely occurring’ sound level for that frequency

\textbf{Analysis}
There is a higher occurrence of higher dB at the lowest frequencies, which moves down thereafter
 Both the Blue Line and the red line reach down around 800 Hertz and stay low at that level.
As frequency increases, the mode of each decreases

\textbf{What does this Mean?}
Lower frequencies are louder/noisier, but as we go up in frequency Both ice with duct and eyes without duct Plateau at about 55 decibels, making this the Ambient sound noise level for these frequencies
On the other hand, it can be seen that it is significantly louder when there is no ice present in the Arctic with sound levels plateauing around 75 decibels
Louder without ice. Quieter under ice

\begin{figure}[H]
\centering
\includegraphics[scale=0.5]{Figures/mode_ANL_allfreqs.jpg}
\caption{Mode of ANL for frequencies from 50 to 1900 Hz.}
\label{fig_mode}
\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Correlation Between Frequencies}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\textbf{probs a bad way to start, fix later }Now, let's take a look at the how the frequencies are related to each other, the correlation between frequencies. In \autoref{fig_freq_corr} the correlation between each frequency is shown for each of the three environmental conditions. It is worth noting that the p-value for each of the correlations is an identity matrix, so the likely hood that the null hypothesis is true is zero percent, expect when the same frequency is compared against itself when the p-value is 1. The correlation values range from 0.4758 under the 'ice without duct' condition to 1 when frequencies are compared against themselves.

Other than the lowest frequencies, correlation between almost all of the frequency bands is quite high. This suggests that the acoustic drivers of the Arctic's ANL are largely broadband in nature. Each environmental condition does act differently when high and low frequencies are compared to each other, resulting in different shapes of the correlation graphs. The 'no ice' condition has distinct bands of correlation around 0.7 and 0.9 for the 100-200 Hz and 200-300 Hz comparisons; elsewhere is is ~1, resulting in a boxy high correlation block. The 'ice without duct' condition

\begin{figure}[h]
\centering
\includegraphics[scale=0.38]{Figures/corr_all_1x3.jpg}
\caption{Correlation between broadband frequencies for }
\label{fig_freq_corr}
\end{figure}

% the end of statistic section
\section{Probability and Statistics Conclusions}
% a summary of the results from above 'the what it means' section


\subsection{Combining operations}

Simple operators, such as bitwise operators and bit shifts, can be combined to create more complex operators. These could have a large number of inputs, outputs and logical gates.


% mainfile: ../../Refinement.tex
The \findex[\picalc{}|(]{\picalc{}} is a process algebra that can be used to describe a behavior of communicating mobile systems. This section introduces the pure polyadic version of the \picalc{} as described in \cite{milner}.

\subsection{Intuition}
\label{sec_pi_intuition}
\input{chapters/mainpart/preliminaries/sections/pi_calculus/subsections/pi_intuition/pi_intuition}

\subsection{Syntax}
\label{sec_pi_syntax}
\input{chapters/mainpart/preliminaries/sections/pi_calculus/subsections/pi_syntax/pi_syntax}

\subsection{Semantics}
\label{sec_pi_sem}
\input{chapters/mainpart/preliminaries/sections/pi_calculus/subsections/pi_semantics/pi_semantics}

\subsection{Visualization}
\label{sec_pi_visualization}
\input{chapters/mainpart/preliminaries/sections/pi_calculus/subsections/pi_visualization/pi_visualization}

\subsection{Mobility}
\label{sec_pi_mobility}
\input{chapters/mainpart/preliminaries/sections/pi_calculus/subsections/pi_mobility/pi_mobility}

\subsection{Strong simulation}
\label{sec_pi_simulation}
\input{chapters/mainpart/preliminaries/sections/pi_calculus/subsections/pi_simulation/pi_simulation}

\newpage %%%%%%%%%%%%%%% NEWPAGE!


\section{Albantakis et al., Evolution of Integrated Causal Structures in Animats Exposed to Environments of Increasing Complexity, 2014}
The study uses the animat approach,  \vref{sect:agent}, to evolve autonomous agents on a traditional, discrete-state computer.
The authors use a Simple Genetic Algorithm to evolve the animats, \vref{sect:ea}.
As is required in the animat approach, the study varies the complexity of the task environments.
Through analysis by use of the IIT, the researchers show that ``in complex environments with a premium on context-sensitivity and memory, integrated brain architectures have an evolutionary advantage over modular ones.''\cite{albantakis_evolution_2014-1}

The study finds that during evolution, some animats may develop a system that consists of one main conceptual complex. In contrast, other animats develop networks of segregated modules with feed-forward architecture. The study assumes that the evolution of animats will follow the same patterns as a natural evolution, where characteristics of economy, functions, adaptability, and robustness are favorable to the simplicity of design.

Each neural network "animat" consists of eight deterministic logic-gate elements. These are two sensors, four hidden elements, and two motors (left, right).
For every animat, a genotype defines the network architecture and logic-functions for each node.

The animats are evolved over 60 000 generations, starting with an initial population of 100 animats with no connections between the hidden elements.
For mutation, 100 animats are selected using roulette wheel selection, see sect. \vref{sect:ea}.
The reproduction of animats happens without crossover, and up to three different mutation mechanics can happen, at a probabilistic rate.\cite{albantakis_evolution_2014}

The three different mechanics are: Point mutations, by a probability of $p = 0.5 \%$ per loci, with uniform integer replacement. Deletion, by $p = 2\%$ per genotype, a sequence between 16 and 512 adjacent loci is deleted. Duplication, by $p = 5\%$ per genotype, a sequence between 16 and 512 adjacent loci is duplicated and inserted at a random location within the genotype.
The genotype is always between 1000 and 20 000 loci. Sequences of 10 loci encode one set of connections.\cite{albantakis_evolution_2014}

The environment is a "falling blocks game," with varying shape and size of the blocks. Additionally, the task for each type of block varies between catching and avoiding the block.

Most importantly, the work of Albantakis et al. applies the IIT and makes three predictions:
\begin{itemize}
\item{}
The number of concepts, and their $\phi^max$ (see sect. \vref{sect:iit}), should increase during adaption, proportional to the amount of internal computation necessary to solve a task.
\item{}
Given the limited number of hidden elements, integration should also increase during adaption, particularly in tasks that require more memory.
\item{}
When the animat has a limited sensory and motor capacity, it needs to rely more on memory when the complexity of the environment increases. Therefore the integration of the animat should also increase during evolution, when under sensory or motor limitations.\cite{albantakis_evolution_2014}
\end{itemize}

The study does find that during evolution, complex environments tend to lead to an increased number of concepts (functions) in the causal structure and also more integrated conceptual structures (see sect. \vref{sect:iit}).
Animats with more integrated structures also seem to be more robust, which makes sense because when there is a limited amount of elements in the brain, more integrated structures can contain more functions.
The study also found that animats with higher fitness usually had a higher degeneracy. In biology, degeneracy means that structurally different elements can perform the same function and correlates with flexibility and robustness. The author states that this could also lead to the development of higher-order functions.\cite{albantakis_evolution_2014}

What does the study say of the IIT, and how can it be used? According to IIT, integrated conceptual structures underlie consciousness \cite{tononi_integrated_2016}. This study found that animats with a higher number of integrated conceptual structures found an advantage in complex environments, which may indicate that the IIT can be a useful tool in the quest for intelligent machines.


\section{Simple wave runup}
This scenario simulates a wave flowing up a planar beach. Following the initial wave runup, eventually the water elevation should become constant, and the velocities should approach zero. This test follows from the \anuga{} User Manual~\cite{RNGS2010}.
Instead of demonstrating how \anuga{} simulates a water flow test as given in the \anuga{} User Manual~\cite{RNGS2010}, here we investigate the behaviour of the wetting (and possibly the drying) process handled by \anuga{}.

\subsection{Results}
To do the investigation, we consider initial and boundary conditions different from those given in the \anuga{} User Manual~\cite{RNGS2010} so that we have a large dry region. Consider a rectangular domain with $x\in[0,1]$ and $y\in[0,0.03]$\,. The initial conditions are $u=v=0$ and
\begin{equation}
z(x) = -\frac{x}{2}
\end{equation}
with the stage at wet region is $w=-0.45$. The boundary condition on the rightend of the domain is Dirichlet with stage $w=-0.4$ and discharges in $x$ and $y$ directions are zero.

At an early runup, representatives of the results are as follows. Figure~\ref{fig:stage_1s} shows the water surface at time $t=1$ (in the cross-shore direction). It is not constant as the water is flowing up the beach at this time. Figure~\ref{fig:xvel_1s} shows the corresponding $x$-velocity during the wave runup. The velocities should be free from major spikes.
\begin{figure}
\begin{center}
\includegraphics[width=0.9\textwidth]{stage_1s.png}
\caption{Water surface during the wave runup at time $t=1.0$\,.}
\label{fig:stage_1s}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=0.9\textwidth]{xvel_1s.png}
\caption{Xvelocity during the wave runup at time $t=1.0$\,.}
\label{fig:xvel_1s}
\end{center}
\end{figure}

After a much longer time, representatives of the results are as follows. Figure~\ref{fig:stage_30s} shows the water surface at time 30s (in the cross-shore direction). It should be nearly constant (= -0.1m) in the wet portions of the domain. Figure~\ref{fig:xvel_30s} shows the corresponding velocity at time 30s. It should be nearly zero (e.g. $<<$ 1 mm/s). This case has been used to illustrate wet-dry artefacts in some versions of \anuga.
\begin{figure}
\begin{center}
\includegraphics[width=0.9\textwidth]{stage_30s.png}
\caption{Water surface at time 30s after the wave runup. It should be nearly constant in wet parts of the domain.}
\label{fig:stage_30s}
\end{center}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=0.9\textwidth]{xvel_30s.png}
\caption{Xvelocity at time 30s after the wave runup. It should be nearly zero.}
\label{fig:xvel_30s}
\end{center}
\end{figure}

\subsection{Comment on wet-dry artefacts}
Earlier \anuga{} algorithms showed some wet-dry artefacts in this scenario, which manifest as a high velocity at the wet/dry interface, and water creeping up the slope (this was a feature of earlier \anuga{} algorithms). If the process is handled correctly in \anuga{}, water should not ``creep-up`` to the left for a long distance (the discontinuous elevation + tsunami algorithms should have no problem with this).

%For one of the solvers with these artefacts, setting the minimum allowed height and the minimum storable height in an appropriate way is important. If the minimum allowed height is different from the minimum storable height, water may ``creep-up.`` That can be demonstrated by taking, for example, the minimum allowed height is $10^{-3}$ and the minimum allowed height is $10^{-5}$. However if we take those two parameters to be $10^{-4}$, water is still after we run the code for a relatively long time. The following lines can be implemented in the code:
%\begin{verbatim}
%domain.set_minimum_allowed_height(0.0001)
%domain.set_minimum_storable_height(0.0001)
%\end{verbatim}

\endinput


\subsection{Structural and Decomposition Cryptanalysis}

\renewcommand{\TITLE}{\it Structural and Decomposition Cryptanalysis}

\begin{frame}
\CurTitle{}

\Center{
\textcolor{blue}{Distinguishing} structures and \textcolor{red}{recovering} components
}
\end{frame}

\begin{frame}[t]
\CurTitle{}

\only<1>{
    \begin{textblock*}{4cm}(2cm,1.25cm)
    \includegraphics[width=3.5cm]{figures/blackbox.pdf}
    \end{textblock*}
}
\only<2>{
    \begin{textblock*}{4cm}(2cm,2cm)
    \input{figures/lookup.tex}
    \end{textblock*}
}
\only<3->{
    \begin{textblock*}{4cm}(2cm,1.75cm)
        \includegraphics[height=5.75cm]{figures/feistel.pdf}
        \\
        \large \hspace*{0.3cm}
        Feistel Networks
    \end{textblock*}

}

\only<6>{
    \begin{textblock*}{4cm}(6.2cm,2cm)
    \input{figures/lookup.tex}
    \end{textblock*}
}
\only<7->{
    \begin{textblock*}{4cm}(6cm,1.75cm)
    \begin{center}\includegraphics[height=5cm]{figures/apn.pdf}\end{center}
        \large
        \hspace*{1.1cm} 6-bit APN \\
        \hspace*{0.9cm} Permutation
    \end{textblock*}
}
\only<8->{
    \begin{textblock*}{6cm}(5.55cm,1.6cm)
        \begin{tikzpicture}
        \node[opacity=0.2] {\includegraphics[height=6cm]{figures/butterfly.png}};
        \end{tikzpicture}
    \end{textblock*}
}

\only<4>{
    \begin{textblock*}{4cm}(10cm,2cm)
    \input{figures/lookup.tex}
    \end{textblock*}
}
\only<5->{
    \begin{textblock*}{4cm}(10cm,1.75cm)
    \begin{center}\includegraphics[height=5cm]{figures/kuzlog.pdf}\end{center}
        \large \hspace*{0.9cm}
        GOST S-Box
    \end{textblock*}
}

\end{frame}

\begin{frame}
    \CurTitle{}

    \nociteparti{mybibFeistel}
    \nociteparti{mybibAPN}
    \nociteparti{mybibKuz1}
    \nociteparti{mybibKuz2}
    \bibliographystyleparti{unsrt}
    \bibliographyparti{mybiblio.bib}
\end{frame}


\section{Conclusion and Future Work}
\label{conclusion}
Given the extensive nature of the topic, a lot of work is left open. Regarding the path tracer, incorporating any sort of denoising is a necessary step to achieving usable results. The performance is not quite at a sufficient point, so finding additional optimizations is another open topic. As mentioned before, Go is not an ideal language for such a performance critical task, so translating the project into a better fit language would be interesting as well. Importance sampling is another technique that was not considered in this work, but might improve the results by a decent amount.

The implementation progressive hierarchical refinement could be improved further by optimizing construction of auxiliary BVHs, as this part still lacks in performance. The full sweep SAH evaluation at the core of the algorithm is relatively expensive, so replacing it by binning SAH might be advantageous for interactive and real-time applications. Evaluating the influence of other cost functions like the RDH to both the split function and the parameter cost evaluation might lead to interesting results. SIMD instructions were not used in any part of this project, so applying those where appropriate could improve the path tracer significantly.
\\\\
Path tracing is an essential part in computer graphics and recent advancements in real-time path tracing pushed its popularity even further. This thesis presented an overview over the basics of path tracing and how an interactive path tracer might be implemented based on an example written for CPUs in the programming language Go. The evaluation of this path tracer showed that interactive frame rates can be achieved for reasonably small scenes and resolutions, but competitive usage requires additional work.

Furthermore, the state-of-the-art algorithm called progressive hierarchical refinement was presented and extended by a novel optimization technique for the used hyperparameters. This method was tested extensively and its potential performance increase was validated.
\cleardoublepage


\section{extract}
\index{extract}
\label{sec:extract}

It extracts simulation information. It does not write information on screen, but returns it as a variable. If you want to see something on screen, use the \param{lowmsg} command to print it.

\begin{description}

\item [ac.coverage]\index{ac.coverage} Returns the surface hydrogen coverage in epitaxial models, as a $[0-1]$ value (ML or monolayer).

\item [ac.max]\index{ac.max} Returns a list with the maximum values for the Lattice KMC interface position in x, y and z. Accepts the optional arguments  \param{min.x=$<$minx$>$}, \param{max.x=$<$max.x$>$}, \param{min.y=$<$miny$>$}, \param{max.y=$<$max.y$>$},  \param{min.z=$<$minz$>$} and \param{max.z=$<$max.z$>$} to limit the extraction domain size.

\item [ac.mean]\index{ac.mean} Returns a list of the mean value of the Lattice KMC interface position in x, y and z respectively. Accepts the optional arguments  \param{min.x=$<$minx$>$}, \param{max.x=$<$max.x$>$}, \param{min.y=$<$miny$>$}, \param{max.y=$<$max.y$>$},  \param{min.z=$<$minz$>$} and \param{max.z=$<$max.z$>$} to limit the extraction domain size.

\item [ac.min]\index{ac.min} Returns a list with the minimum values for the Lattice KMC interface position in x, y and z. Accepts the optional arguments  \param{min.x=$<$minx$>$}, \param{max.x=$<$max.x$>$}, \param{min.y=$<$miny$>$}, \param{max.y=$<$max.y$>$},  \param{min.z=$<$minz$>$} and \param{max.z=$<$max.z$>$} to limit the extraction domain size.

\item [ac.stdev]\index{ac.stdev} Returns a list of the standard deviation of the Lattice KMC interface in x, y and z respectively. Accepts the optional arguments  \param{min.x=$<$minx$>$}, \param{max.x=$<$max.x$>$}, \param{min.y=$<$miny$>$}, \param{max.y=$<$max.y$>$},  \param{min.z=$<$minz$>$} and \param{max.z=$<$max.z$>$} to limit the extraction domain size.

\item [amorphous.fraction]\index{amorphous.fraction} Returns the fraction of space that is amorphous in an {\tt OKMC} enviroment for the material specified in the required option \param{material=$<$mt$>$}. For more information, read Section \ref{sec:amorph}.

\item [coord=$<$x y z$>$]\index{coord} Uses the coordinate x, y and z as the starting center to look for neighbors in the \param{coordination} command.

\item [coordination]\index{coordination} Returns a list of neighbors, distance to it, the neighbor type and total account of neighbor types. It requires the use of the option \param{coord} to specify the value of the coordinate to use as a center and \param{radius} for the look-up radius. It buils a crystal as a sphere with the specified radius plus 0.5 nanometers, so the specified coordinate should be close to 0 0 0.

\item [count.defects]\index{count.defects} Returns how many defects are in the simulation. It accepts the following options to ``filter'' the results: \param{material} for a particular material, \param{name} to specify a particle name, \param{defect} for a defect name, \param{min.size} for a minimum size and \param{ID} for a particular defect type.

\item [count.particles]\index{count.particles} Returns how many particles are in the simulation. It accepts the following options to ``filter'' the results: \param{material} for a particular material, \param{particle} to specify a particle name, \param{defect} for a defect name, \param{min.size} for sizes equal or bigger and \param{ID} for a particular defect type. It is different from \param{count.defects}. For instance, a B2I3 cluster will return 3 interstitial particles, but only 1 defect.

\item [count.positions]\index{count.positions} Returns how many particles are in a particular position. It requires the argument \param{position}\index{position} and accepts the argument \param{material} to filter the particles to the specified material.

\item [defect]\index{defect} Parameter used by \param{histogram} to specify the defect type. Also used by \param{profile} to restrict the output to a particular cluster.

\item [defect.radius]\index{defect.radius} It computes the average radius (in nm) of the specified defects. It requires the parameter \param{defect} and accepts the optional parameters \param{ID} to specify a particular type and \param{min.radius} to set up a threshold that defines when a defect is ``visible'' and will be included in the calculation.

\item [defects=$<$list$>$]\index{defects} Returns all the defects (OKMC particles) and positions in the simulation. If all the defects are requested, an empty list (defects=\{ \}) is to be provided. Otherwise, an enumeration of the defects requested, separated by spaces, is to be provided. For MobileParticles, \param{MobileParticle} has to be specified. For other defects, the defect name (eg. \param{ICluster}, \param{VCluster}) is to be written. If alloy atoms are requested, type \param{Alloy}.

\item [diffusivity]\index{diffusivity} Returns the diffusivity of the specified particle \param{name} in the specified  \param{material}. It does not work for I or V particles. If \param{macroscopic} is specified, then it tracks the diffusivity of the whole family of particles associated. Use \param{extract reset} to start measuring.

\item [dimension]\index{dimension} Sets the dimension to collapse the output. Accepts 0, 1 2 and 3. If 0 is specified, no geometrical information is obtained, just a value with the overall mean value.

\item [dose]\index{dose} Extracts the damage recieved by the material by the \param{cascade} command. The units are in dpa. This command assumes that the cascades contain Frenkel pairs, that is, same number of interstitials and vacancies (accepts clusters but the total ammount of interstitials and vacancies must remain equal), if not this command will give an underestimated or overestimated dpa value.

\item [histogram]\index{histogram} Requires the parameters \param{defect} and \param{material}. Returns a histogram for the given defect/s name. Several defects can be used separated by commas, for instance {\tt ICluster,VCluster}. A histogram is considered a list of cluster names and the number of them present when issuing the command.

\item [file=$<$filename$>$]\index{file} This option can be added to {\em any} of the previous parameters to write the results in filename.

\item [fuzz]\index{fuzz} Returns a ``y z depth'' array listing all the depths at which a free interface was detected.

\item [jumps]\index{jumps} Returns the number of jumps for the mobile particle specified in the required option \param{name=$<$pt$>$}

\item [min.radius]\index{min.radius} Optional parameter for \param{defect.radius}. It considers only ``visible'' defects with radius equal or bigger than the specified one.

\item [min.size]\index{min.size} Optional parameter for \param{count.defects} or \param{count.particles}. It limits the count to defects with size equals or bigger than the specified. The size of a defect is defined as its total number of particles.

\item [profile]\index{profile} Returns the concentration for the particle specified in the required option \param{name=$<$pt$>$}. When simulating binary alloys it is possible to extract the atom counters of the A and B species in the AB binary alloy with the \param{name=A.atoms} and \param{name=B.atoms} respectively. Also it is possible to extract the profile of the A atoms of the AB binary alloy by no introducing the \param{name} keyword and introducing the desired material profile with the \param{material} keyword. LKMC information can also be extracted through \param{name=lkmc.defects} and \param{name=lkmc.ac} options and corresponding to defective configurations and amorphous/crystalline interface respectively.

\item [profile.damage]\index{profile.damage} Returns the damage concentration (i.e. self-Interstitials and Vacancies) for the material specified in the required option \param{material=$<$mt$>$}. Such concentration saturates at the {\tt amorphization.threshold} value. For more information, read Section \ref{sec:amorph}.

\item [profile.mobile]\index{profile.mobile}  Returns the mobile concentration for the mobile particle specified in the required option \param{name=$<$pt$>$}. It assumes $[X] = \mathrm{jumps} / (\Delta t \Delta V \nu(pt))$.

\item [reset]\index{reset} Resets the information for mobile particles. It allows incremental displays of properties for mobile particles. If \param{reset} is not used, then all the properties for mobile particles are accounted from the very beggining of the simulation, otherwise, the magnitudes are an average between the last reset and the current time.

\item [strain.xy] Returns the shear strain (xy) loaded into OKMC in a 2D X/Y projection.

\item [time]\index{time} Returns the current simulated time.

\end{description}

\subsection{Examples}
\begin{itemize}
\item \verb+extract count.particles defect=ICluster+ Extracts how many particles are in "ICluster"
\item \verb+extract count.particles defect=VCluster ID=V3+ Extracts how many particles are contained in V3 in "VCluster".
\item \verb+extract diffusivity macroscopic name=He material=Copper+
\item \verb+extract time+
\item \verb+extract ac.mean+ Extracts a list containing the x, y and z mean values of amorphous/crystalline interface positions. Use \verb+[lindex [extract ac.mean] 0]+ to extract the x mean value.
\item \verb+extract histogram defect=<111> material=Iron+
\item \verb+extract profile name=Cr dimension=1 material=Iron+ Extracts the profile [$cm^{-3}$] of the Cr atoms collapsed to the X-dimension
\item \verb+extract profile material=Iron+ Extracts the profile [$cm^{-3}$] of the Iron lattice atoms (computed from the cell counters)
\end{itemize}


\documentclass[modern]{aastex62}

\input{xostyle}
\input{xosymbols}

\begin{document}\raggedbottom\sloppy\sloppypar\frenchspacing

\title{%
  {\bf NOTE: this is a very rough draft of this manuscript --- read at your own risk!}
  \\
  tess.world: An open source living catalog of TESS planet fits
}

\author[0000-0002-9328-5652]{Daniel Foreman-Mackey}
\affil{Center for Computational Astrophysics, Flatiron Institute, 162 5th Ave, New York, NY 10010}

\author{others}
\noaffiliation

\begin{abstract}
  \noindent
  This is sick.
\end{abstract}

\keywords{%
  methods: data analysis ---
  methods: statistical
}

\section{Introduction}

\citep{Foreman-Mackey:2017}

\section{Parameterization}

There are many options for parameterization of a transit, but we choose to model these transits as circular orbits parameterized by their observables.
We also track the relevant Jacobians.

The main parameters are:
\begin{enumerate}
  \item \emph{two reference transit times}, one near the beginning of the observations, $t_0$, and one near the end, $t_{-1}$, measured in \tess\ BJD,
  \item \emph{the approximate transit depth}, $\delta$, measured in parts-per-thousand,
  \item \emph{the impact parameter} of the orbit, $b$, constrained to be $|b| \le 1$, and
  \item \emph{the transit duration}, $\tau$, measured in hours.
\end{enumerate}

With more discussion of the details, motivations, and limitations below.

\paragraph{Transit times}
To speed up the analysis, we assume that the discovery period and phase of the orbit are close enough to the truth that we can fit only the data near the expected transit times.
One consequence of this assumption is that we are assuming that the \emph{number} of periods that occur in the \tess\ observational baseline is correct.
Practically, this means that our prior assumption is that the transits must occur within the data cutouts.
This can be difficult to enforce---especially for low signal-to-noise transits---but a good approximation can be achieved by fitting for two reference transit times, $t_0$ and $t_{-1}$, with a fixed number of periods, $N_P$, between them, instead of a single reference time and the period.
Then we can compute the implied period as $P = (t_{-1} - t_0) / N_P$.
Importantly this does not change the prior on $P$ and $t_0$ since the Jacobian is a constant $1/N_P$.

\paragraph{Transit depth}
It is worth spending a moment on the transit depth parameterization.
This choice of parameterization leads to efficient computation and convergence, but it comes with non-trival shortcomings.
Since the physical parameter that is required to compute the light curve model is the radius ratio between the planet and the star $k = R_\mathrm{p} / R_\star$, we need to choose a parameterization that is invertible and that isn't generally possible.
In some cases, using radius ratio directly as the parameter can work well, but \dfmtodo{explain cases where it's not}.
Instead, we choose to parameterize the approximate transit depth $\delta$ using the small planet approximation.
This is useful because it is directly invertible (conditioned on the limb darkening parameters and impact parameter), but it restricts us to considering non-grazing transits with impact parameter $|b| \le 1$.
Accepting this restriction, we can compute the approximate transit depth for a limb darkened light curve by assuming that the intensity of the star is uniform under the disk of the planet.
For quadratic limb darkening, the intensity profile is
\begin{equation}
  I(r) = 1 - u_1\,[1 - \mu(r)] - u_2\,[1 - \mu(r)]^2
\end{equation}
where $\mu(r) = \sqrt{1 - r^2}$.
The ratio of the occulted flux to the total stellar flux when the transit is deepest ($r = b$) is \citep[the same results are discussed by][]{Mandel:2002,Csizmadia:2013}
\begin{eqnarray}
  \delta &\approx& \frac{\int_0^k\,2\,\pi\,r\,I(b)\dd r}{\int_0^1\,2\,\pi\,r\,I(r)\dd r} \nonumber\\
  &=& \frac{k^2\,\left(1 - u_1\,[1 - \mu(b)] - u_2\,[1 - \mu(b)]^2\right)}{1 - u_1/3 - u_2/6}\quad.
\end{eqnarray}
Therefore, since $k$ must be positive, we have a one-to-one transformation between $\delta$ and $k$ conditioned on impact parameter $|b| \le 1$ and the limb darkening coefficients.
It is also important to include the Jacobian factor so that fitting in $\delta$ doesn't introduce a strange prior on $r$.
In this case, the relevant factor is
\begin{equation}
  \left|\frac{\dd k}{\dd \delta}\right| = \left|\frac{1 - u_1/3 - u_2/6}{2\,k\,\left(1 - u_1\,[1 - \mu(b)] - u_2\,[1 - \mu(b)]^2\right)}\right| \quad.
\end{equation}

\paragraph{Impact parameter}
Constrained to be non-grazing.
\dfmtodo{Discuss the consequences of this.}

\paragraph{Transit duration}
The physical parameter required for computing the transit model is the semi-major axis, $a$, in units of the stellar radius, but the transit duration $\tau$ is better constrained so it can be better as a fit parameter.
For a circular orbit, the transit duration is \citep{Winn:2010}
\begin{equation}
  \tau = \frac{P}{\pi}\,\sin^{-1}\left( \frac{\sqrt{(1 + k^2) - b^2}}{a\,\sin i} \right) \quad.
\end{equation}
Rearranging this, we find
\begin{equation}
  a^2\,\sin^2 i\,\sin^2\left(\frac{\pi\,\tau}{P}\right) = (1 + k^2) - b^2 \quad.
\end{equation}
Then, using the fact that $\cos^2 i = b^2 / a^2$, we find
\begin{equation}
  a^2 = \frac{(1 + k)^2 - b^2\,\cos^2\phi}{\sin^2\phi}
\end{equation}
for $\phi = \pi\,\tau / P$.
And the Jacobian is
\begin{eqnarray}
  \frac{\dd a}{\dd \tau} &=& \frac{\pi\,\cos \phi}{a\,P\,\sin^3 \phi}\,\left[b^2 - (1 + k)^2\right] \quad.
\end{eqnarray}

Finally, from the period and semi-major axis, we can compute the implied stellar density (under this assumption of a circular orbit)
\begin{equation}
  \rho_\mathrm{circ} = \frac{3\,\pi\,a^3}{G\,P^2} \quad.
\end{equation}
It is important to note that this is not necessarily the same as the actual stellar density and that, in a multi-planet system, this implied density won't be the same for each planet \citep[see, for example,][]{Dawson:2012, Kipping:2012}.

\section{Single transits}

\acknowledgements

This project was developed in part at the Building Early Science with TESS meeting, which took place in 2019 March at the University of Chicago.

Conversations:
% alphabetical by last name
Astro data group,

\appendix

\newpage
\bibliography{tess-world}

\end{document}


    \filetitle{VAR}{Create new empty reduced-form VAR object}{VAR/VAR}

	\paragraph{Syntax for plain VAR and
VARX}\label{syntax-for-plain-var-and-varx}

\begin{verbatim}
V = VAR(YNames)
V = VAR(YNames,'exogenous=',XNames)
\end{verbatim}

\paragraph{Syntax for panel VAR and
VARX}\label{syntax-for-panel-var-and-varx}

\begin{verbatim}
V = VAR(YNames,'groups=',GroupNames)
V = VAR(YNames,'exogenous=',XNames,'groups=',GroupNames)
\end{verbatim}

\paragraph{Output arguments}\label{output-arguments}

\begin{itemize}
\item
  \texttt{V} {[} VAR {]} - New empty VAR object.
\item
  \texttt{YNames} {[} cellstr \textbar{} char \textbar{}
  function\_handle {]} - Names of endogenous variables.
\item
  \texttt{XNames} {[} cellstr \textbar{} char \textbar{}
  function\_handle {]} - Names of exogenous inputs.
\item
  \texttt{GroupNames} {[} cellstr \textbar{} char \textbar{}
  function\_handle {]} - Names of groups for panel VAR estimation.
\end{itemize}

\paragraph{Options}\label{options}

\begin{itemize}
\item
  \texttt{'exogenous='} {[} cellstr \textbar{} \emph{empty} {]} - Names
  of exogenous inputs; one of the names can be \texttt{!ttrend}, a
  linear time trend, which will be created automatically each time input
  data are required, and then included in the output database under the
  name \texttt{ttrend}.
\item
  \texttt{'groups='} {[} cellstr \textbar{} \emph{empty} {]} - Names of
  groups for panel VAR estimation.
\end{itemize}

\paragraph{Description}\label{description}

This function creates a new empty VAR object. It is usually followed by
an \href{VAR/estimate}{\texttt{estimate}} command to estimate the VAR
parameters on the data.

\paragraph{Example}\label{example}

To estimate a VAR, you first need to create an empty VAR object
specifying the variable names, and then run the \url{VAR/estimate}
function on it, e.g.

\begin{verbatim}
v = VAR({'x','y','z'});
[v,d] = estimate(v,d,range);
\end{verbatim}

where the input database \texttt{d} ought to contain time series
\texttt{d.x}, \texttt{d.y}, \texttt{d.z}.


%!TEX root = ../chapter2.tex
%******************************
%	 Discussion
%*****************************

\section{Discussion}

This chapter addressed a statistical problem that obstructed the analysis of the previous chapter, where changes in expression variability were confounded by changes in mean expression.
Here, this problem is resolved by introducing a hierarchical Bayesian formulation that extends the BASiCS framework.
In this formulation, an additional set of residual over-dispersion parameters $\epsilon_i$ that are not confounded by changes in mean expression are introduced.
This extension ensures a broader applicability of the BASiCS software and allows statistical testing of changes in variability that are not confounded by mean expression.  \\

The original implementation of BASiCS for testing changes in mean expression and expression variability aimed at borrowing information across all cells, all genes and both conditions.
However, as cell-specific scaling factors and gene-specific mean expression parameters are jointly inferred by BASiCS, this led to an unidentifibility problem: a global offset (associated to global differences in mRNA content) between the two conditions is unknown a priori.
This issue did not arise in most differential expression methods for bulk RNA-seq data (such as DESeq2 \cite{Love2014} and edgeR \cite{Robinson2009}), because they typically adopted a sequential approach: they first estimate cell-specific scaling factors that are subsequently used as fixed offsets in the downstream model for differential expression.
Instead, BASiCS resolves the unidentifiability issue by performing inference on both conditions independently, performing a post-hoc offset correction.\\
This approach raises the question if parameter estimates are comparable between both conditions or if differences are cause due to over-fitting.
We therefore validated the robustness of the model in multiple ways:\\

1. We ran the model on down-sampled cell populations and found that (i) the majority of model parameters show similar estimates independent of the sample size and expression levels, and (ii) the regression stabilises variability estimates for lowly expressed genes. \\
2. We simulated data and showed that (i) the false positive rate is less than 5\% for mean and variability estimates and that (ii) the true positive rate reaches 100\% for large sample size. \\
3. we compared BASiCS parameter estimates to absolute transcript counts using smFISH and observed a near perfect estimation of mean expression but lower correlation for variability and residual variability measures.

\newpage

We are therefore confident that BASiCS correctly estimates mean expression and expression variability per condition and that this allows comparison of parameter estimates between conditions.\\

Other, dataset-specific factors that affect the robustness of posterior parameter estimation include sequencing depth, number of cells and heterogeneity within the population.
BASiCS has been designed to be run on homogeneous populations of cells to avoid variation introduced by correlated sub-structure within the data.
Furthermore, the use of UMIs for quantifying transcript counts can also improve variability estimation \citep{Grun2014}. \\

Our method enables the characterisation of the extent and nature of variable gene expression in CD4\plus{} T cell activation and differentiation.
Firstly, we observe that during acute activation of naive T cells, genes of the biosynthetic machinery are homogeneously up-regulated, while specific immune-related genes are more heterogeneously up-regulated. In particular, increased variability in expression of the apoptosis-inducing Fas ligand \citep{Strasser2009} and the inhibitory ligand PD-L1 \citep{Chikuma2016} suggests a mechanism by which newly activated cells might suppress re-activation of effector cells, thereby dynamically modulating the population response to activation.
Likewise, more variable expression of \emph{Smad3}, which translates inhibitory \gls{Tgf}$\beta$ signals into transcriptional changes \citep{Delisle2013}, may indicate increased diversity in cellular responses to this signal.
Increased variability in \textit{Pou2f2} (Oct2) expression after activation suggests heterogeneous activities of the NF-$\kappa$B and/or \gls{NFAT} signalling cascades that control its expression \citep{Mueller2013}.
Moreover, we detect up-regulated and more variable \textit{Il2} expression, suggesting heterogeneous Il2 protein expression, which is known to enable T cell population responses \citep{Fuhrmann2016}.

Additionally, we studied changes in gene expression variability during CD4\plus{} T cell differentiation towards a Th1 and Tfh cell state over a 7 day time course after \textit{in vivo} malaria infection \citep{Lonnberg2017}.
Our analysis provides several insights into this differentiation system.
Firstly, we observe a tighter regulation in gene expression among genes that do not change in mean expression during differentiation at day 4.
At this point, divergence of Th1 and Tfh differentiation was previously identified \citep{Lonnberg2017}.
The decrease in variability on day 4 is potentially due to induction of a strong pan-lineage proliferation programme.
However, we observe that not all genes follow this trend and uncover four different patterns of variability changes.
Secondly, we observe that several Tfh and Th1 lineage-associated genes change in expression variability between days 2 and 4. For example, we noted a decrease in variability for one key Th1 regulator, \textit{Tbx21} (encoding Tbet), which suggests that a subset of cells may have already committed to the Th1 lineage at day 2.
Three additional Th1 lineage-associated genes also followed this trend (\textit{Ahnak}, \textit{Ctsd}, \textit{Tmem154}).
These data suggest that differentiation fate decisions may arise as early as day 2 in subpopulations within this system, resulting in high gene expression variability.
Such an effect is in accordance with the early commitment to effector T cell fates that was previously observed during viral infection \citep{Choi2011}.
As these results illustrate, diversity in the differentiation state within a population of T cells can drive our differential variability results.
To further dissect these results, subsequent analyses such as the pseudo-time inference used in \cite{Lonnberg2017} could be used to characterise a continuous differentiation process.\\

Finally, I confirmed that the regression BASiCS model can be used to study heterogeneous differentiation processes in droplet-based scRNA-Seq data.
While the sparsity of these data can lead to unstable posterior inference, the use of UMIs allows for robust measurement of transcript counts.
Therefore, posterior estimates of model parameters can be used to detect changes in mean expression and in transcriptional variability.
In the case of somitogenesis, I validated known Wnt and Fgf signalling pathways in pre-somitic mesoderm cells and newly discovered a possible priming for somitic mesoderm cells to later form limb muscles.
Identifying these genes supports a deeper understanding of cell fate decisions in the developing embryo.\\

In sum, our model provides a robust tool for understanding the role of heterogeneity in gene expression during cell fate decisions.
This tool can be widely applied to systems where strong expression changes occur and for sparse droplet-based scRNA-Seq datasets.
It allows the statistical assessment of changes in variability due to available uncertainty estimates.
A drawback of this framework is the restriction to relatively few (up to 1000) cells that can be modelled per run.
In \textbf{Chapter 5}, I will discuss current and future extensions to the Bayesian inference of generative models that allows the estimation of model parameters using more than 1 million cells.