polarcbo.noise.normal_noise

class polarcbo.noise.normal_noise(tau=0.1)[source]

Bases: noise_model

Model for normal distributed noise

This class implements a normal noise model with zero mean and covariance matrix \(\tau I_d\) where \(\tau\) is a parameter of the class. Given the vector \(x_i - \mathsf{m}(x_i)\), the noise vector is computed as

\[n_i = \tau \sqrt{\|x_i - \mathsf{m}(x_i)\|_2}\ \mathcal{N}(0,1)\]
Parameters:

tau (float, optional) – The parameter \(\tau\) of the noise model. The default is 0.1.

Examples

>>> import numpy as np
>>> from polarcbo.noise import normal_noise
>>> m_diff = np.array([[2,3], [4,5], [1,4.]])
>>> noise = normal_noise(tau=0.1)
>>> noise(m_diff)
array([[-2.4309445 ,  1.34997294],
       [-1.08502177,  0.24030935],
       [ 0.1794014 , -1.09228077]])
__call__(m_diff)[source]

Call method for classes that inherit from noise_model

Parameters:

m_diff (array_like, shape (J, d)) – For a system of \(J\) particles, the i-th row of this array m_diff[i,:] represents the vector \(x_i - \mathsf{m}(x_i)\) where \(x\in\R^d\) denotes the position of the i-th particle and \(\mathsf{m}(x_i)\) its weighted mean.

Returns:

n – The random vector that is computed by the repspective noise model.

Return type:

array_like, shape (J,d)