Example #1
0
    def time2depth(self, dz):
        
        if self.units == 'depth':
            raise ValueError

        vp_data = self.vp_data()
        dt = self.depth / vp_data[0]

        # This could be sped up if need be
        data = np.asarray([time_to_depth(self.get_data(), vp_data,
                                         dt, dz)
                           for i in range(data.shape[-1])])
Example #2
0
    def time2depth(self, data, point, dt, dz):
        """
        Converts a data array from time to depth

        Args:
            data (array, 1d): A 1D numpy array.
            point (float):  distance along transect corresponding to
            the trace location. Not actually used, as this model
            assumes a constant velocity

            dt (float): The sample interval of the input data.
            dz (float): The sample interval of the depth converted
                        data.
        """
        velocity = self.velocity
        return time_to_depth(data, np.ones(data.size) * velocity, dt, dz)
Example #3
0
    def time2depth(self, data, point, dt, dz):
        """
        Converts a data array from time to depth

        Args:
            data (array, 1d): A 1D numpy array.
            point (float):  distance along transect corresponding to
            the trace location. Not actually used, as this model
            assumes a constant velocity

            dt (float): The sample interval of the input data.
            dz (float): The sample interval of the depth converted
                        data.
        """
        velocity = self.velocity
        return time_to_depth(data, np.ones(data.size)*velocity, dt, dz)
Example #4
0
    def test_recip(self):

        data = np.zeros((100, 100))
        vmodel = np.zeros((100, 100))

        data[0:50, :] += 100.0
        data[50:, :] += 200.0

        vmodel[0:50, :] += 1500.0
        vmodel[50:, :] += 1800.0

        dt = 0.001
        dz = 1.

        out1 = depth_to_time(data, vmodel, dz, dt)
        v2 = depth_to_time(vmodel, vmodel, dz, dt)
        out2 = time_to_depth(out1, v2, dt, dz)
        """plt.figure()
Example #5
0
    def test_timetodepth(self):

        data = np.zeros((100, 100))
        vmodel = np.zeros((100, 100))

        data[0:50, :] += 100.0
        data[50:, :] += 200.0

        vmodel[0:50, :] += 1500.0
        vmodel[50:, :] += 5000.0

        dt = 0.001
        dz = 1.0

        output = time_to_depth(data, vmodel, dt, dz)

        face_change = np.floor(((49 * dt) * 1500.0) / dz)
        self.assertTrue((output[face_change + 1, 50] -
                         output[face_change, 50]) == 100)
Example #6
0
    def test_recip(self):

        data = np.zeros( (100,100) )
        vmodel = np.zeros( (100,100) )

        data[0:50,:] += 100.0
        data[50:,:] += 200.0

        vmodel[0:50,:] += 1500.0
        vmodel[50:,:] += 1800.0

        dt = 0.001
        dz = 1.
        
        out1 = depth_to_time( data, vmodel, dz, dt )
        v2 = depth_to_time( vmodel, vmodel, dz, dt )
        out2 = time_to_depth( out1, v2, dt,dz )

        """plt.figure()
Example #7
0
    def test_timetodepth( self ):
        
        data = np.zeros( (100,100) )
        vmodel = np.zeros( (100,100) )

        data[0:50,:] += 100.0
        data[50:,:] += 200.0

        vmodel[0:50,:] += 1500.0
        vmodel[50:,:] += 5000.0
        
        dt = 0.001
        dz = 1.0

  
        output = time_to_depth( data, vmodel,dt, dz )

        face_change = np.floor( ( ( 49* dt ) * 1500.0 ) /
                                dz )
        self.assertTrue( ( output[face_change+1,50] -
                           output[ face_change, 50 ] ) == 100 )
Example #8
0
    def time2depth(self, trace, point, dt, dz):
        """
        Converts a seismic trace from time to depth.

        Args:
            trace (array, 1d): A 1D numpy array.
            point (float):  distance along transect corresponding to
                the trace location.
        """
        distance = [(p - point)**2.0 for p in self.coords]
        idx = np.argmin(distance)
        profile = self.data[idx]
        seismic = np.array(trace)

        # HACK TO MAKE FAKE VELOCITIES
        velocity = np.ones(profile.data.size) * 2000.0

        samp = profile.stats["sampling_rate"]
        vel_t = np.arange(velocity.size) * 1.0 / samp
        t = np.arange(seismic.size) * dt
        velocity = np.interp(t, vel_t, velocity, velocity[0], velocity[-1])
        z = np.arange(self.range[0], self.range[1], dz)
        data = time_to_depth(seismic, velocity, t, z, mode="cubic")
        return data
Example #9
0
    def time2depth(self, trace, point, dt, dz):
        """
        Converts a seismic trace from time to depth.

        Args:
            trace (array, 1d): A 1D numpy array.
            point (float):  distance along transect corresponding to
                the trace location.
        """
        distance = [(p - point)**2.0 for p in self.coords]
        idx = np.argmin(distance)
        profile = self.data[idx]
        seismic = np.array(trace)

        # HACK TO MAKE FAKE VELOCITIES
        velocity = np.ones(profile.data.size) * 2000.0

        samp = profile.stats["sampling_rate"]
        vel_t = np.arange(velocity.size) * 1.0 / samp
        t = np.arange(seismic.size)*dt
        velocity = np.interp(t, vel_t, velocity, velocity[0], velocity[-1])
        z = np.arange(self.range[0], self.range[1], dz)
        data = time_to_depth(seismic, velocity, t, z, mode="cubic")
        return data