Commit b6d0ee83 authored by Sebastian Heimann's avatar Sebastian Heimann

reenable DoubleDCProblem and integrated synthetic tests

parent 06787798
......@@ -400,6 +400,26 @@ class Problem(Object):
return misfits
def forward(self, x):
source = self.get_source(x)
engine = self.get_engine()
plain_targets = []
for target in self.targets:
plain_targets.extend(target.get_plain_targets())
resp = engine.process(source, plain_targets)
results = []
for target, result in zip(self.targets, resp.results_list[0]):
if isinstance(result, gf.SeismosizerError):
logger.debug(
'%s.%s.%s.%s: %s' % (target.codes + (str(result),)))
else:
results.append(result)
return results
class InvalidRundir(Exception):
pass
......
......@@ -20,7 +20,7 @@ class DoubleDCProblemConfig(ProblemConfig):
ranges = Dict.T(String.T(), gf.Range.T())
distance_min = Float.T(default=0.0)
def get_problem(self, event, targets):
def get_problem(self, event, target_groups, targets):
if event.depth is None:
event.depth = 0.
......@@ -35,6 +35,7 @@ class DoubleDCProblemConfig(ProblemConfig):
name=expand_template(self.name_template, subs),
apply_balancing_weights=self.apply_balancing_weights,
base_source=base_source,
target_groups=target_groups,
targets=targets,
ranges=self.ranges,
distance_min=self.distance_min,
......@@ -89,6 +90,9 @@ class DoubleDCProblem(Problem):
raise KeyError(pname)
def pack(self, source):
dur1 = source.stf1.duration if source.stf1 else 0.0
dur2 = source.stf2.duration if source.stf2 else 0.0
x = num.array([
source.time - self.base_source.time,
source.north_shift,
......@@ -106,8 +110,8 @@ class DoubleDCProblem(Problem):
source.azimuth,
source.distance,
source.mix,
source.stf1.duration,
source.stf2.duration], dtype=num.float)
dur1,
dur2], dtype=num.float)
return x
......
......@@ -342,6 +342,11 @@ class WaveformMisfitTarget(gf.Target, MisfitTarget):
def finalize_modelling(self, modelling_results):
return modelling_results[0]
def get_plain_targets(self):
d = dict(
(k, getattr(self, k)) for k in gf.Target.T.propnames)
return [gf.Target(**d)]
def misfit(
tr_obs, tr_syn, taper, domain, exponent, tautoshift_max,
......
Markdown is supported
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