How to use the mudpy.forward.tshift function in mudpy

To help you get started, we’ve selected a few mudpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
Data+=read(datafiles[ksta])         
        #Finished reading, filtering, etc now time shift by rupture time and resmaple to data
        ktrace=0
        print("Aligning GFs and resampling to data times...")
        for ksta in range(Nsta):
            #Loop over subfaults
            print('...Working on station #'+str(ksta+1)+' of '+str(Nsta))
            for kfault in range(Nfaults):
                #Assign current GFs
                ss=Stream(Trace())
                ds=Stream(Trace())
                ss[0]=SS[ktrace].copy()
                ds[0]=DS[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ss=tshift(ss,tdelay[kfault])
                ds=tshift(ds,tdelay[kfault])
                #Now time align stuff                                
                #ss=resample_synth_tsun(ss[0],Data[ksta])
                ss=prep_synth(ss[0],Data[ksta])
                #ds=resample_synth_tsun(ds[0],Data[ksta])
                ds=prep_synth(ds[0],Data[ksta])
                #Insert into Gtemp then append to G
                if kfault==0 and ksta==0: #It's the first subfault and station, initalize G
                    G=gdims_tsun(datafiles,Nfaults,decimate) #Survey all stations to decide size of G
                if kfault==0: #Initalize Gtemp (different size for each station)
                    #How many points left in the tiem series
                    npts=Data[ksta].stats.npts
                    print("... ... "+str(npts)+" data points left over")
                    Gtemp=zeros([npts,Nfaults*2])      
                #Insert synthetics into Gtempview
                Gtemp[0:npts,2*kfault]=ss.data
github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
eds=Stream(Trace())
                nds=Stream(Trace())
                zds=Stream(Trace())
                ess[0]=Ess[ktrace].copy()
                nss[0]=Nss[ktrace].copy()
                zss[0]=Zss[ktrace].copy()
                eds[0]=Eds[ktrace].copy()
                nds[0]=Nds[ktrace].copy()
                zds[0]=Zds[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ess=tshift(ess,tdelay[kfault])
                nss=tshift(nss,tdelay[kfault])
                zss=tshift(zss,tdelay[kfault])
                eds=tshift(eds,tdelay[kfault])
                nds=tshift(nds,tdelay[kfault])
                zds=tshift(zds,tdelay[kfault])
                #Now time align stuff                                
                ess=resample_to_data(ess[0],Edata[ksta])
                ess=prep_synth(ess,Edata[ksta])
                nss=resample_to_data(nss[0],Ndata[ksta])
                nss=prep_synth(nss,Ndata[ksta])
                zss=resample_to_data(zss[0],Udata[ksta])
                zss=prep_synth(zss,Udata[ksta])
                eds=resample_to_data(eds[0],Edata[ksta])
                eds=prep_synth(eds,Edata[ksta])
                nds=resample_to_data(nds[0],Ndata[ksta])
                nds=prep_synth(nds,Ndata[ksta])
                zds=resample_to_data(zds[0],Udata[ksta])
                zds=prep_synth(zds,Udata[ksta])
                #Insert into Gtemp then append to G
                if kfault==0 and ksta==0: #It's the first subfault and station, initalize G
github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
#Finished reading, filtering, etc now time shift by rupture time and resmaple to data
        ktrace=0
        print("Aligning GFs and resampling to data times...")
        for ksta in range(Nsta):
            #Loop over subfaults
            print('...Working on station #'+str(ksta+1)+' of '+str(Nsta))
            for kfault in range(Nfaults):
                #Assign current GFs
                ss=Stream(Trace())
                ds=Stream(Trace())
                ss[0]=SS[ktrace].copy()
                ds[0]=DS[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ss=tshift(ss,tdelay[kfault])
                ds=tshift(ds,tdelay[kfault])
                #Now time align stuff                                
                #ss=resample_synth_tsun(ss[0],Data[ksta])
                ss=prep_synth(ss[0],Data[ksta])
                #ds=resample_synth_tsun(ds[0],Data[ksta])
                ds=prep_synth(ds[0],Data[ksta])
                #Insert into Gtemp then append to G
                if kfault==0 and ksta==0: #It's the first subfault and station, initalize G
                    G=gdims_tsun(datafiles,Nfaults,decimate) #Survey all stations to decide size of G
                if kfault==0: #Initalize Gtemp (different size for each station)
                    #How many points left in the tiem series
                    npts=Data[ksta].stats.npts
                    print("... ... "+str(npts)+" data points left over")
                    Gtemp=zeros([npts,Nfaults*2])      
                #Insert synthetics into Gtempview
                Gtemp[0:npts,2*kfault]=ss.data
                Gtemp[0:npts,2*kfault+1]=ds.data
github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
ess=Stream(Trace())
                nss=Stream(Trace())
                zss=Stream(Trace())
                eds=Stream(Trace())
                nds=Stream(Trace())
                zds=Stream(Trace())
                ess[0]=Ess[ktrace].copy()
                nss[0]=Nss[ktrace].copy()
                zss[0]=Zss[ktrace].copy()
                eds[0]=Eds[ktrace].copy()
                nds[0]=Nds[ktrace].copy()
                zds[0]=Zds[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ess=tshift(ess,tdelay[kfault])
                nss=tshift(nss,tdelay[kfault])
                zss=tshift(zss,tdelay[kfault])
                eds=tshift(eds,tdelay[kfault])
                nds=tshift(nds,tdelay[kfault])
                zds=tshift(zds,tdelay[kfault])
                #Now time align stuff                                
                ess=resample_to_data(ess[0],Edata[ksta])
                ess=prep_synth(ess,Edata[ksta])
                nss=resample_to_data(nss[0],Ndata[ksta])
                nss=prep_synth(nss,Ndata[ksta])
                zss=resample_to_data(zss[0],Udata[ksta])
                zss=prep_synth(zss,Udata[ksta])
                eds=resample_to_data(eds[0],Edata[ksta])
                eds=prep_synth(eds,Edata[ksta])
                nds=resample_to_data(nds[0],Ndata[ksta])
                nds=prep_synth(nds,Ndata[ksta])
                zds=resample_to_data(zds[0],Udata[ksta])
github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
zss=Stream(Trace())
                eds=Stream(Trace())
                nds=Stream(Trace())
                zds=Stream(Trace())
                ess[0]=Ess[ktrace].copy()
                nss[0]=Nss[ktrace].copy()
                zss[0]=Zss[ktrace].copy()
                eds[0]=Eds[ktrace].copy()
                nds[0]=Nds[ktrace].copy()
                zds[0]=Zds[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ess=tshift(ess,tdelay[kfault])
                nss=tshift(nss,tdelay[kfault])
                zss=tshift(zss,tdelay[kfault])
                eds=tshift(eds,tdelay[kfault])
                nds=tshift(nds,tdelay[kfault])
                zds=tshift(zds,tdelay[kfault])
                #Now time align stuff                                
                ess=resample_to_data(ess[0],Edata[ksta])
                ess=prep_synth(ess,Edata[ksta])
                nss=resample_to_data(nss[0],Ndata[ksta])
                nss=prep_synth(nss,Ndata[ksta])
                zss=resample_to_data(zss[0],Udata[ksta])
                zss=prep_synth(zss,Udata[ksta])
                eds=resample_to_data(eds[0],Edata[ksta])
                eds=prep_synth(eds,Edata[ksta])
                nds=resample_to_data(nds[0],Ndata[ksta])
                nds=prep_synth(nds,Ndata[ksta])
                zds=resample_to_data(zds[0],Udata[ksta])
                zds=prep_synth(zds,Udata[ksta])
                #Insert into Gtemp then append to G
github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
nss=Stream(Trace())
                zss=Stream(Trace())
                eds=Stream(Trace())
                nds=Stream(Trace())
                zds=Stream(Trace())
                ess[0]=Ess[ktrace].copy()
                nss[0]=Nss[ktrace].copy()
                zss[0]=Zss[ktrace].copy()
                eds[0]=Eds[ktrace].copy()
                nds[0]=Nds[ktrace].copy()
                zds[0]=Zds[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ess=tshift(ess,tdelay[kfault])
                nss=tshift(nss,tdelay[kfault])
                zss=tshift(zss,tdelay[kfault])
                eds=tshift(eds,tdelay[kfault])
                nds=tshift(nds,tdelay[kfault])
                zds=tshift(zds,tdelay[kfault])
                #Now time align stuff                                
                ess=resample_to_data(ess[0],Edata[ksta])
                ess=prep_synth(ess,Edata[ksta])
                nss=resample_to_data(nss[0],Ndata[ksta])
                nss=prep_synth(nss,Ndata[ksta])
                zss=resample_to_data(zss[0],Udata[ksta])
                zss=prep_synth(zss,Udata[ksta])
                eds=resample_to_data(eds[0],Edata[ksta])
                eds=prep_synth(eds,Edata[ksta])
                nds=resample_to_data(nds[0],Ndata[ksta])
                nds=prep_synth(nds,Ndata[ksta])
                zds=resample_to_data(zds[0],Udata[ksta])
                zds=prep_synth(zds,Udata[ksta])
github dmelgarm / MudPy / src / python / mudpy / inverse.py View on Github external
#Assign current GFs
                ess=Stream(Trace())
                nss=Stream(Trace())
                zss=Stream(Trace())
                eds=Stream(Trace())
                nds=Stream(Trace())
                zds=Stream(Trace())
                ess[0]=Ess[ktrace].copy()
                nss[0]=Nss[ktrace].copy()
                zss[0]=Zss[ktrace].copy()
                eds[0]=Eds[ktrace].copy()
                nds[0]=Nds[ktrace].copy()
                zds[0]=Zds[ktrace].copy()
                #Time shift them according to subfault rupture time, zero pad, round to dt interval,decimate
                #and extend to maximum time
                ess=tshift(ess,tdelay[kfault])
                nss=tshift(nss,tdelay[kfault])
                zss=tshift(zss,tdelay[kfault])
                eds=tshift(eds,tdelay[kfault])
                nds=tshift(nds,tdelay[kfault])
                zds=tshift(zds,tdelay[kfault])
                #Now time align stuff                                
                ess=resample_to_data(ess[0],Edata[ksta])
                ess=prep_synth(ess,Edata[ksta])
                nss=resample_to_data(nss[0],Ndata[ksta])
                nss=prep_synth(nss,Ndata[ksta])
                zss=resample_to_data(zss[0],Udata[ksta])
                zss=prep_synth(zss,Udata[ksta])
                eds=resample_to_data(eds[0],Edata[ksta])
                eds=prep_synth(eds,Edata[ksta])
                nds=resample_to_data(nds[0],Ndata[ksta])
                nds=prep_synth(nds,Ndata[ksta])