removeNaNs

Return to directory of Todd's tools

Remove or replace the nan values from a (possibly multi-dimensional) array.

Usage:

tt.removeNaNs(b, replaceWithMin=False, verbose=False)
Inputs:
  • replaceWithMin: if True, then replace!NaNs with np.nanmin of array; if False, then simply remove the NaNs

Examples:

CASA <4>: tt.removeNaNs([1,2,3,numpy.nan,4,5], verbose=True)
Removed 1 NaNs
  Out[4]: array([ 1.,  2.,  3.,  4.,  5.])

CASA <5>: tt.removeNaNs([1,2,3,numpy.nan,4,5],replaceWithMin=True)
  Out[5]: array([ 1.,  2.,  3.,  1.,  4.,  5.])

-- ToddHunter - 2015-05-11

This topic: ALMA > ToddTools > RemoveNaNs
Topic revision: 2015-05-11, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback