diff --git a/src/yapsut/colored_noise.py b/src/yapsut/colored_noise.py index 055d7f433793001d2a8c228d75021185e0fd9dab..1ddfc2d012ac86a190e3e415a0e60e55b8a4e41f 100644 --- a/src/yapsut/colored_noise.py +++ b/src/yapsut/colored_noise.py @@ -10,6 +10,7 @@ Also look at: https://pypi.org/project/colorednoise/ pip3 colorednoise --user +Note that the kneew frequency fknee can have any value, it is not restricted to fsamp/2 """ @@ -30,7 +31,7 @@ class gaussian_colored_noise : return self._wn_sigma @property def fknee(self) : - """fknee in units of the fsamp, fknee in [0,0.5]""" + """fknee>=0 in units of the fsamp""" return self._fknee @property def alpha(self) : @@ -38,7 +39,7 @@ class gaussian_colored_noise : return self._alpha @property def freq(self) : - """the frequencies in units of fsamp in the range [0,0.5].""" + """the sampled frequencies in units of fsamp in the range [0,0.5].""" return self._freq @property def ps_shape(self) : @@ -73,6 +74,7 @@ Keywords: 'I' : P(0)**0.5 is left as it is 'M' : P(0)**0.5 = wn_mean '100x1' : P(0)**0.5=(1+100*fknee/freq[1])**alpha/2 + 'midf1' : P(0)=P(f[1]/2) = exp((log P[2]-log P[1])/(log f2 - log f1)*(log f1/2 - log f1)+log P(1)) note that zero_policy affects the mean value of the chunck but not its variance default value is 'I' that for alpha > 0 gives P(0)=1 @@ -105,6 +107,14 @@ Keywords: self._S[0]=self.wn_mean elif self._zero_policy=='100x1' : self._S[0]=1 if fknee>ff[1] else (1+100*(self.fknee/self._freq[1])**pl)**0.5 + elif self._zero_policy=='midf1' : + y1=np.log(self._S[1]) + y2=np.log(self._S[2]) + x1=np.log(self._freq[1]) + x2=np.log(self._freq[2]) + r=(y2-y1)/(x2-x1) + z=r*(np.log(self._freq[1]/2)-x1)+y1 + self._S[0]=np.exp(z) else : # self._zero_policy=='I' : # left things as they are pass