remove#

VectorArray.remove(condition, squeeze=True, setval=nan)[source]#

Remove all vectors i where condition[i] == True.

Parameters:
conditionndarray of booleans

Mask controlling which vectors get removed.

squeezebool, default True.

If true, completely remove vectors. Otherwise fill affected vectors with setval.

setvalfloat, default np.nan

If squeeze is false, fill removed data with this.

Returns:
vectorsVectorArray

Examples

>>> vecs = ap.VectorArray([[1, 2, 3], [4, 5, 6], [6, 7, 8]])
>>> vecs.remove(vecs.x == 1)
VectorArray([[4. 5. 6.]
             [6. 7. 8.]])
>>> vecs.remove(vecs.x == 1, squeeze = False)
VectorArray([[nan nan nan]
             [ 4.  5.  6.]
             [ 6.  7.  8.]])
>>> vecs.remove(vecs.x == 1, squeeze = False, setval=0.0)
VectorArray([[0. 0. 0.]
             [4. 5. 6.]
             [6. 7. 8.]])