def initialise(file, memmap=False, scan=False): #intialise empty parameter dictionary #kwargs stands for keyword arguments kwargs = {} #load file if memmap == True: ns = np.fromfile(file, dtype=toolbox.su_header_dtype, count=1)['ns'] sutype = toolbox.typeSU(ns) dataset = np.memmap(file, dtype=sutype) else: dataset = toolbox.read(file) #allocate stuff #~ ns = kwargs['ns'] = dataset['ns'][0] dt = kwargs['dt'] = dataset['dt'][0] / 1e6 #also add the time vector - it's useful later kwargs['times'] = np.arange(0, dt * ns, dt) dataset['trace'] /= np.amax(dataset['trace']) dataset['tracr'] = np.arange(dataset.size) kwargs['primary'] = 'cdp' kwargs['secondary'] = 'offset' kwargs['cdp'] = np.sort(np.unique(dataset['cdp'])) kwargs['step'] = 1 if scan: toolbox.scan(dataset) return dataset, kwargs
def initialise(file): #intialise empty parameter dictionary #kwargs stands for keyword arguments kwargs = {} #load file dataset = toolbox.read(file) #allocate stuff #~ ns = kwargs['ns'] = dataset['ns'][0] dt = kwargs['dt'] = dataset['dt'][0] / 1e6 #also add the time vector - it's useful later kwargs['times'] = np.arange(0, dt * ns, dt) dataset['trace'] /= np.amax(dataset['trace']) dataset['tracr'] = np.arange(dataset.size) kwargs['primary'] = 'cdp' kwargs['secondary'] = 'offset' kwargs['cdp'] = np.sort(np.unique(dataset['cdp'])) kwargs['step'] = 1 toolbox.scan(dataset) return dataset, kwargs
def initialise(file, memmap=False, scan=False): #intialise empty parameter dictionary #kwargs stands for keyword arguments kwargs = {} #load file if memmap == True: ns = np.fromfile(file, dtype=toolbox.su_header_dtype, count=1)['ns'] sutype = toolbox.typeSU(ns) dataset = np.memmap(file, dtype=sutype) else: dataset = toolbox.read(file) #allocate stuff #~ ns = kwargs['ns'] = dataset['ns'][0] dt = kwargs['dt'] = dataset['dt'][0]/1e6 #also add the time vector - it's useful later kwargs['times'] = np.arange(0, dt*ns, dt) dataset['trace'] /= np.amax(dataset['trace']) dataset['tracr'] = np.arange(dataset.size) kwargs['primary'] = 'cdp' kwargs['secondary'] = 'offset' kwargs['cdp'] = np.sort(np.unique(dataset['cdp'])) kwargs['step'] = 1 if scan: toolbox.scan(dataset) return dataset, kwargs
def initialise(file): #intialise empty parameter dictionary #kwargs stands for keyword arguments kwargs = {} #load file dataset = toolbox.read(file) #allocate stuff #~ ns = kwargs['ns'] = dataset['ns'][0] dt = kwargs['dt'] = dataset['dt'][0]/1e6 #also add the time vector - it's useful later kwargs['times'] = np.arange(0, dt*ns, dt) dataset['trace'] /= np.amax(dataset['trace']) dataset['tracr'] = np.arange(dataset.size) kwargs['primary'] = 'cdp' kwargs['secondary'] = 'offset' kwargs['cdp'] = np.sort(np.unique(dataset['cdp'])) kwargs['step'] = 1 toolbox.scan(dataset) return dataset, kwargs
def initialise(file): #intialise empty parameter dictionary #kwargs stands for keyword arguments kwargs = {} #load file dataset = toolbox.read(file) #allocate stuff ns = kwargs['ns'] = dataset['ns'][0] dt = kwargs['dt'] = dataset['dt'][0]/1e6 #also add the time vector - it's useful later kwargs['times'] = np.linspace(dt, ns*dt, ns*dt*1000) dataset['trace'] /= np.amax(dataset['trace']) kwargs['primary'] = 'sx' kwargs['secondary'] = 'gx' kwargs['step'] = 1 toolbox.scan(dataset) return dataset, kwargs
@_2d def scale(dataset): dataset['trace'] /= np.amax(np.abs(dataset['trace'])) if __name__ == "__main__": file = "/home/sfletcher/Downloads/2d_land_data/2D_Land_data_2ms/Line_001.su" data = toolbox.read(file) data = data[data['tracf'] > 0] toolbox.scan(data) ffids = np.unique(data['fldr']) parms = {} parms['dt'] = data['dt'][0] for shot in ffids: panel = data[data['fldr'] == shot] #print shot parms["primary"] = 'fldr' parms["step"] = 1 parms["window"] = 1000
dataset, params = initialise('cleaned.su') # we are going to pull out 1 cdp for testing with. #firstly, use the scroll tool to view the cdps, and #then pick one near the middle of the volume 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()
#intialise dataset and parameter dictionary dataset, params = initialise('cleaned.su') # we are going to pull out 1 cdp for testing with. #firstly, use the scroll tool to view the cdps, and #then pick one near the middle of the volume 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()