Esempio n. 1
0
def on_loadSegy_clicked(widget):
    '''
    This button callback function loads the SEGY file. AJ
    '''

    global Imagehbox, Section, Record, Nrecord, Fold,nt,ns,dt, Offset, dt_s, tmax_ms, hboxDisplay, coords
    global FileIn, SectionTauPi, SectionFilt, p0, nume

    FileIn = entryFileIn.get_text()       #SEGY file name
    Nrecord = 1901                             #Number of CDP-Gathers
    Record = int(entryRecord.get_text())
    Fold = int(entryFold.get_text())      #Fold of the CDP-Record
    nt=read_segy.ntraces(FileIn)               #Number of traces in SEGY file
    ns=read_segy.nsamp_segy(FileIn)            #Number of samples per trace
    dt=int(read_segy.dt_segy(FileIn))/1000     #Sample rate (ms)
    dt_s = dt/1000.0                           #Sample rate (s) heavily used


    Section=read_segy.read_segy_record(FileIn,Record,Fold)
    Section=Section.T  # Section es la Matriz que contiene las trazas del CDP


    Offset=read_segy.read_segy_offset(FileIn,Record,Fold)  #List containing the
    coords = []  # Reseting the picked coords if youre loading a new gather :). AJ

    # Destroying seismic panels if youre loading a new gather :). AJ
    hboxDisplay.destroy()    
    hboxDisplay = gtk.HBox(False, 0)
    hboxDisplay.show()
    hbox.pack_start(hboxDisplay)
    
    # Displaying embeded seismic section. AJ
    seisDisplay(Section,'Input CDP' ,'Offset [m]' ,'Time [ms]' ,
                Offset[0],Offset[Fold-1],0,int((ns-1)*dt),plt.cm.gray)
Esempio n. 2
0
def on_loadSegy_clicked(widget):
    '''
    This button callback function loads the SEGY file. AJ
    '''

    global Imagehbox, Section, Record, Nrecord, Fold, nt, ns, dt, Offset, dt_s, tmax_ms, hboxDisplay, coords
    global FileIn, SectionTauPi, SectionFilt, p0, nume

    FileIn = entryFileIn.get_text()  #SEGY file name
    Nrecord = 1901  #Number of CDP-Gathers
    Record = int(entryRecord.get_text())
    Fold = int(entryFold.get_text())  #Fold of the CDP-Record
    nt = read_segy.ntraces(FileIn)  #Number of traces in SEGY file
    ns = read_segy.nsamp_segy(FileIn)  #Number of samples per trace
    dt = int(read_segy.dt_segy(FileIn)) / 1000  #Sample rate (ms)
    dt_s = dt / 1000.0  #Sample rate (s) heavily used

    Section = read_segy.read_segy_record(FileIn, Record, Fold)
    Section = Section.T  # Section es la Matriz que contiene las trazas del CDP

    Offset = read_segy.read_segy_offset(FileIn, Record,
                                        Fold)  #List containing the
    coords = [
    ]  # Reseting the picked coords if youre loading a new gather :). AJ

    # Destroying seismic panels if youre loading a new gather :). AJ
    hboxDisplay.destroy()
    hboxDisplay = gtk.HBox(False, 0)
    hboxDisplay.show()
    hbox.pack_start(hboxDisplay)

    # Displaying embeded seismic section. AJ
    seisDisplay(Section, 'Input CDP', 'Offset [m]', 'Time [ms]', Offset[0],
                Offset[Fold - 1], 0, int((ns - 1) * dt), plt.cm.gray)
Esempio n. 3
0
 def on_buttonUpdate_clicked(self, widget):
     FileIn = self.entryFileIn.get_text()
     self.nt=read_segy.ntraces(FileIn)
     self.ns=read_segy.nsamp_segy(FileIn)
     self.dt=int(read_segy.dt_segy(FileIn))/1000
     self.entryFromTrc.set_text(str(1))
     self.entryToTrc.set_text(str(int(self.nt)))
     self.entryFromTime.set_text(str(0))
     self.entryToTime.set_text(str(int(self.ns-1)*self.dt))
def on_loadSegy_clicked(widget):
    global Imagehbox, Section, Record, Nrecord, Fold, nt, ns, dt, Offset, dt_s, tmax_ms
    global FileIn, SectionTauPi, SectionFilt
    variables.xpick = [0]
    variables.ypick = [0]
    FileIn = main.entryFileIn.get_text()  #SEGY file name
    Nrecord = 1901  #Number of CDP-Gathers
    Record = int(main.entryRecord.get_text())
    Fold = int(main.entryFold.get_text())  #Fold of the CDP-Record
    nt = read_segy.ntraces(FileIn)  #Number of traces in SEGY file
    ns = read_segy.nsamp_segy(FileIn)  #Number of samples per trace
    dt = int(read_segy.dt_segy(FileIn)) / 1000  #Sample rate (ms)
    dt_s = dt / 1000.0  #Sample rate (s) heavily used

    Section = read_segy.read_segy_record(FileIn, Record, Fold)
    Section = Section.T  # Section es la Matriz que contiene las trazas del CDP

    Offset = read_segy.read_segy_offset(FileIn, Record,
                                        Fold)  #List containing the
    #buttonFilter.clicked()
    SectionTauPi = Section
    SectionFilt = Section
    on_redisplay(widget)
Esempio n. 5
0
    def on_button1_clicked(self, widget):

        FileIn = self.entryFileIn.get_text()
        #nt=read_segy.ntraces(FileIn)
        #ns=read_segy.nsamp_segy(FileIn)
        self.dt=int(read_segy.dt_segy(FileIn))/1000 
        print self.dt
        self.fs = 1000*float(1/(2*float(self.dt)))
        nto = int(self.entryFromTrc.get_text())
        ntf = int(self.entryToTrc.get_text())
        nso = float(self.entryFromTime.get_text())
        nsf = float(self.entryToTime.get_text())

        
#        Section=read_segy.read_segy(nt,ns,FileIn)
        Section=read_segy.read_segy_trunc(FileIn,nto-1,ntf,int(nso/self.dt),1+int(nsf/self.dt))
        Section=Section.T
        print 'Section dim :', Section.shape
        plt.imshow(Section,extent=[nto,ntf,nsf,nso],cmap='gray')
        plt.colorbar()
        plt.title('Input Section')
        plt.savefig('SeisInput.png', bbox_inches='tight')
        plt.clf()

#        if imageIn != None:
#        imageIn.remove()

        self.table.destroy()
        self.table = Gtk.Table(2,2,False)
        self.box2.pack_start(self.table)

        pix = Gtk.gdk.pixbuf_new_from_file("SeisInput.png")
        pix = pix.scale_simple(300, 400, Gtk.gdk.INTERP_BILINEAR)
        imageIn = Gtk.Image()
        imageIn.set_from_pixbuf(pix)       
#        self.box2.pack_start(imageIn, True, True, 0)
        self.table.attach(imageIn, 0, 1, 0, 1)
        imageIn.show()
#        self.table.show()
#        imageIn.destroy()
        #pdb.set_trace()
        t = scipy.linspace(0,(nsf-nso)/1000.0,int((nsf-nso)/self.dt)+1)
        #t = scipy.linspace(0,float(751-1)/1000,750)
        freqs = scipy.fftpack.fftfreq(len(Section[:,0]), t[1]-t[0])
        Sectionfft = np.apply_along_axis(scipy.fft,0,Section)
        Sectionfft = abs(Sectionfft)
        AmpSpq = np.apply_along_axis(np.sum,1,Sectionfft)
        AmpSpq = 20*scipy.log10(AmpSpq) 

        plt.plot(freqs, AmpSpq)
        plt.title('Input Section Amplitude Spectrum')
        plt.savefig('SeisInputSpq.png', bbox_inches='tight')
        plt.clf()

        pix = Gtk.gdk.pixbuf_new_from_file("SeisInputSpq.png")
        pix = pix.scale_simple(300, 150, Gtk.gdk.INTERP_BILINEAR)
        SpqimageIn = Gtk.Image()
        SpqimageIn.set_from_pixbuf(pix)       
#        self.box2.pack_start(imageIn, True, True, 0)
        self.table.attach(SpqimageIn, 0, 1, 1, 2)
        SpqimageIn.show()


        EntryF1 = float(self.entryf1.get_text())
        EntryF2 = float(self.entryf2.get_text())
        EntryF3 = float(self.entryf3.get_text())
        EntryF4 = float(self.entryf4.get_text())

        print EntryF3
        
        
        param = [EntryF2,EntryF3,500]
        OutSection = np.apply_along_axis(butter.butter_bandpass_filter,0, Section,*param)
        #pdb.set_trace()

        '''
        kparam = {"lowcut":EntryF2, "highcut":EntryF3, "fs":500} 
        OutSection = np.apply_along_axis(butter.butter_bandpass_filter,0, Section,**kparam)
        '''

        '''
        pool = mp.Pool(processes=2)
        results = [pool.apply_async(butter.butter_bandpass_filter, args=(Section[:,u],EntryF2,EntryF3,500,)) for u in range(0,len(Section[0,:]))]
        output = [p.get() for p in results]
        SectionFilt = np.array(output)
        OutSection = SectionFilt.T
        '''

        plt.imshow(OutSection,extent=[nto,ntf,nsf,nso],cmap='gray')
        plt.colorbar()
        plt.title('Output Section')
        plt.savefig('SeisOut.png', bbox_inches='tight')
        plt.clf()

        pix = Gtk.gdk.pixbuf_new_from_file("SeisOut.png")
        pix = pix.scale_simple(300, 400, Gtk.gdk.INTERP_BILINEAR)
        imageOut = Gtk.Image()
        imageOut.set_from_pixbuf(pix)
        #self.box2.pack_start(imageOut, True, True, 0)
        self.table.attach(imageOut, 1, 2, 0, 1)
        imageOut.show()



        t = scipy.linspace(0,(nsf-1)/1000,nsf)
        #freqs = scipy.fftpack.fftfreq(len(OutSection[:,0]), t[1]-t[0])
        OutSectionfft = np.apply_along_axis(scipy.fft,0,OutSection)
        OutSectionfft = abs(OutSectionfft)
        OutAmpSpq = np.apply_along_axis(np.sum,1,OutSectionfft)
        OutAmpSpq = 20*scipy.log10(OutAmpSpq) 

        plt.plot(freqs, OutAmpSpq)
        plt.title('Output Section Amplitude Spectrum')
        plt.savefig('OutSeisInputSpq.png', bbox_inches='tight')
        plt.clf()

        pix = Gtk.gdk.pixbuf_new_from_file("OutSeisInputSpq.png")
        pix = pix.scale_simple(300, 150, Gtk.gdk.INTERP_BILINEAR)
        SpqimageOut = Gtk.Image()
        SpqimageOut.set_from_pixbuf(pix)       
#        self.box2.pack_start(imageIn, True, True, 0)
        self.table.attach(SpqimageOut, 1, 2, 1, 2)
        SpqimageOut.show()


        self.table.show()
        self.box2.show()