Example #1
0
	def getBAzim(self):
		""" Get back azimuth as ybases for waveforms. """
		bazims = [ sacdh.baz for sacdh in self.saclist ]
		self.ybases = bazims
		mm = min(bazims), max(bazims)
		self.yzoom = axLimit(mm, 0.1)
		if self.opts.stack_on:
			self.stackbase = (mm[1]+self.yzoom[1])/2
			self.yzoom[1] += (self.yzoom[1]-mm[1])/2
Example #2
0
 def getBAzim(self):
     """ Get back azimuth as ybases for waveforms. """
     bazims = [sacdh.baz for sacdh in self.saclist]
     self.ybases = bazims
     mm = min(bazims), max(bazims)
     self.yzoom = axLimit(mm, 0.1)
     if self.opts.stack_on:
         self.stackbase = (mm[1] + self.yzoom[1]) / 2
         self.yzoom[1] += (self.yzoom[1] - mm[1]) / 2
Example #3
0
	def getDist(self, degree=True):
		""" Get epicentral distances in degree/km as ybases for waveforms. """
		if degree:
			dists = [ sacdh.gcarc for sacdh in self.saclist ]
		else:
			dists = [ sacdh.dist  for sacdh in self.saclist ]
		self.ybases = dists
		mm = min(dists), max(dists)
		self.yzoom = axLimit(mm, 0.1)
		if self.opts.stack_on:
			self.stackbase = (mm[1]+self.yzoom[1])/2
			self.yzoom[1] += (self.yzoom[1]-mm[1])/2
Example #4
0
 def getDist(self, degree=True):
     """ Get epicentral distances in degree/km as ybases for waveforms. """
     if degree:
         dists = [sacdh.gcarc for sacdh in self.saclist]
     else:
         dists = [sacdh.dist for sacdh in self.saclist]
     self.ybases = dists
     mm = min(dists), max(dists)
     self.yzoom = axLimit(mm, 0.1)
     if self.opts.stack_on:
         self.stackbase = (mm[1] + self.yzoom[1]) / 2
         self.yzoom[1] += (self.yzoom[1] - mm[1]) / 2
Example #5
0
	def getXLimit(self):
		""" Get x limit (relative to reference time) """
		sss = self.sss
		b = [ ss.time[0]  - ss.sacdh.reftime for ss in sss ]
		e = [ ss.time[-1] - ss.sacdh.reftime for ss in sss ]
		self.bmin = min(b) 
		self.bmax = max(b)
		self.emin = min(e) 
		self.emax = max(e)
		mm = self.bmin, self.emax
		xxlim = axLimit(mm)
		self.xzoom = [xxlim,]
Example #6
0
	def getXLimit(self):
		""" Get x limit (relative to reference time) """
		pps = self.pps
		b = [ pp.time[0]  - pp.sacdh.reftime for pp in pps ]
		e = [ pp.time[-1] - pp.sacdh.reftime for pp in pps ]
		npts = [ len(pp.time) for pp in pps ]
		self.bmin = min(b) 
		self.bmax = max(b)
		self.emin = min(e) 
		self.emax = max(e)
		mm = self.bmin, self.emax
		xxlim = axLimit(mm)
		self.xzoom = [xxlim,]
Example #7
0
	def getXLimit(self):
		""" Get x limit (relative to reference time) """
		pps = self.pps
		b = [ pp.time[0]  - pp.sacdh.reftime for pp in pps ]
		e = [ pp.time[-1] - pp.sacdh.reftime for pp in pps ]
		#npts = [ len(pp.time) for pp in pps ]
		self.bmin = min(b) 
		self.bmax = max(b)
		self.emin = min(e) 
		self.emax = max(e)
		mm = self.bmin, self.emax
		xxlim = axLimit(mm)
		self.xzoom = [xxlim,]
Example #8
0
    def plotStack(self):
        """ 
		Calculate mean stack from all traces and plot it. 
		No taper window is added in.
		"""
        saclist = self.saclist
        mm = self.bmax, self.emin
        twplot = axLimit(mm, -0.01)
        twp = twplot[1] - twplot[0]
        taperwindow = 0
        reftimes = [sacdh.reftime for sacdh in saclist]
        nstart, ntotal = windowIndex(saclist, reftimes, twplot, taperwindow)
        datacut = windowData(saclist, nstart, ntotal, taperwindow / twp)
        datamean = mean(datacut, 0)
        # copy a sacdh object for stack
        stackdh = copy.copy(saclist[0])
        stackdh.b = twplot[0] - taperwindow * 0.5
        stackdh.npts = len(datamean)
        stackdh.data = datamean
        stackdh.thdrs = [
            0.,
        ] * 10
        stackdh.filename = 'meanstack.sac'
        self.sstack = SingleSeis(stackdh, self.opts, self.axss, self.stackbase,
                                 self.stackcolor, self.stacklinew)
        # plot 1-std range from mean stack
        if self.opts.zero_on and self.opts.std_on:
            datastd = std(datacut, 0)
            stda = copy.copy(stackdh)
            stdb = copy.copy(stackdh)
            stda.data = datamean + datastd
            stdb.data = datamean - datastd
            stda.thdrs = [
                0,
            ] * 10
            stdb.thdrs = [
                0,
            ] * 10
            stda.filename = 'stackstdplus.sac'
            stda.filename = 'stackstdnega.sac'
            self.sstda = SingleSeis(stda, self.opts, self.axss, self.stackbase,
                                    self.stackcolor, self.stacklinew / 2.)
            self.sstdb = SingleSeis(stdb, self.opts, self.axss, self.stackbase,
                                    self.stackcolor, self.stacklinew / 2.)
            self.stdfill = self.axss.fill_between(self.sstack.time,
                                                  stda.data,
                                                  stdb.data,
                                                  color=self.stackcolor,
                                                  alpha=.25)
Example #9
0
	def plotStack(self):
		""" 
		Calculate mean stack from all traces and plot it. 
		No taper window is added in.
		"""
		saclist = self.saclist
		mm = self.bmax, self.emin
		twplot = axLimit(mm, -0.01)
		twp = twplot[1] - twplot[0]
		taperwindow = 0
		reftimes = [ sacdh.reftime for sacdh in saclist ]
		nstart, ntotal = windowIndex(saclist, reftimes, twplot, taperwindow)
		datacut = windowData(saclist, nstart, ntotal, taperwindow/twp)
		datamean = mean(datacut, 0)
		# copy a sacdh object for stack
		stackdh = copy.copy(saclist[0])
		stackdh.b = twplot[0] - taperwindow*0.5
		stackdh.npts = len(datamean)
		stackdh.data = datamean
		stackdh.thdrs = [0.,]*10
		stackdh.filename = 'meanstack.sac'
		self.sstack = SingleSeis(stackdh, self.opts, self.axss, self.stackbase, self.stackcolor, self.stacklinew)
		# plot 1-std range from mean stack
		if self.opts.zero_on and self.opts.std_on:
			datastd = std(datacut, 0)
			stda = copy.copy(stackdh)
			stdb = copy.copy(stackdh)
			stda.data = datamean + datastd
			stdb.data = datamean - datastd
			stda.thdrs = [0,]*10
			stdb.thdrs = [0,]*10
			stda.filename = 'stackstdplus.sac'
			stda.filename = 'stackstdnega.sac'
			self.sstda = SingleSeis(stda, self.opts, self.axss, self.stackbase, self.stackcolor, self.stacklinew/2.)
			self.sstdb = SingleSeis(stdb, self.opts, self.axss, self.stackbase, self.stackcolor, self.stacklinew/2.)
			self.stdfill = self.axss.fill_between(self.sstack.time, stda.data, stdb.data, color=self.stackcolor, alpha=.25)
Example #10
0
	def getZero(self):
		""" Get zeros as ybases for waveforms. """
		self.ybases = zeros(self.nseis)
		mm = self.dmin, self.dmax
		self.yzoom = axLimit(mm)
Example #11
0
 def getZero(self):
     """ Get zeros as ybases for waveforms. """
     self.ybases = zeros(self.nseis)
     mm = self.dmin, self.dmax
     self.yzoom = axLimit(mm)