Commit 057eed1f authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

Merge branch 'solver_plot' of gitext:heimann/grond into solver_plot

parents cdccb37e cac27521
......@@ -775,6 +775,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)
......@@ -818,26 +819,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
......@@ -1929,16 +1937,20 @@ def check(
freqlimits[3] = 0.5/deltat
freqlimits = tuple(freqlimits)
trs_projected, trs_restituted, trs_raw = \
ds.get_waveform(
target.codes,
tmin=tmin+tobs_shift,
tmax=tmax+tobs_shift,
tfade=tfade,
freqlimits=freqlimits,
deltat=deltat,
backazimuth=target.get_backazimuth_for_waveform(),
debug=True)
try:
trs_projected, trs_restituted, trs_raw = \
ds.get_waveform(
target.codes,
tmin=tmin+tobs_shift,
tmax=tmax+tobs_shift,
tfade=tfade,
freqlimits=freqlimits,
deltat=deltat,
backazimuth=target.get_backazimuth_for_waveform(),
debug=True)
except dataset.NotFound, e:
logger.warn(str(e))
continue
trs_projected = copy.deepcopy(trs_projected)
trs_restituted = copy.deepcopy(trs_restituted)
......@@ -2066,8 +2078,8 @@ def check(
event.name or util.time_to_str(event.time),
str(e)))
if show_waveforms:
trace.snuffle(trs_all, stations=ds.get_stations(), markers=markers)
if show_waveforms:
trace.snuffle(trs_all, stations=ds.get_stations(), markers=markers)
g_state = {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment