Skip to content
Snippets Groups Projects
Commit e7ef8d47 authored by Michele Maris's avatar Michele Maris
Browse files

u

parent 45d22d3a
No related merge requests found
...@@ -10,6 +10,7 @@ Also look at: ...@@ -10,6 +10,7 @@ Also look at:
https://pypi.org/project/colorednoise/ https://pypi.org/project/colorednoise/
pip3 colorednoise --user 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 : ...@@ -30,7 +31,7 @@ class gaussian_colored_noise :
return self._wn_sigma return self._wn_sigma
@property @property
def fknee(self) : def fknee(self) :
"""fknee in units of the fsamp, fknee in [0,0.5]""" """fknee>=0 in units of the fsamp"""
return self._fknee return self._fknee
@property @property
def alpha(self) : def alpha(self) :
...@@ -38,7 +39,7 @@ class gaussian_colored_noise : ...@@ -38,7 +39,7 @@ class gaussian_colored_noise :
return self._alpha return self._alpha
@property @property
def freq(self) : 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 return self._freq
@property @property
def ps_shape(self) : def ps_shape(self) :
...@@ -73,6 +74,7 @@ Keywords: ...@@ -73,6 +74,7 @@ Keywords:
'I' : P(0)**0.5 is left as it is 'I' : P(0)**0.5 is left as it is
'M' : P(0)**0.5 = wn_mean 'M' : P(0)**0.5 = wn_mean
'100x1' : P(0)**0.5=(1+100*fknee/freq[1])**alpha/2 '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 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 default value is 'I' that for alpha > 0 gives P(0)=1
...@@ -105,6 +107,14 @@ Keywords: ...@@ -105,6 +107,14 @@ Keywords:
self._S[0]=self.wn_mean self._S[0]=self.wn_mean
elif self._zero_policy=='100x1' : elif self._zero_policy=='100x1' :
self._S[0]=1 if fknee>ff[1] else (1+100*(self.fknee/self._freq[1])**pl)**0.5 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' : else : # self._zero_policy=='I' :
# left things as they are # left things as they are
pass pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment