Exemplo n.º 1
0
    def depth2time(self, trace, point, dz, dt):
        """
        Converts a data array in the depth domain to the time
        domain.

        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. Kept for consistency with other
                velocity methods.
            dz (float): The sample interval of the input data.
            dt (float): The sample interval of the converted
                        data.
        """
        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_z = np.arange(velocity.size) * 1.0 / samp
        z = np.arange(seismic.size) * dz
        velocity = np.interp(z, vel_z, velocity, velocity[0], velocity[-1])
        t = np.arange(self.range[0], self.range[1], dt)
        data = depth_to_time(seismic, velocity, z, t, mode="cubic")
        return data
Exemplo n.º 2
0
    def depth2time(self, trace, point, dz, dt):
        """
        Converts a data array in the depth domain to the time
        domain.

        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. Kept for consistency with other
                velocity methods.
            dz (float): The sample interval of the input data.
            dt (float): The sample interval of the converted
                        data.
        """
        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_z = np.arange(velocity.size) * 1.0 / samp
        z = np.arange(seismic.size)*dz
        velocity = np.interp(z, vel_z, velocity, velocity[0], velocity[-1])
        t = np.arange(self.range[0], self.range[1], dt)
        data = depth_to_time(seismic, velocity, z, t, mode="cubic")
        return data
Exemplo n.º 3
0
    def depth2time(self, dt, samples=None):

        if self.units == 'time':
            raise ValueError
        
        vp_data = self.vp_data(samples=samples)
        
        data = self.get_data(samples=samples)

        

        indices = \
          np.array([np.arange(vp_data.shape[0]) for \
                    i in range(vp_data.shape[1])]).transpose()

        
                            
        dz = self.depth / data.shape[0]

        time_index = depth_to_time(indices, vp_data,
                                   dz, dt).astype(int)

        self.image = \
          np.asarray([data[time_index[:,i],i,:] for \
                     i in range(data.shape[1])]).transpose(1,0,2)
Exemplo n.º 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()
Exemplo n.º 5
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()
Exemplo n.º 6
0
    def depth2time(self, data, point, dz, dt):
        """
        Converts a data array in the depth domain to the time
        domain.

        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. Kept for consistency with other
                velocity methods.
            dz (float): The sample interval of the input data.
            dt (float): The sample interval of the converted
                        data.
        """
        velocity = self.velocity
        return depth_to_time(data, np.ones(data.size) * velocity, dz, dt)
Exemplo n.º 7
0
    def depth2time(self, data, point, dz, dt):
        """
        Converts a data array in the depth domain to the time
        domain.

        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. Kept for consistency with other
                velocity methods.
            dz (float): The sample interval of the input data.
            dt (float): The sample interval of the converted
                        data.
        """
        velocity = self.velocity
        return depth_to_time(data, np.ones(data.size)*velocity, dz, dt)
Exemplo n.º 8
0
    def test_depthtotime(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:, :] += 3000.0

        dt = 0.001
        dz = 1.0

        face_change = np.floor(((49 * dz) / 1500.0) / dt)

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

        self.assertTrue((output[face_change + 1, 50] -
                         output[face_change, 50]) == 100)
Exemplo n.º 9
0
    def test_depthtotime( 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:,:] += 3000.0
        
        dt = 0.001
        dz = 1.0
 
        face_change = np.floor( ( ( 49* dz ) / 1500.0 ) /
                                dt )

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

        self.assertTrue( ( output[face_change+1,50] -
                           output[ face_change, 50 ] ) ==100 )