Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Heimann
grond
Commits
c4011c92
Commit
c4011c92
authored
Mar 03, 2017
by
Sebastian Heimann
Browse files
synthetic tests: add relative_white_noise_scale option
parent
cfc3c486
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/core.py
View file @
c4011c92
...
...
@@ -772,6 +772,7 @@ class SyntheticTest(Object):
respect_data_availability
=
Bool
.
T
(
default
=
False
)
real_noise_scale
=
Float
.
T
(
default
=
0.0
)
white_noise_scale
=
Float
.
T
(
default
=
0.0
)
relative_white_noise_scale
=
Float
.
T
(
default
=
0.0
)
random_response_scale
=
Float
.
T
(
default
=
0.0
)
real_noise_toffset
=
Float
.
T
(
default
=-
3600.
)
random_seed
=
Int
.
T
(
optional
=
True
)
...
...
@@ -815,26 +816,33 @@ class SyntheticTest(Object):
for
iresult
,
result
in
enumerate
(
results
):
tr
=
result
.
trace
.
pyrocko_trace
()
tfade
=
tr
.
tmax
-
tr
.
tmin
tr_orig
=
tr
.
copy
()
tr
.
extend
(
tr
.
tmin
-
tfade
,
tr
.
tmax
+
tfade
)
rstate
=
num
.
random
.
RandomState
(
(
self
.
random_seed
or
0
)
+
iresult
)
if
self
.
random_response_scale
!=
0
:
tf
=
RandomResponse
(
scale
=
self
.
random_response_scale
)
rstate
=
num
.
random
.
RandomState
(
(
self
.
random_seed
or
0
)
+
iresult
)
tf
.
set_random_state
(
rstate
)
tr
=
tr
.
transfer
(
tfade
=
tfade
,
transfer_function
=
tf
)
if
self
.
white_noise_scale
!=
0.0
:
rstate
=
num
.
random
.
RandomState
(
(
self
.
random_seed
or
0
)
+
iresult
)
u
=
rstate
.
normal
(
scale
=
self
.
white_noise_scale
,
size
=
tr
.
data_len
())
tr
.
ydata
+=
u
if
self
.
relative_white_noise_scale
!=
0.0
:
u
=
rstate
.
normal
(
scale
=
self
.
relative_white_noise_scale
*
num
.
std
(
tr_orig
.
ydata
),
size
=
tr
.
data_len
())
tr
.
ydata
+=
u
synthetics
[
result
.
trace
.
codes
]
=
tr
self
.
_synthetics
=
synthetics
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment