OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
numpy
/
ma
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
__init__.py
1.45 KB
09/29/2017 05:31:46 PM
rw-r--r--
📁
__pycache__
-
10/28/2024 08:45:53 AM
rwxr-xr-x
📄
bench.py
4.8 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
core.py
248.93 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
extras.py
54.63 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
mrecords.py
26.78 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
setup.py
429 bytes
09/17/2017 01:29:38 PM
rw-r--r--
📁
tests
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
testutils.py
10.13 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
timer_comparison.py
15.23 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
version.py
380 bytes
09/17/2017 01:29:38 PM
rw-r--r--
Editing: __init__.py
Close
""" ============= Masked Arrays ============= Arrays sometimes contain invalid or missing data. When doing operations on such arrays, we wish to suppress invalid values, which is the purpose masked arrays fulfill (an example of typical use is given below). For example, examine the following array: >>> x = np.array([2, 1, 3, np.nan, 5, 2, 3, np.nan]) When we try to calculate the mean of the data, the result is undetermined: >>> np.mean(x) nan The mean is calculated using roughly ``np.sum(x)/len(x)``, but since any number added to ``NaN`` [1]_ produces ``NaN``, this doesn't work. Enter masked arrays: >>> m = np.ma.masked_array(x, np.isnan(x)) >>> m masked_array(data = [2.0 1.0 3.0 -- 5.0 2.0 3.0 --], mask = [False False False True False False False True], fill_value=1e+20) Here, we construct a masked array that suppress all ``NaN`` values. We may now proceed to calculate the mean of the other values: >>> np.mean(m) 2.6666666666666665 .. [1] Not-a-Number, a floating point value that is the result of an invalid operation. .. moduleauthor:: Pierre Gerard-Marchant .. moduleauthor:: Jarrod Millman """ from __future__ import division, absolute_import, print_function from . import core from .core import * from . import extras from .extras import * __all__ = ['core', 'extras'] __all__ += core.__all__ __all__ += extras.__all__ from numpy.testing.nosetester import _numpy_tester test = _numpy_tester().test bench = _numpy_tester().bench