def labelNonFinitePoints(polyData, arrayName='Points'):
    pts = vnp.getNumpyFromVtk(polyData, arrayName)
    labels = np.logical_not(np.isfinite(pts)).any(axis=1)
    vnp.addNumpyToVtk(polyData, np.array(labels, dtype=np.int32), 'is_nonfinite')
adds is_nonfinite label to polyData.  non finite includes nan and +/- inf.
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/filterUtils.py/labelNonFinitePoints