This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / core / masked_outside

function

numpy.ma.core:masked_outside

source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :2206

Signature

def   masked_outside ( x v1 v2 copy = True )

Summary

Mask an array outside a given interval.

Extended Summary

Shortcut to masked_where, where condition is True for x outside the interval [v1,v2] (x < v1)|(x > v2). The boundaries v1 and v2 can be given in either order.

Notes

The array x is prefilled with its filling value.

Examples

import numpy as np
import numpy.ma as ma
x = [0.31, 1.2, 0.01, 0.2, -0.4, -1.1]
ma.masked_outside(x, -0.3, 0.3)
The order of `v1` and `v2` doesn't matter.
ma.masked_outside(x, 0.3, -0.3)

See also

masked_where

Mask where a condition is met.

Aliases

  • numpy.ma.masked_outside