Ejemplo n.º 1
0
rf_obs, swd_obs, all_lims = input_data.LoadObservations()

save_name += '_%d' % rnd_sd
suffix = None
def outdir_fn():
    if suffix is None:
        return os.path.join('output', save_name)
    else:
        return os.path.join('output', '%s_%05d' % (save_name, suffix))

while os.path.exists(outdir_fn()):
    if suffix is None:
        suffix = 0
    else:
        suffix += 1

outdir = outdir_fn()

os.mkdir(outdir)
shutil.copyfile('input_data.py', os.path.join(outdir, 'input_data.py'))
with tf.Session():
    out = pipeline.JointInversion(rf_obs, swd_obs, all_lims, max_it, rnd_sd,
                                  os.path.join(outdir, save_name), 'Ps')

#pr.disable()
#s=open(os.path.join(outdir, 'profiletimes.txt'), 'w')
#sortby = 'cumulative'
#ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
#ps.print_stats()
#s.close()
Ejemplo n.º 2
0
swd_obs = pipeline.SurfaceWaveDisp(period=np.array(
    [9.0, 10.1, 11.6, 13.5, 16.2, 20.3, 25.0, 32.0, 40.0, 50.0, 60.0, 80.0]),
                                   c=np.array([
                                       3.212, 3.215, 3.233, 3.288, 3.339,
                                       3.388, 3.514, 3.647, 3.715, 3.798,
                                       3.847, 3.937
                                   ]))

all_lims = pipeline.Limits(vs=(0.5, 5.5),
                           dep=(0, 200),
                           std_rf=(0, 0.05),
                           lam_rf=(0.05, 0.5),
                           std_swd=(0, 0.15))

out = pipeline.JointInversion(rf_obs, swd_obs, all_lims, max_it, rnd_sd)

#actual_model = pipeline.SaveModel(pipeline.MakeFullModel(model),out[1][:,0])
#%%
all_models = np.load('testsave.npy')

good_mods = all_models[:, np.where(all_models[0, ] > 0)[0]]
nit = good_mods.shape[1]
good_mods = good_mods[:, -int(nit / 5):]
mean_mod = np.mean(good_mods, axis=1)
std_mod = np.std(good_mods, axis=1)

good_mod = pipeline.Model(vs=mean_mod,
                          all_deps=all_models[:, 0],
                          idep=np.arange(0, mean_mod.size),
                          lam_rf=0,