pymks/stats.py
def _normalize(X_, s, confidence_index):
    """
    Returns the normalization for the statistics

    The normalization should be Nx * Ny in the center of the domain.

    Args:
        `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.
        _Fkernel_shape : the shape of the kernel is Fourier space (array)
        confidence_index: array with same shape as X used to assign a
            confidence value for each data point.

    Returns:
        Normalization

    Example

    >>> Nx = Ny = 5
    >>> X_ = np.zeros((1, Nx, Ny, 1))
    >>> _Fkernel_shape  = np.array((2 * Nx, Ny))
    >>> norm =  _normalize(X_, _Fkernel_shape , None)
    >>> assert norm.shape == (1, Nx, Ny, 1)
    >>> assert np.allclose(norm[0, Nx / 2, Ny / 2, 0], 25)
    """

    if (s == X_.shape[1:-1]).all() and confidence_index is None:
        return float(np.prod(X_.shape[1:-1]))
    else:
        mask = confidence_index
        if mask is None:
            mask = np.ones(X_.shape[1:-1])[None]
        corr = Correlation(mask[..., None], Fkernel_shape=s)
        return _truncate(corr.convolve(mask[..., None]), X_.shape[:-1])

    Returns the normalization for the statistics

    The normalization should be Nx * Ny in the center of the domain.

    Args:
        `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.
        _Fkernel_shape : the shape of the kernel is Fourier space (array)
        confidence_index: array with same shape as X used to assign a
            confidence value for each data point.

    Returns:
        Normalization

    Example

    >>> Nx = Ny = 5
    >>> X_ = np.zeros((1, Nx, Ny, 1))
    >>> _Fkernel_shape  = np.array((2 * Nx, Ny))
    >>> norm =  _normalize(X_, _Fkernel_shape , None)
    >>> assert norm.shape == (1, Nx, Ny, 1)
    >>> assert np.allclose(norm[0, Nx / 2, Ny / 2, 0], 25)
    
Returns the normalization for the statistics
The normalization should be Nx * Ny in the center of the domain.
Returns the normalization for the statistics The normalization should be Nx * Ny in the center of the domain .
def _normalize(X_, s, confidence_index):
    if (s == X_.shape[1:-1]).all() and confidence_index is None:
        return float(np.prod(X_.shape[1:-1]))
    else:
        mask = confidence_index
        if mask is None:
            mask = np.ones(X_.shape[1:-1])[None]
        corr = Correlation(mask[..., None], Fkernel_shape=s)
        return _truncate(corr.convolve(mask[..., None]), X_.shape[:-1])
def _normalize ( X_ , s , confidence_index ) : if ( s == X_ . shape [ 1 : - 1 ] ) . all ( ) and confidence_index is None : return float ( np . prod ( X_ . shape [ 1 : - 1 ] ) ) else : mask = confidence_index if mask is None : mask = np . ones ( X_ . shape [ 1 : - 1 ] ) [ None ] corr = Correlation ( mask [ ... , None ] , Fkernel_shape = s ) return _truncate ( corr . convolve ( mask [ ... , None ] ) , X_ . shape [ : - 1 ] )
Returns the normalization for the statistics
The normalization should be Nx * Ny in the center of the domain.
Returns the normalization for the statistics The normalization should be Nx * Ny in the center of the domain .
"""
    Returns the normalization for the statistics

    The normalization should be Nx * Ny in the center of the domain.

    Args:
        `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.
        _Fkernel_shape : the shape of the kernel is Fourier space (array)
        confidence_index: array with same shape as X used to assign a
            confidence value for each data point.

    Returns:
        Normalization

    Example

    >>> Nx = Ny = 5
    >>> X_ = np.zeros((1, Nx, Ny, 1))
    >>> _Fkernel_shape  = np.array((2 * Nx, Ny))
    >>> norm =  _normalize(X_, _Fkernel_shape , None)
    >>> assert norm.shape == (1, Nx, Ny, 1)
    >>> assert np.allclose(norm[0, Nx / 2, Ny / 2, 0], 25)
    """
None
X_
s
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 .
`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 .
_Fkernel_shape 
the shape of the kernel is Fourier space (array)
the shape of the kernel is Fourier space ( array )