vcor_dual_prf/vcor_dual_prf.py
def local_valid(mask, kernel=np.ones((3, 3))):
    """
    Calculate number of local neighbours with a valid value

    Parameters
    ----------
    mask : numpy array (2D)
        Boolean label (1/0) indicating non NA gate values.
    kernel : numpy array (2D)
        Convolution kernel indicating which local neighbours to consider

    Returns
    -------
    valid : numpy array (2D)  of int
        Number of valid neighbours for each gate.
    """

    # Add dummy columns to mask
    mask = (~mask).astype(int)
    ncols, mask_tmp = _dummy_cols(mask, kernel, value=0)

    # Convolve with kernel to calculate number of valid neighbours
    valid_tmp = ndimage.convolve(mask_tmp, kernel, mode='wrap')

    # Remove added values
    valid = valid_tmp[:, : (valid_tmp.shape[1] - ncols)]

    return valid.astype(int)

    Calculate number of local neighbours with a valid value

    Parameters
    ----------
    mask : numpy array (2D)
        Boolean label (1/0) indicating non NA gate values.
    kernel : numpy array (2D)
        Convolution kernel indicating which local neighbours to consider

    Returns
    -------
    valid : numpy array (2D)  of int
        Number of valid neighbours for each gate.
    
Calculate number of local neighbours with a valid value
Parameters

mask : numpy array (2D)
Boolean label (1/0) indicating non NA gate values.
kernel : numpy array (2D)
Convolution kernel indicating which local neighbours to consider

Returns

valid : numpy array (2D)  of int
Number of valid neighbours for each gate.
Calculate number of local neighbours with a valid value Parameters mask : numpy array ( 2D ) Boolean label ( 1 / 0 ) indicating non NA gate values . kernel : numpy array ( 2D ) Convolution kernel indicating which local neighbours to consider Returns valid : numpy array ( 2D ) of int Number of valid neighbours for each gate .
def local_valid(mask, kernel=np.ones((3, 3))):
    mask = (~mask).astype(int)
    ncols, mask_tmp = _dummy_cols(mask, kernel, value=0)
    valid_tmp = ndimage.convolve(mask_tmp, kernel, mode='wrap')
    valid = valid_tmp[:, : (valid_tmp.shape[1] - ncols)]
    return valid.astype(int)
def local_valid ( mask , kernel = np . ones ( ( 3 , 3 ) ) ) : mask = ( ~ mask ) . astype ( int ) ncols , mask_tmp = _dummy_cols ( mask , kernel , value = 0 ) valid_tmp = ndimage . convolve ( mask_tmp , kernel , mode = 'wrap' ) valid = valid_tmp [ : , : ( valid_tmp . shape [ 1 ] - ncols ) ] return valid . astype ( int )
Calculate number of local neighbours with a valid value
Parameters
Calculate number of local neighbours with a valid value Parameters
"""
    Calculate number of local neighbours with a valid value

    Parameters
    ----------
    mask : numpy array (2D)
        Boolean label (1/0) indicating non NA gate values.
    kernel : numpy array (2D)
        Convolution kernel indicating which local neighbours to consider

    Returns
    -------
    valid : numpy array (2D)  of int
        Number of valid neighbours for each gate.
    """ # Add dummy columns to mask # Convolve with kernel to calculate number of valid neighbours # Remove added values
mask
kernel