Commit 854bc564 authored by Marius Isken's avatar Marius Isken
Browse files

Bugfix harvest

parent 23100d5a
...@@ -57,6 +57,7 @@ def weed(origin, targets, limit, neighborhood=3): ...@@ -57,6 +57,7 @@ def weed(origin, targets, limit, neighborhood=3):
class BadProblem(Exception): class BadProblem(Exception):
pass pass
class EngineConfig(HasPaths): class EngineConfig(HasPaths):
gf_stores_from_pyrocko_config = Bool.T(default=True) gf_stores_from_pyrocko_config = Bool.T(default=True)
gf_store_superdirs = List.T(Path.T()) gf_store_superdirs = List.T(Path.T())
...@@ -124,6 +125,11 @@ def sarr(a): ...@@ -124,6 +125,11 @@ def sarr(a):
return ' '.join('%15g' % x for x in a) return ' '.join('%15g' % x for x in a)
def load_config(dirname):
fn = op.join(dirname, 'config.yaml')
return guts.load(filename=fn)
def load_problem_info_and_data(dirname, subset=None): def load_problem_info_and_data(dirname, subset=None):
problem = load_problem_info(dirname) problem = load_problem_info(dirname)
xs, misfits = load_problem_data(xjoin(dirname, subset), problem) xs, misfits = load_problem_data(xjoin(dirname, subset), problem)
...@@ -341,6 +347,8 @@ def harvest(rundir, problem=None, nbest=10, force=False, weed=0): ...@@ -341,6 +347,8 @@ def harvest(rundir, problem=None, nbest=10, force=False, weed=0):
else: else:
xs, misfits = load_problem_data(rundir, problem) xs, misfits = load_problem_data(rundir, problem)
config = load_config(rundir)
dumpdir = op.join(rundir, 'harvest') dumpdir = op.join(rundir, 'harvest')
if op.exists(dumpdir): if op.exists(dumpdir):
if force: if force:
...@@ -358,7 +366,7 @@ def harvest(rundir, problem=None, nbest=10, force=False, weed=0): ...@@ -358,7 +366,7 @@ def harvest(rundir, problem=None, nbest=10, force=False, weed=0):
ibests_list.append(isort[:nbest]) ibests_list.append(isort[:nbest])
if weed != 3: if weed != 3:
for ibootstrap in xrange(problem.nbootstrap): for ibootstrap in xrange(config.solver_config.nbootstrap):
bms = problem.bootstrap_misfits(misfits, ibootstrap) bms = problem.bootstrap_misfits(misfits, ibootstrap)
isort = num.argsort(bms) isort = num.argsort(bms)
ibests_list.append(isort[:nbest]) ibests_list.append(isort[:nbest])
......
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