示例#1
0
    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)
    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)
示例#3
0
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()
示例#4
0
fault_file = '../../fault_model/fault_bott60km.h5'

rough = Roughening.create_from_fault_file(fault_file)
damping = vj.Intensity.create_from_fault_file(fault_file)
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_inf.h5',
    file_sites_filter = 'sites_with_seafloor',
    regularization = None,
    basis = basis,
)
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()
示例#5
0
fault_file = '../../fault_model/fault_bott60km.h5'

rough = Roughening.create_from_fault_file(fault_file)
damping = vj.Intensity.create_from_fault_file(fault_file)
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()
示例#6
0
fault_file = '../fault_model/fault_bott80km.h5'

rough = vj.inv.reg.Roughening.create_from_fault_file(fault_file)

basis = BasisMatrix.create_from_fault_file(fault_file)
basis_b_spline = BasisMatrixBSpline.create_from_fault_file(fault_file)

reg_roughes = logspace(-3,1,20)

for epoch in epochs:
    inv = StaticInversion(
        file_G = '../green_function/G0_He50km_VisM6.3E18_Rake83.h5',
        file_d = '../obs/cumu_post_with_seafloor.h5',
        file_sd = '../sd/sd_uniform.h5',
        filter_sites_file = 'sites_with_seafloor',
        regularization = None,
        basis = basis,
        fault_file=fault_file,
        epoch = epoch,
    )
    inv.set_data_except(excepts=['L']) 
    
    for nrough, r in enumerate(reg_roughes):
        outf_dir = 'outs/outs_%04d/'%epoch
        if not exists(outf_dir):
            makedirs(outf_dir)
        outf = join(outf_dir, 'rough_%02d.h5'%(nrough))
        print(outf)
        reg = vj.inv.reg.Composite().add_component(component = rough,
                                        arg = r,
                                        arg_name = 'roughening')
示例#7
0
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()
示例#8
0
from viscojapan.inversion.static_inversion import StaticInversion

fault_file = '../../fault_model/fault_bott50km.h5'

rough = Roughening.create_from_fault_file(fault_file)
damping = vj.Intensity.create_from_fault_file(fault_file)
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)

inv = StaticInversion(
    file_G='../../greens_function/G_He63km_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,
)
inv.set_data_except(excepts=['L'])

edge_pars = np.logspace(-3, 1, 10)

damps = logspace(-3, 1, 30)
roughs = logspace(-3, 1, 30)

ndamp = 0
nrough = 9

outf = 'outs/ndamp_%02d_rough_%02d.h5' % (ndamp, nrough)
print(outf)
示例#9
0
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()
示例#10
0
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()