예제 #1
0
displays multiple stacks
'''
import toolbox
import pylab
import numpy as np

filelist = ["1st_vels_stack.su", 
#"1st_vels_stack_elev.su", 
"fk_stack.su", 
#"model.su", 
"model_filtered.su", 
#"trim_stack.su",
"trim_stack2.su",
]

dataset, params = toolbox.initialise(filelist[0])
dataset['fldr'] = 0
for index, file in enumerate(filelist[1:]):
	data, junk = toolbox.initialise(file)
	data['fldr'] = index + 1
	dataset = np.column_stack([dataset, data])

params['window'] = 1000
toolbox.agc(dataset, None, **params)
params['primary'] = 'fldr'
params['secondary'] = 'cdp'
params['clip'] = 0.02
toolbox.display(dataset, **params)
pylab.show()
	
예제 #2
0
@io
def add_noise(dataset, **kwargs):
    noise = np.random.normal(0.0, 1e-8, size=(dataset.shape))
    dataset += noise
    return dataset


@io
def convolve_wavelet(dataset, **kwargs):
    wavelet = toolbox.ricker(60)
    dataset = toolbox.conv(dataset, wavelet)
    return dataset


if __name__ == '__main__':
    #initialise
    workspace, params = initialise()

    #build record
    build_combined(workspace, None, **params)

    #add wavelet
    workspace = convolve_wavelet(workspace, None, **params)

    #add noise
    workspace = add_noise(workspace, None, **params)

    #display
    toolbox.agc(workspace, None, **params)
    toolbox.display(workspace, None, **params)
예제 #3
0
        parameters['offset'] = parameters['gx'] - parameters['sx']
        parameters['aoffsets'] = np.abs(parameters['offset'])
        
        #return workspace and parameters
        return workspace, parameters
        
if __name__ == '__main__':
        #initialise
        workspace, params = initialise()
        #check dictionary contents
        print params['model'].keys()
        #have a look at it - it has a build in display routine
        params['model'].display()
        #add spikes
        spike(workspace, None, **params)
        #display
        toolbox.display(workspace, None, **params)


                


                
                
        
        
        

        
        
        
예제 #4
0
        
        print dataset['cdp']
        params['primary'] = 'cdp'
        params['secondary'] = 'offset'
        params['step'] = 20	
        #~ toolbox.display(dataset, None, **params)
        #we then want to extract that single cdp
        #for testing with later. we can do that 
        #the following way
        cdp500 = dataset[dataset['cdp'] == 500]
        toolbox.scan(cdp500)
        #view it
        #~ toolbox.display(cdp500, None, **params)
        #we have the right cdp = but the traces are in the wrong 
        #order. lets sort by offset
        
        cdp500 = np.sort(cdp500, order=['cdp', 'offset'])
                
        #output it for later
        toolbox.cp(cdp500, 'cdp500.su', None)       
        params['clip'] = 6e-4

        toolbox.display(cdp500, None, **params)
        pylab.show()
        
        
        
        
        
        
예제 #5
0
    tar(workspace, None, **params)

    #apply LMO
    #~ print "applying lmo"
    #~ params['lmo'] =1000.0
    #~ lmo(workspace, None, **params)
    #~ workspace['trace'][:,:30] *= 0
    #~ workspace['trace'][:,1850:] *= 0
    #~ params['lmo'] = -1000.0
    #~ lmo(workspace, None, **params)

    #apply our NMO
    print "applying nmo"
    params['smute'] = 30
    v = [3000]
    t = [0.5]
    params['vels'] = toolbox.build_vels(t, v, ns=params['ns'])
    nmo(workspace, None, **params)

    #~ #apply AGC
    toolbox.agc(workspace, None, **params)
    #~ #stack
    print "stacking"
    stack(workspace, 'stack1.su', **params)

    #view
    params['primary'] = None
    toolbox.display('stack1.su', None, **params)

    pylab.show()
예제 #6
0
        #~ lmo(workspace, None, **params)
        #~ workspace['trace'][:,:30] *= 0
        #~ workspace['trace'][:,1850:] *= 0
        #~ params['lmo'] = -1000.0
        #~ lmo(workspace, None, **params)
        
        #apply our NMO
        print "applying nmo"
        params['smute'] = 30
        v = [3000]
        t = [0.5]
        params['vels'] = toolbox.build_vels(t, v, ns=params['ns'])
        nmo(workspace, None, **params)
        
        #~ #apply AGC
        toolbox.agc(workspace, None, **params)
        #~ #stack
        print "stacking"
        stack(workspace, 'stack1.su', **params)
        
        #view
        params['primary'] = None
        toolbox.display('stack1.su', None, **params)
        
        pylab.show()
        
        

        
        
예제 #7
0
        #apply tar
        params['gamma'] = 5
        toolbox.tar(workspace, None, **params)

      
        #copy vels from previous exercise
        vels = {}
        vels[225] =  (0.06, 1537.38) , (0.28, 2876.21) , (0.87, 4608.10)
        vels[270] =  (0.05, 1525.09) , (0.18, 2483.16) , (0.36, 3171.00) , (0.66, 4079.93) , (0.98, 4816.90)
        vels[315] =  (0.04, 1365.42) , (0.14, 2728.82) , (0.22, 3134.15) , (0.57, 4116.78) , (0.74, 4571.25) , (0.97, 5013.43)
        vels[360] =  (0.04, 1697.05) , (0.10, 2520.01) , (0.21, 2937.62) , (0.43, 3244.70) , (0.64, 3981.67) , (0.98, 4239.61)
        vels[405] =  (0.06, 1439.11) , (0.27, 2753.38) , (0.49, 3957.10) , (0.97, 5381.92)
        vels[450] =  (0.06, 1340.85) , (0.41, 2741.10) , (0.52, 3625.47) , (0.02, 1144.32) , (0.29, 3060.45) , (0.54, 3711.45) , (0.97, 4313.31)
        vels[495] =  (0.04, 1611.07) , (0.11, 3072.74) , (0.23, 3318.39) , (0.35, 3772.86) , (0.48, 3981.67) , (0.94, 5099.41)
        vels[539] =  (0.04, 2028.69) , (0.11, 3072.74) , (0.32, 3883.41) , (0.51, 4485.27) , (0.96, 5222.24)
        vels[584] =  (0.06, 1623.36) , (0.20, 2495.44) , (0.32, 3121.87) , (0.95, 4411.57)
        
        #build vels
        vels = toolbox.build_vels(vels, **params)
        
        params['primary'] = None
        params['smute'] = 30
        
        params['vels'] = vels
        v100 = toolbox.co_nmo(workspace, None, **params)
        toolbox.agc(v100, None, **params)
        section100 = toolbox.stack(v100, None, **params)
        toolbox.cp(section100, 'stack100.su', None)
        toolbox.display(section100, None, **params)
        
        pylab.show()
예제 #8
0
import toolbox
import numpy as np
import pylab

#extract shot record
data, params = toolbox.initialise("prepro.su")
mask = data['fldr'] == 221
shot = data[mask].copy()

#agc
toolbox.agc(shot, None, **params)
params['primary'] = 'fldr'
params['secondary'] = 'tracf'
params['wiggle'] = True
toolbox.display(shot, **params)

#fk plot
params['dx'] = 33.5 #m
#~ toolbox.fk_view(shot,  **params)


#~ #fk filter design
params['fkVelocity'] = 2000
params['fkSmooth'] = 20
params['fkFilter'] = toolbox.fk_design(shot, **params) 
shot = toolbox.fk_filter(shot, None, **params)
toolbox.display(shot, **params)

##############end of testing
#~ data, nparams = toolbox.initialise("prepro.su")
예제 #9
0
    refract_amps[~np.isfinite(refract_amps)] = 0.01

    #it probably wont exceed 1s, but to make it look right we
    #need to limit it so that it doesnt cross over the direct
    directv = 330.0  #m/s
    direct_times = kwargs['aoffsets'] / directv
    limits = [refraction_times < direct_times]
    x = kwargs['gx'][limits]
    t = refraction_times[limits]
    refract_amps = refract_amps[limits]

    #convert coordinates to integers
    x = np.floor(x).astype(np.int)
    t *= 1000  # milliseconds
    t = np.floor(t).astype(np.int)

    #write values to array
    dataset[x, t] += refract_amps
    return dataset


if __name__ == '__main__':
    #initialise
    workspace, params = initialise()

    #build refractor
    build_refractor(workspace, None, **params)
    #display
    tmp = toolbox.agc(workspace, None, **params)
    toolbox.display(tmp, None, **params)
예제 #10
0
cdps = np.unique(data['cdp'])

#recreate original velocity field
#~ vels = {}
#~ vels[753]= (2456.0, 0.153), (2772.1, 0.413), (3003.2, 0.612), (3076.1, 0.704), (3270.7, 1.056), (3367.9, 1.668), (3538.2, 2.204), (3671.9, 3.566), (3915.1, 5.908), 
#~ vels[3056]=(2456.0, 0.153), (2772.1, 0.413), (3003.2, 0.612), (3076.1, 0.704), (3270.7, 1.056), (3367.9, 1.668), (3538.2, 2.204), (3671.9, 3.566), (3915.1, 5.908), 
#~ params['cdp'] = cdps
#~ params['vels'] = toolbox.build_vels(vels, **params)
#~ np.array(params['vels']).tofile('vels_initial.bin')


params['vels'] = np.fromfile('vels_initial.bin').reshape(-1, params['ns'])
#~ pylab.imshow(params['vels'].T, aspect='auto')
#~ pylab.colorbar()
#~ pylab.show()

#agc and stack
toolbox.agc(data, None, **params)
params['smute'] = 200
toolbox.nmo(data, None, **params)
stack = toolbox.stack(data, None, **params)
params['gamma'] = -1
toolbox.tar(stack, None, **params)
stack.tofile('field_stack.su')
#display
params['primary'] = None
params['secondary'] = 'cdp'
toolbox.display(stack, **params)
pylab.show()
def tar(data, **kwargs):
    #pull some values out of the
    #paramter dictionary
    gamma = kwargs['gamma']
    t = kwargs['times']

    #calculate the correction coeffieicnt

    #applyt the correction to the data

    return data


#-----------------------------------------------------------------------
#              main functions
#-----------------------------------------------------------------------

if __name__ == "__main__":
    #intialise dataset and parameter dictionary

    #set the value of gamma you want to test here
    params['gamma'] = 0

    #and apply
    tar(dataset, None, **params)

    #and display

    toolbox.display(dataset, None, **params)
    pylab.show()
예제 #12
0
        #build vels
        vels = toolbox.build_vels(vels, **params)
        
        params['primary'] = None
        params['highcut'] = 100
        params['lowcut'] = 30
        params['smute'] = 30
        
        
        
        params['vels'] = vels
        v100 = toolbox.co_nmo(workspace, None, **params)
        toolbox.agc(v100, None, **params)
        section100 = toolbox.stack(v100, None, **params)
        toolbox.bandpass(section100, None, **params)
        toolbox.display(section100, None, **params)
        

        params['vels'] = vels * .9
        v90 = toolbox.co_nmo(workspace, None, **params)
        toolbox.agc(v90, None, **params)
        section90 = toolbox.stack(v90, None, **params)
        toolbox.bandpass(section90, None, **params)
        toolbox.display(section90, None, **params)
        
        params['vels'] = vels *1.1
        v110 = toolbox.co_nmo(workspace, None, **params)
        toolbox.agc(v110, None, **params)
        section110 = toolbox.stack(v110, None, **params)
        toolbox.bandpass(section110, None, **params)
        toolbox.display(section110, None, **params)
예제 #13
0
data, params = toolbox.initialise('prepro.su')

cdps = np.unique(data['cdp'])

#recreate original velocity field
#~ vels = {}
#~ vels[753]= (2456.0, 0.153), (2772.1, 0.413), (3003.2, 0.612), (3076.1, 0.704), (3270.7, 1.056), (3367.9, 1.668), (3538.2, 2.204), (3671.9, 3.566), (3915.1, 5.908),
#~ vels[3056]=(2456.0, 0.153), (2772.1, 0.413), (3003.2, 0.612), (3076.1, 0.704), (3270.7, 1.056), (3367.9, 1.668), (3538.2, 2.204), (3671.9, 3.566), (3915.1, 5.908),
#~ params['cdp'] = cdps
#~ params['vels'] = toolbox.build_vels(vels, **params)
#~ np.array(params['vels']).tofile('vels_initial.bin')

params['vels'] = np.fromfile('vels_initial.bin').reshape(-1, params['ns'])
#~ pylab.imshow(params['vels'].T, aspect='auto')
#~ pylab.colorbar()
#~ pylab.show()

#agc and stack
toolbox.agc(data, None, **params)
params['smute'] = 200
toolbox.nmo(data, None, **params)
stack = toolbox.stack(data, None, **params)
params['gamma'] = -1
toolbox.tar(stack, None, **params)
stack.tofile('field_stack.su')
#display
params['primary'] = None
params['secondary'] = 'cdp'
toolbox.display(stack, **params)
pylab.show()
예제 #14
0
    sutype = np.result_type(dataset)
    result = np.zeros(cdps.size, dtype=sutype)
    for index, cdp in enumerate(cdps):
        gather = dataset[dataset['cdp'] == cdp]
        trace = _stack_gather(gather)
        result[index] = trace
    return result


if __name__ == '__main__':
    #initialise your test cdp first

    #first do the true amplitude recovery

    #set nmo parameters
    params['smute'] = 0
    params['vels'] = toolbox.build_vels([0.5], [1], ns=params['ns'])
    #then apply NMO

    #we will apply a pre-stack agc
    toolbox.agc(workspace, None, None)

    #stack it
    section = stack(workspace, None, **params)

    #display it
    #params['clip'] = 1e-5
    toolbox.display(section, None, **params)

    pylab.show()
예제 #15
0
import toolbox
import numpy as np
import pylab

#--------------------------------------------------
#       useful functions
#-------------------------------------------------

None

if __name__ == "__main__":
        #initialise dataset
        print "initialising dataset"
        workspace, params = toolbox.initialise('foybrook.su')
        
        #find our test CDP
        #~ print np.unique(workspace['cdp'])
        
        #extract it
        cdp = workspace[workspace['cdp'] == 396]
        
        #display it
        #~ toolbox.display(cdp, None, **params)
        
        params['gamma'] = 6
        toolbox.tar(cdp, None, **params)
        
        #display it
        toolbox.display(cdp, None, **params)
        pylab.show()