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
823f7f32
Commit
823f7f32
authored
1 year ago
by
Michele Maris
Browse files
Options
Downloads
Patches
Plain Diff
u
parent
45d22d3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/yapsut/colored_noise.py
+21
-7
21 additions, 7 deletions
src/yapsut/colored_noise.py
with
21 additions
and
7 deletions
src/yapsut/colored_noise.py
+
21
−
7
View file @
823f7f32
...
...
@@ -42,8 +42,12 @@ class gaussian_colored_noise :
return
self
.
_freq
@property
def
ps_shape
(
self
)
:
"""
the spectral shape: ps_shape=P(f)**0.5
"""
return
self
.
_S
"""
the spectral shape: ps_shape=P(f)
"""
return
self
.
_S2
@property
def
ps_shape_integral
(
self
)
:
"""
the spectral shape integral (excluding the freq=0 sample)
"""
return
self
.
_ps_shape_integral
@property
def
seed
(
self
)
:
"""
the seed of the random number generator
"""
...
...
@@ -95,20 +99,30 @@ Keywords:
pl
=
self
.
alpha
with
np
.
errstate
(
divide
=
'
ignore
'
):
x
=
self
.
fknee
/
np
.
where
(
self
.
_freq
==
0
,
np
.
inf
,
self
.
_freq
)
self
.
_S
=
(
1
+
x
**
pl
)
**
0.5
self
.
_S
2
=
(
1
+
x
**
pl
)
#
if
self
.
_zero_policy
==
'
0
'
:
self
.
_S
[
0
]
=
0.
self
.
_S
2
[
0
]
=
0.
elif
self
.
_zero_policy
==
'
1
'
:
self
.
_S
[
0
]
=
1.
self
.
_S
2
[
0
]
=
1.
elif
self
.
_zero_policy
==
'
M
'
:
self
.
_S
[
0
]
=
self
.
wn_mean
self
.
_S
2
[
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
self
.
_S
2
[
0
]
=
(
1
+
100
*
(
self
.
fknee
/
self
.
_freq
[
1
])
**
pl
)
else
:
# self._zero_policy=='I' :
# left things as they are
pass
#
self
.
_S
=
self
.
_S2
**
0.5
#
x
=
self
.
freq
[
1
:]
y
=
self
.
_S2
[
1
:]
self
.
_ps_shape_integral
=
((
y
[
1
:]
+
y
[:
-
1
])
*
(
x
[
1
:]
-
x
[:
-
1
])).
sum
()
/
2
*
2
#
def
__len__
(
self
)
:
return
self
.
_N
def
__str__
(
self
)
:
return
str
((
self
.
N
,
self
.
wn_mean
,
self
.
wn_sigma
,
self
.
fknee
,
self
.
alpha
,
self
.
seed
,
self
.
_zero_policy
))
def
__call__
(
self
,
OutAll
=
False
)
:
"""
computes the colored noise, if OutAll == False returns just the cn if True returns
(colored_noise,white_noise,colored_noise_rfft, colored_noise_shape, white_noise_rfft, original_white_noise)
...
...
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