def _microcanonical_average_moments(moments, alpha):
ret = dict()<EOL>runs = moments.shape[<NUM_LIT:0>]<EOL>sqrt_n = np.sqrt(runs)<EOL>moments_sample_mean = moments.mean(axis=<NUM_LIT:0>)<EOL>ret['<STR_LIT>'] = moments_sample_mean<EOL>moments_sample_std = moments.std(axis=<NUM_LIT:0>, ddof=<NUM_LIT:1>)<EOL>ret['<STR_LIT>'] = np.empty((<NUM_LIT:5>, <NUM_LIT:2>))<EOL>for k in range(<NUM_LIT:5>):<EOL><INDENT>if moments_sample_std[k]:<EOL><INDENT>old_settings = np.seterr(all='<STR_LIT>')<EOL>ret['<STR_LIT>'][k] = scipy.stats.t.interval(<EOL><NUM_LIT:1> - alpha,<EOL>df=runs - <NUM_LIT:1>,<EOL>loc=moments_sample_mean[k],<EOL>scale=moments_sample_std[k] / sqrt_n<EOL>)<EOL>np.seterr(**old_settings)<EOL><DEDENT>else:<EOL><INDENT>ret['<STR_LIT>'][k] = (<EOL>moments_sample_mean[k] * np.ones(<NUM_LIT:2>)<EOL>)<EOL><DEDENT><DEDENT>return ret<EOL>
Compute the average moments of the cluster size distributions

Helper function for :func:`microcanonical_averages`

Parameters
----------

moments : 2-D :py:class:`numpy.ndarray` of int
    ``moments.shape[1] == 5`.
    Each array ``moments[r, :]`` is the ``moments`` field of the output of
    :func:`sample_states`:
    The ``k``-th entry is the ``k``-th raw moment of the (absolute) cluster
    size distribution.

alpha: float
    Significance level.

Returns
-------

ret : dict
    Moment statistics

ret['moments'] : 1-D :py:class:`numpy.ndarray` of float, size 5
    The ``k``-th entry is the average ``k``-th raw moment of the (absolute)
    cluster size distribution, with ``k`` ranging from ``0`` to ``4``.

ret['moments_ci'] : 2-D :py:class:`numpy.ndarray` of float, shape (5,2)
    ``ret['moments_ci'][k]`` are the lower and upper bounds of the normal
    confidence interval of the average ``k``-th raw moment of the
    (absolute) cluster size distribution, with ``k`` ranging from ``0`` to
    ``4``.

See Also
--------

sample_states : computation of moments

microcanonical_averages : moment statistics