pymks/stats.py
def autocorrelate(X_, periodic_axes=[], confidence_index=None,
                  autocorrelations=None):
    """
    Computes the autocorrelation from a microstructure function.

    Args:
        X_ (ND array): The discretized microstructure function, an
            `(n_samples, n_x, ..., n_states)` shaped array
            where `n_samples` is the number of samples, `n_x` is thes
            patial discretization, and n_states is the number of local states.
        periodic_axes (list, optional): axes that are periodic. (0, 2) would
            indicate that axes x and z are periodic in a 3D microstrucure.
        confidence_index (ND array, optional): array with same shape as X used
            to assign a confidence value for each data point.
        autocorrelations (list, optional): list of spatial autocorrelatiions to
            be computed. For example [(0, 0), (1, 1)] computes the
            autocorrelations with local states 0 and 1. If no list is passed,
            all autocorrelations are computed.

    Returns:
        Autocorrelations for microstructure function `X_`.

    Non-periodic example

    >>> n_states = 2
    >>> X = np.array([[[0, 0, 0],
    ...                [0, 1, 0],
    ...                [0, 0, 0]]])
    >>> from pymks.bases import PrimitiveBasis
    >>> prim_basis = PrimitiveBasis(n_states=n_states)
    >>> X_ = prim_basis.discretize(X)
    >>> X_auto = autocorrelate(X_, periodic_axes=(0, 1))
    >>> X_test = np.array([[[0., 0., 0.],
    ...                   [0., 1./9, 0.],
    ...                   [0., 0., 0.]]])
    >>> assert(np.allclose(np.real_if_close(X_auto[0, ..., 1]), X_test[0]))
    """
    if periodic_axes is None:
        periodic_axes = []
    if autocorrelations is None:
        correlations = _auto_correlations(X_.shape[-1])
    X_ = _mask_X_(X_, confidence_index)
    s = _Fkernel_shape(X_, periodic_axes)
    auto = _correlate(X_, s, correlations)
    return auto / _normalize(X_, s, confidence_index)

    Computes the autocorrelation from a microstructure function.

    Args:
        X_ (ND array): The discretized microstructure function, an
            `(n_samples, n_x, ..., n_states)` shaped array
            where `n_samples` is the number of samples, `n_x` is thes
            patial discretization, and n_states is the number of local states.
        periodic_axes (list, optional): axes that are periodic. (0, 2) would
            indicate that axes x and z are periodic in a 3D microstrucure.
        confidence_index (ND array, optional): array with same shape as X used
            to assign a confidence value for each data point.
        autocorrelations (list, optional): list of spatial autocorrelatiions to
            be computed. For example [(0, 0), (1, 1)] computes the
            autocorrelations with local states 0 and 1. If no list is passed,
            all autocorrelations are computed.

    Returns:
        Autocorrelations for microstructure function `X_`.

    Non-periodic example

    >>> n_states = 2
    >>> X = np.array([[[0, 0, 0],
    ...                [0, 1, 0],
    ...                [0, 0, 0]]])
    >>> from pymks.bases import PrimitiveBasis
    >>> prim_basis = PrimitiveBasis(n_states=n_states)
    >>> X_ = prim_basis.discretize(X)
    >>> X_auto = autocorrelate(X_, periodic_axes=(0, 1))
    >>> X_test = np.array([[[0., 0., 0.],
    ...                   [0., 1./9, 0.],
    ...                   [0., 0., 0.]]])
    >>> assert(np.allclose(np.real_if_close(X_auto[0, ..., 1]), X_test[0]))
    
Computes the autocorrelation from a microstructure function.
Computes the autocorrelation from a microstructure function .
def autocorrelate(X_, periodic_axes=[], confidence_index=None,
                  autocorrelations=None):
    if periodic_axes is None:
        periodic_axes = []
    if autocorrelations is None:
        correlations = _auto_correlations(X_.shape[-1])
    X_ = _mask_X_(X_, confidence_index)
    s = _Fkernel_shape(X_, periodic_axes)
    auto = _correlate(X_, s, correlations)
    return auto / _normalize(X_, s, confidence_index)
def autocorrelate ( X_ , periodic_axes = [ ] , confidence_index = None , autocorrelations = None ) : if periodic_axes is None : periodic_axes = [ ] if autocorrelations is None : correlations = _auto_correlations ( X_ . shape [ - 1 ] ) X_ = _mask_X_ ( X_ , confidence_index ) s = _Fkernel_shape ( X_ , periodic_axes ) auto = _correlate ( X_ , s , correlations ) return auto / _normalize ( X_ , s , confidence_index )
Computes the autocorrelation from a microstructure function.
Computes the autocorrelation from a microstructure function .
"""
    Computes the autocorrelation from a microstructure function.

    Args:
        X_ (ND array): The discretized microstructure function, an
            `(n_samples, n_x, ..., n_states)` shaped array
            where `n_samples` is the number of samples, `n_x` is thes
            patial discretization, and n_states is the number of local states.
        periodic_axes (list, optional): axes that are periodic. (0, 2) would
            indicate that axes x and z are periodic in a 3D microstrucure.
        confidence_index (ND array, optional): array with same shape as X used
            to assign a confidence value for each data point.
        autocorrelations (list, optional): list of spatial autocorrelatiions to
            be computed. For example [(0, 0), (1, 1)] computes the
            autocorrelations with local states 0 and 1. If no list is passed,
            all autocorrelations are computed.

    Returns:
        Autocorrelations for microstructure function `X_`.

    Non-periodic example

    >>> n_states = 2
    >>> X = np.array([[[0, 0, 0],
    ...                [0, 1, 0],
    ...                [0, 0, 0]]])
    >>> from pymks.bases import PrimitiveBasis
    >>> prim_basis = PrimitiveBasis(n_states=n_states)
    >>> X_ = prim_basis.discretize(X)
    >>> X_auto = autocorrelate(X_, periodic_axes=(0, 1))
    >>> X_test = np.array([[[0., 0., 0.],
    ...                   [0., 1./9, 0.],
    ...                   [0., 0., 0.]]])
    >>> assert(np.allclose(np.real_if_close(X_auto[0, ..., 1]), X_test[0]))
    """
Autocorrelations for microstructure function `X_`.
Autocorrelations for microstructure function ` X_ ` .
X_
The discretized microstructure function, an
`(n_samples, n_x, ..., n_states)` shaped array
where `n_samples` is the number of samples, `n_x` is thes
patial discretization, and n_states is the number of local states.
The discretized microstructure function an ` ( n_samples n_x ... n_states ) ` shaped array where ` n_samples ` is the number of samples ` n_x ` is thes patial discretization and n_states is the number of local states .
periodic_axes
axes that are periodic. (0, 2) would
indicate that axes x and z are periodic in a 3D microstrucure.
axes that are periodic . ( 0 2 ) would indicate that axes x and z are periodic in a 3D microstrucure .
confidence_index
array with same shape as X used
to assign a confidence value for each data point.
array with same shape as X used to assign a confidence value for each data point .
autocorrelations
list of spatial autocorrelatiions to
be computed. For example [(0, 0), (1, 1)] computes the
autocorrelations with local states 0 and 1. If no list is passed,
all autocorrelations are computed.
list of spatial autocorrelatiions to be computed . For example [ ( 0 0 ) ( 1 1 ) ] computes the autocorrelations with local states 0 and 1 . If no list is passed all autocorrelations are computed .