Utility functions for nsdf.
Find the indices of array elements that match the predicate.
Parameters: |
|
---|---|
Returns: | index_generator – A generator of (indices, data value) tuples which make the predicate True. |
Return type: | generator |
See also
where(), nonzero()
Notes
This function is best used for finding the first, or first few, data values which match the predicate.
Examples
>>> a = np.sin(np.linspace(0, np.pi, 200))
>>> result = find(a, lambda arr: arr > 0.9)
>>> next(result)
((71, ), 0.900479032457)
>>> np.where(a > 0.9)[0][0]
71
Author:
Phil Elson (https://github.com/pelson). Code taken from numpy issue tracker: https://github.com/numpy/numpy/issues/2269# on Wed Jul 30 11:20:23 IST 2014
Return a function that can be passed to h5py.Group.visititem to collect all nodes satisfying match_fn collect in container_list
Pretty-print an HDF5 tree.
Parameters: |
|
---|