Verifying pyfssa
================
The *pyfssa* package implements algorithmic finite-size scaling
analysis. In order to verify the autoscaling algorithm, the following
computations aim at reproducing the scaling exponents from the
literature of the paradigmatic bond percolation problem on a linear
chain and on a square lattice. First, finite-size percolation studies
utilizing the *pypercolate* package generate the finite-size data. Next,
we plot these raw data for the percolation probability, the order
parameter (largest component) and the susceptibility (second moment of
the cluster-size distribution). For each of these quantities, we scale
the simulation data according to the literature exponents and observe
the data collapse onto the master curve. Finally, for each of these
quantities, *pyfssa* auto-scales the simulation data in order to recover
the literature exponents.
Percolation simulation design
-----------------------------
We utilize the
`pypercolate `__ package
to generate the percolation finite-size data, according to the `template
for a HPC bond percolation finite-size scaling
study `__.
To carry out the simulations in a GridEngine powered high-performance
computing environment, we employ the
`jug `__ and
`gridjug `__ packages. The
*jugfiles* contain the control flow for both studies on the `linear
chain <_static/bond_percolation_1d_jugfile.py>`__ and the `square
lattice <_static/bond_percolation_jugfile.py>`__. The finite system
sizes of the linear chain (number of nodes) are
:math:`2^6, 2^8, \ldots, 2^{20}`, and the linear extensions :math:`L_i`
of the :math:`L_i \times L_i` square lattices (number of nodes) are
:math:`2^3, 2^4, \ldots, 2^{10}`. The total number of runs is
:math:`N_{runs} = 10^4`, respectively. The occupation probabilities are
:math:`\{1 - 10^{-(1 + i/10)} : i = 0, \ldots, 100\}` for the linear
chain and :math:`\{0.5 + \frac{i}{500} : i = -50, \ldots, +50\}` for the
square lattice. The confidence level is at the :math:`1 \sigma` level,
hence :math:`1 - \alpha = \text{erf}\frac{1}{\sqrt{2}} \approx 0.683`.
The master seeds that initialize the Mersenne-Twister RNG to draw the
seeds for each run are :math:`3138595788` for the linear chain and
:math:`3939666632` for the square lattice.
Preamble
--------
.. code-block:: python
from __future__ import division
.. code-block:: python
# configure plotting
%config InlineBackend.rc = {'figure.dpi': 300, 'savefig.dpi': 300, \
'figure.figsize': (3, 3 / 1.6), 'font.size': 10, \
'figure.facecolor': (1, 1, 1, 0)}
%matplotlib inline
.. code-block:: python
from pprint import pprint as print
from collections import OrderedDict
import warnings
import h5py
import matplotlib as mpl
import numpy as np
import os
import scipy.stats
import seaborn as sns
import matplotlib.pyplot as plt
from cycler import cycler
import fssa
.. parsed-literal::
/home/sorge/repos/sci/pyfssa/.devenv35/lib/python3.5/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
warnings.warn(self.msg_depr % (key, alt_key))
Loading and inspecting the raw data
-----------------------------------
.. code-block:: python
bond_percolation_data = OrderedDict()
bond_percolation_data['1D'] = h5py.File(
os.path.join('_static', 'bond-percolation-hpc-chain-canonical-averages.hdf5')
)
bond_percolation_data['2D'] = h5py.File(
os.path.join('_static', 'bond-percolation-hpc-grid-canonical-averages.hdf5')
)
.. code-block:: python
system_sizes = OrderedDict()
for key, data in bond_percolation_data.items():
system_sizes[key] = sorted([int(group_key) for group_key in data.keys()])
print(system_sizes)
.. parsed-literal::
OrderedDict([('1D', [64, 256, 1024, 4096, 16384, 65536, 262144, 1048576]),
('2D', [8, 16, 32, 64, 128, 256, 512, 1024])])
.. code-block:: python
print(bond_percolation_data['1D'][str(system_sizes['1D'][0])].dtype.descr)
.. parsed-literal::
[('number_of_runs', '