Example #1
0
 def compute_rftheo(self, dtype='r', slowness=0.06, din=None):
     """
     compute receiver function of isotropic model using theo
     ===========================================================================================
     ::: input :::
     dtype   - data type (radial or trnasverse)
     slowness- reference horizontal slowness (default - 0.06 s/km, 1./0.06=16.6667)
     din     - incident angle in degree (default - None, din will be computed from slowness)
     ===========================================================================================
     """
     dtype = dtype.lower()
     if dtype == 'r' or dtype == 'radial':
         # initialize input model arrays
         hin = np.zeros(100, dtype=np.float32)
         vsin = np.zeros(100, dtype=np.float32)
         vpvs = np.zeros(100, dtype=np.float32)
         qsin = 600. * np.ones(100, dtype=np.float32)
         qpin = 1400. * np.ones(100, dtype=np.float32)
         # assign model arrays to the input arrays
         if self.hArr.size < 100:
             nl = self.hArr.size
         else:
             nl = 100
         hin[:nl] = self.hArr
         vsin[:nl] = self.vsArr
         vpvs[:nl] = self.vpvsArr
         qsin[:nl] = self.qsArr
         qpin[:nl] = self.qpArr
         # fs/npts
         fs = self.fs
         # # # ntimes      = 1000
         ntimes = self.npts
         # incident angle
         if din is None:
             din = 180. * np.arcsin(
                 vsin[nl - 1] * vpvs[nl - 1] * slowness) / np.pi
         # solve for receiver function using theo
         rx = theo.theo(nl, vsin, hin, vpvs, qpin, qsin, fs, din, 2.5,
                        0.005, 0, ntimes)
         # store the predicted receiver function (ONLY radial component) to the data object
         self.indata.rfr.rfp = rx[:self.npts]
         self.indata.rfr.tp = np.arange(self.npts,
                                        dtype=np.float32) * 1. / self.fs
     # elif dtype=='t' or dtype == 'transverse':
     #
     else:
         raise ValueError('Unexpected receiver function type: ' + dtype)
     return
Example #2
0
 def compute_rftheo(self, slowness = 0.06, din=None, npts=None):
     """
     compute receiver function of isotropic model using theo
     =============================================================================================
     ::: input :::
     slowness- reference horizontal slowness (default - 0.06 s/km, 1./0.06=16.6667)
     din     - incident angle in degree      (default - None, din will be computed from slowness)
     =============================================================================================
     """
     if self.data.rfr.npts == 0:
         raise ValueError('npts of receiver function is 0!')
         return
     if self.model.isomod.mtype[0] == 5:
         raise ValueError('receiver function cannot be computed in water!')
     # initialize input model arrays
     hin         = np.zeros(100, dtype=np.float64)
     vsin        = np.zeros(100, dtype=np.float64)
     vpvs        = np.zeros(100, dtype=np.float64)
     qsin        = 600.*np.ones(100, dtype=np.float64)
     qpin        = 1400.*np.ones(100, dtype=np.float64)
     # assign model arrays to the input arrays
     if self.model.nlay<100:
         nl      = self.model.nlay
     else:
         nl      = 100
     hin[:nl]    = self.model.h[:nl]
     vsin[:nl]   = self.model.vsv[:nl]
     vpvs[:nl]   = self.model.vpv[:nl]/self.model.vsv[:nl]
     qsin[:nl]   = self.model.qs[:nl]
     qpin[:nl]   = self.model.qp[:nl]
     # fs/npts
     fs          = self.fs
     # # # ntimes      = 1000
     if npts is None:
         ntimes  = self.data.rfr.npts
     else:
         ntimes  = npts
     # incident angle
     if din is None:
         din     = 180.*np.arcsin(vsin[nl-1]*vpvs[nl-1]*slowness)/np.pi
     # solve for receiver function using theo
     rx 	        = theo.theo(nl, vsin, hin, vpvs, qpin, qsin, fs, din, 2.5, 0.005, 0, ntimes)
     # store the predicted receiver function (ONLY radial component) to the data object
     self.data.rfr.rfp   = rx[:self.data.rfr.npts]
     self.data.rfr.tp    = np.arange(self.data.rfr.npts, dtype=np.float64)*1./self.fs
     return
Example #3
0
import theo

tvs = np.zeros(100)
tvpvs = np.zeros(100)
tqs = np.zeros(100)
tqp = np.zeros(100)
trho = np.zeros(100)
tthick = np.zeros(100)

rx = theo.theo(newnlayer, tvs, tthick, tvpvs, tqp, tqs, rt, din, 2.5, 0.005, 0,
               nn)
Example #4
0
    def compute_rf(self):
        if (self.flag != 1):
            print "no layerd model updated!!!"
            self.update()
        if self.laym0.nlayer < 100:
            newnlayer = self.laym0.nlayer + 1  # add the last layers;
        else:
            newnlayer = 100

        tvs = np.zeros(100)
        tvpvs = np.zeros(100)
        tqs = np.zeros(100)
        tqp = np.zeros(100)
        trho = np.zeros(100)
        tthick = np.zeros(100)

        index = self.laym0.vs > 0
        tvs1 = self.laym0.vs[index]
        tvs[:tvs1.size] = tvs1
        nl = tvs1.size
        tvpvs1 = self.laym0.vpvs[index]
        tvpvs[:nl] = tvpvs1
        tqs1 = self.laym0.qs[index]
        tqs[:nl] = tqs1
        tqp1 = self.laym0.qp[index]
        tqp[:nl] = tqp1
        tthick1 = self.laym0.thick[index]
        tthick[:nl] = tthick1
        tvs[nl] = (tvs[nl - 1] - 0.)
        tvpvs[nl] = (tvpvs[nl - 1] - 0.)
        tqs[nl] = (tqs[nl - 1] - 0.)
        tqp[nl] = (tqp[nl - 1] - 0.)
        tthick[nl] = 0.
        nl += 1
        # #
        # # nl = 0
        # # for i in range (newnlayer-1):
        # # 	if (model1.laym0.vs[i] > 0.):
        # # 		tvs[nl] = model1.laym0.vs[i] - 0.
        # # 		tvpvs[nl] = model1.laym0.vpvs[i] - 0.
        # # 		tqs[nl] = model1.laym0.qs[i] - 0.
        # # 		tqp[nl] = model1.laym0.qp[i] - 0.
        # # 		tthick[nl] = model1.laym0.thick[nl] - 0.
        # # 		nl = nl + 1
        nn = 1000
        rx = np.zeros(nn)
        slow = 0.06
        din = 180. * math.asin(tvs[nl - 1] * tvpvs[nl - 1] * slow) / math.pi
        rt = self.data.rf.rt
        newnlayer = nl
        rx = theo.theo(newnlayer, tvs, tthick, tvpvs, tqp, tqs, rt, din, 2.5,
                       0.005, 0, nn)
        # # # newt = []
        # # # newrf = []
        # # # for i in range(nn):
        # # # 	tempt = i*1./model1.data.rf.rt
        # # # 	newt.append(tempt)
        # # # 	newrf.append(rx[i]-0.)
        self.data.rf.tn = np.arange(nn, dtype=float) / self.data.rf.rt
        self.data.rf.rfn = rx[:nn]
        return