コード例 #1
0
def qtmax(var, qt=95.):
    """Get max using quantiles

    This is useful for very asymmetic distributions

    :Params:

        - **var**: A numeric array.
        - **qt**, optional: Percentile used to define max
    """
    if N.ma.isMA(var): var = var.compressed()
    qt = N.clip([qt], 0, 100.)
    vmax = percentiles(var.ravel(), qt)
    return vmax
コード例 #2
0
ファイル: stats.py プロジェクト: jfleroux/vacumm
def qtmax(var, qt=95.):
    """Get max using quantiles

    This is useful for very asymmetic distributions

    :Params:

        - **var**: A numeric array.
        - **qt**, optional: Percentile used to define max
    """
    if N.ma.isMA(var): var = var.compressed()
    qt = N.clip([qt], 0, 100.)
    vmax = percentiles(var.ravel(), qt)
    return vmax
コード例 #3
0
def qtminmax(var, qt=5.):
    """Get min and max using quantiles

    This is useful for very asymmetic distributions

    :Params:

        - **var**: A numeric array.
        - **qt**, optional: Percentile used to define min and max

            - Single number: ``qt`` -> ``[qt, 100-qt]``
            - Two elements: used directly.
    """
    if N.ma.isMA(var): var = var.compressed()
    if not hasattr(qt, '__len__'):
        qt = [qt, 100-qt]
    qt = N.sort(N.clip(N.asarray(qt), 0, 100.))
    vmin, vmax = percentiles(var.ravel(), qt)
    return vmin, vmax
コード例 #4
0
ファイル: stats.py プロジェクト: jfleroux/vacumm
def qtminmax(var, qt=5.):
    """Get min and max using quantiles

    This is useful for very asymmetic distributions

    :Params:

        - **var**: A numeric array.
        - **qt**, optional: Percentile used to define min and max

            - Single number: ``qt`` -> ``[qt, 100-qt]``
            - Two elements: used directly.
    """
    if N.ma.isMA(var): var = var.compressed()
    if not hasattr(qt, '__len__'):
        qt = [qt, 100-qt]
    qt = N.sort(N.clip(N.asarray(qt), 0, 100.))
    vmin, vmax = percentiles(var.ravel(), qt)
    return vmin, vmax