Wednesday, August 10, 2016

Block Averaging: Matlab and Python

I'd written about block averaging to estimate error bars from correlated time-series in a couple of blog posts nearly three years ago. Here are the two posts, which explain the motivation and logic behind this technique (post1 and post2).

I wrote programs to carry out this operation in:


The required input is a data-stream or correlated "x" samples. There are optional flags for turning onscreen printing on or off, and to limit the size of the maximum block. The default choice for maximum block size ensures that the datastream is chopped into 4 blocks and more.

The output is a set of three arrays: the block size, the block variance, and the block mean.

The program prints out the mean and variance corresponding to the largest block sizes on screen. This may or may not be the "best choice". A quick look at the plot (by turning the isPlot flag on) will help ascertain this.

No comments: