Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ma.notmasked_edges

numpy.ma.notmasked_edges(a,axis=None)[source]

Find the indices of the first and last unmasked values along an axis.

If all values are masked, return None. Otherwise, return a listof two tuples, corresponding to the indices of the first and lastunmasked values respectively.

Parameters:

a : array_like

The input array.

axis : int, optional

Axis along which to perform the operation.If None (default), applies to a flattened version of the array.

Returns:

edges : ndarray or list

An array of start and end indexes if there are any masked data inthe array. If there are no masked data in the array,edges is alist of the first and last index.

Examples

>>>a=np.arange(9).reshape((3,3))>>>m=np.zeros_like(a)>>>m[1:,1:]=1
>>>am=np.ma.array(a,mask=m)>>>np.array(am[~am.mask])array([0, 1, 2, 3, 6])
>>>np.ma.notmasked_edges(ma)array([0, 6])

Previous topic

numpy.ma.notmasked_contiguous

Next topic

numpy.ma.clump_masked

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp