def run(nregs): nrough = nregs[0] ntop = nregs[1] outf = 'outs/nrough_%02d_ntop_%02d.h5' % (nrough, ntop) print(outf) stdout = sys.stdout fid = open(os.devnull, 'w') sys.stdout = fid inv = StaticInversion( file_G='../../green_function/G5_He63km_VisM1.0E19_Rake83.h5', file_d='../../cumu_post_with_seafloor.h5', file_sd='../sd/sd_seafloor_01.h5', file_sites_filter='sites_with_seafloor', regularization=None, basis=basis_b_spline, ) inv.set_data_except(excepts=['L']) reg = Composite().\ add_component(component = reg_north, arg = 1e5, arg_name = 'north').\ add_component(component = reg_south, arg = 1e5, arg_name = 'south').\ add_component(component = rough, arg = reg_roughs[nrough], arg_name = 'roughening').\ add_component(component = reg_top, arg = reg_tops[ntop], arg_name = 'top') inv.regularization = reg inv.set_data_L() inv.invert() inv.predict() inv.save(outf, overwrite=True) sys.stdout = stdout fid.close()
def run(epoch): print(epoch) stdout = sys.stdout fid = open(os.devnull, 'w') sys.stdout = fid inv = StaticInversion( file_G='../G_He40km_Vis1.1E19_Rake81.h5', file_d='../cumu_post_with_seafloor.h5', file_sd='../sd/sd_ozawa.h5', file_sites_filter='../sites_with_seafloor', regularization=None, basis=basis, epoch=epoch, ) inv.set_data_except(excepts=['L']) for nrough in range(len(roughs)): outf = 'outs/epoch_%04d_rough_%02d.h5' % (epoch, nrough) print(outf) reg = Composite().\ add_component(component = reg_north, arg = 1e5, arg_name = 'north').\ add_component(component = reg_south, arg = 1e5, arg_name = 'south').\ add_component(component = rough, arg = roughs[nrough], arg_name = 'roughening').\ add_component(component = reg_top, arg = 0.02, arg_name = 'top') inv.regularization = reg inv.set_data_L() inv.invert() inv.predict() inv.save(outf, overwrite=True) sys.stdout = stdout fid.close()
def test_StaticInversion(self): fault_file = join(self.share_dir, 'fault_He50km_east.h5') rough = Roughening.create_from_fault_file(fault_file) reg = Composite().add_component(rough, 1., 'roughening') basis = BasisMatrix.create_from_fault_file(fault_file) inv = StaticInversion( file_G=join(self.share_dir, 'G.h5'), file_d=join(self.share_dir, 'cumu_post_with_seafloor.h5'), file_sd=join(self.share_dir, 'sites_sd.h5'), file_sites_filter=join(self.share_dir, 'sites_with_seafloor'), regularization=reg, basis=basis, ) inv.set_data_all() inv.run() inv.save(join(self.outs_dir, 'out.h5'), overwrite=True)
epochs = [0] fault_file = '../../fault_model/fault_bott60km.h5' basis = BasisMatrix.create_from_fault_file(fault_file) rough = Roughening.create_from_fault_file(fault_file) inv = OccamDeconvolution( file_G0='../../green_function/G0_He63km_VisM1.0E19_Rake90.h5', files_Gs=['../../green_function/G1_He63km_VisM1.0E19_Rake80.h5'], nlin_par_names=['rake'], file_d='../../cumu_post_with_seafloor.h5', file_sd='../sd/sd_seafloor_inf.h5', file_incr_slip0='slip0/slip0.h5', filter_sites_file='sites_with_seafloor', epochs=epochs, regularization=rough, basis=basis, ) inv.set_data_except_L() for nth, alpha in enumerate(logspace(-4, 0, 30)): reg = Composite().add_component(component=rough, arg=alpha, arg_name='roughening') inv.regularization = reg inv.set_data_L() inv.invert() inv.predict() inv.save('outs/ano_%02d.h5' % nth, overwrite=True)
reg_north = NorthBoundary.create_from_fault_file(fault_file) reg_south = SouthBoundary.create_from_fault_file(fault_file) reg_top = FaultTopBoundary.create_from_fault_file(fault_file) basis = BasisMatrix.create_from_fault_file(fault_file) basis_b_spline = BasisMatrixBSpline.create_from_fault_file(fault_file) inv = StaticInversion( file_G='../../green_function/G5_He63km_VisM1.0E19_Rake83.h5', file_d='../../cumu_post_with_seafloor.h5', file_sd='../sd/sd_seafloor_01.h5', file_sites_filter='sites_with_seafloor', regularization=None, basis=basis_b_spline, ) inv.set_data_except(excepts=['L']) roughs = logspace(-4, 0, 30) for nrough in range(len(roughs)): outf = 'outs/rough_%02d.h5' % (nrough) print(outf) reg = Composite().add_component(component=rough, arg=roughs[nrough], arg_name='roughening') inv.regularization = reg inv.set_data_L() inv.invert() inv.predict() inv.save(outf, overwrite=True)
roughs = logspace(-3, 1, 30) ndamp = 0 nrough = 9 outf = 'outs/ndamp_%02d_rough_%02d.h5' % (ndamp, nrough) print(outf) reg = Composite().\ add_component(component = reg_north, arg = 1e5, arg_name = 'north').\ add_component(component = reg_south, arg = 1e5, arg_name = 'south').\ add_component(component = rough, arg = roughs[nrough], arg_name = 'roughening').\ add_component(component = damping, arg = damps[ndamp], arg_name = 'damping').\ add_component(component = reg_top, arg = 0.01, arg_name = 'top') inv.regularization = reg inv.set_data_L() inv.invert() inv.predict() inv.save(outf, overwrite=True)