def stackCoords(self, newlength): """ Recalculate the trace coordinates when stacking 'n' times. """ from processgpr.util.congrid import congrid self.x = congrid(self.x, (newlength,)) self.y = congrid(self.y, (newlength,)) self.elev = congrid(self.elev, (newlength,), method="spline") self.traceNo = np.arange(newlength) self._getDistance()
def get_phasecenter(self, amp_threshold=1.0, freq_range=[500, 3000], stacked=1, save=False, view=False): ''' Calculates the phase center along the profile. The phase center is -delta_phi/(2 delta_k) delta_k = delta_f * c0 / (2pi) The factor 2 in front of delta_k is due to the measuring geometry - the wave travels the distance twice ''' self.info("Calculating the phase center for each trace ...") self.phasecenter = np.zeros((self.traces,)) for n in range(self.traces): trace = TRACE(self.data[:, n], self.deltaT, Nfft=2 ** 15) trace.get_phasecenter(amp_threshold, freq_range, self.cmed) self.phasecenter[n] = trace.zphi if self.hascoords: scoords = self.coords if stacked > 1: from processgpr.util.congrid import congrid newlength = int(self.phasecenter.shape[0] / stacked) self.phasecenter = congrid(self.phasecenter, (newlength,)) scoords = self.coords scoords.stackCoords(newlength) if save: if self.hascoords: np.savez('zphi_coords_' + self.filename, zphi=self.phasecenter, x=scoords.x, y=scoords.y, z=scoords.elev) else: np.savez('zphi_' + self.filename, zphi=self.phasecenter) if view: from pylab import show, plot plot(self.phasecenter) show() self.done()