Python numpy.core.numeric.compress() Examples
The following are 4
code examples of numpy.core.numeric.compress().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.core.numeric
, or try the search function
.
Example #1
Source File: ma.py From Computable with MIT License | 5 votes |
def compressed (self): "A 1-D array of all the non-masked data." d = fromnumeric.ravel(self._data) if self._mask is nomask: return array(d) else: m = 1 - fromnumeric.ravel(self._mask) c = fromnumeric.compress(m, d) return array(c, copy=0)
Example #2
Source File: ma.py From Computable with MIT License | 5 votes |
def put (self, values): """Set the non-masked entries of self to filled(values). No change to mask """ iota = numeric.arange(self.size) d = self._data if self._mask is nomask: ind = iota else: ind = fromnumeric.compress(1 - self._mask, iota) d[ind] = filled(values).astype(d.dtype)
Example #3
Source File: ma.py From Computable with MIT License | 5 votes |
def compress(condition, x, dimension=-1, out=None): """Select those parts of x for which condition is true. Masked values in condition are considered false. """ c = filled(condition, 0) m = getmask(x) if m is not nomask: m = numeric.compress(c, m, dimension) d = numeric.compress(c, filled(x), dimension) return masked_array(d, m)
Example #4
Source File: ma.py From Computable with MIT License | 5 votes |
def _compress(self, cond, axis=None, out=None): return compress(cond, self, axis)