coords.Coords.add_noise#

Coords.add_noise(rsize=0.05, asize=0.0)#

Add random noise to a Coords.

A random amount is added to each individual coordinate of the Coords. The maximum difference of the coordinates from their original value is controled by two parameters rsize and asize and will not exceed asize+rsize*self.max_size(). See max_size().

Parameters#

rsize: float

Relative size of the noise compared with the maximum size of the input Coords.

asize: float

Absolute size of the noise

Examples#

>>> X = Coords(np.arange(6).reshape(2,3))
>>> print((abs(X.add_noise(rsize=0.1) - X) < 0.1 * X.sizes()).all())
True