How to use the cooltools.numutils.fill_diag function in cooltools

To help you get started, we’ve selected a few cooltools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Phlya / coolpuppy / coolpuppy / coolpup.py View on Github external
Parameters
    ----------
    amap : 2D array
        Pileup.
    ignore_central : int, optional
        How many central bins to ignore. Has to be odd or 0. The default is 0.

    Returns
    -------
    float
        Insulation strength.

    """
    for d in range(ignore_diags):
        amap = numutils.fill_diag(amap, np.nan, d)
        if d != 0:
            amap = numutils.fill_diag(amap, np.nan, -d)
    if ignore_central!=0 and ignore_central%2!=1:
        raise ValueError(f'ignore_central has to be odd (or 0), got {ignore_central}')
    i = (amap.shape[0] - ignore_central)//2
    intra = np.nanmean(np.concatenate([amap[:i,   :i].ravel(), amap[-i:, -i:].ravel()]))
    inter = np.nanmean(np.concatenate([amap[:i,   -i:].ravel(), amap[-i:, :i].ravel()]))
    return intra/inter
github Phlya / coolpuppy / coolpuppy / coolpup.py View on Github external
----------
    amap : 2D array
        Pileup.
    ignore_central : int, optional
        How many central bins to ignore. Has to be odd or 0. The default is 0.

    Returns
    -------
    float
        Insulation strength.

    """
    for d in range(ignore_diags):
        amap = numutils.fill_diag(amap, np.nan, d)
        if d != 0:
            amap = numutils.fill_diag(amap, np.nan, -d)
    if ignore_central!=0 and ignore_central%2!=1:
        raise ValueError(f'ignore_central has to be odd (or 0), got {ignore_central}')
    i = (amap.shape[0] - ignore_central)//2
    intra = np.nanmean(np.concatenate([amap[:i,   :i].ravel(), amap[-i:, -i:].ravel()]))
    inter = np.nanmean(np.concatenate([amap[:i,   -i:].ravel(), amap[-i:, :i].ravel()]))
    return intra/inter