Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
YAPSUT
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michele Maris
YAPSUT
Commits
e7ef8d47
Commit
e7ef8d47
authored
1 year ago
by
Michele Maris
Browse files
Options
Downloads
Patches
Plain Diff
u
parent
45d22d3a
Loading
Loading
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/yapsut/colored_noise.py
+12
-2
12 additions, 2 deletions
src/yapsut/colored_noise.py
with
12 additions
and
2 deletions
src/yapsut/colored_noise.py
+
12
−
2
View file @
e7ef8d47
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment