Ejemplo n.º 1
0
 def checkPsSeisData(self):
     self.refreshMsgBox()
     #
     for f in self.psseisdata.keys():
         if psseis_ays.checkPsSeis(self.psseisdata[f]) is False:
             return False
     return True
Ejemplo n.º 2
0
 def getShotRange(self, f):
     _min = -1
     _max = 1
     if f in self.psseisdata.keys() and psseis_ays.checkPsSeis(
             self.psseisdata[f]):
         for k in self.psseisdata[f].keys():
             _vmin = np.min(self.psseisdata[f][k]['ShotData'])
             _vmax = np.max(self.psseisdata[f][k]['ShotData'])
             if _vmin < _min:
                 _min = _vmin
             if _vmax > _max:
                 _max = _vmax
     return _min, _max
Ejemplo n.º 3
0
def plotPsSeisShot(psseis,
                   shotlist=None,
                   colormap=None,
                   flipcmap=False,
                   valuemin=-1.0,
                   valuemax=1.0,
                   titlesurf='',
                   colorbaron=False,
                   verbose=True):
    if psseis_ays.checkPsSeis(psseis) is False:
        print('ERROR in plotPsSeisShot: no pre-stack seismic found')
        sys.exit()
    #
    if shotlist is None:
        print('WARNING in plotPsSeisShot: plot all shots')
        shotlist = list(psseis.keys())
    #
    nshot = len(shotlist)
    if verbose:
        print('Plot ' + str(nshot) + ' shots')
    for i in range(nshot):
        shot = shotlist[i]
        #
        if shot in psseis.keys():
            tracestart = psseis[shot]['ShotInfo']['XLStart']
            traceend = psseis[shot]['ShotInfo']['XLEnd']
            zstart = psseis[shot]['ShotInfo']['ZStart']
            zend = psseis[shot]['ShotInfo']['ZEnd']
            tracerange = psseis[shot]['ShotInfo']['XLRange']
            zrange = psseis[shot]['ShotInfo']['ZRange']
            x, y = np.meshgrid(tracerange, zrange)
            #
            seisdata = psseis[shot]['ShotData']
            plt.figure(facecolor='white')
            plt.pcolormesh(x,
                           y,
                           seisdata,
                           cmap=vis_cmap.makeColorMap(colormap, flipcmap),
                           shading='gouraud',
                           vmin=valuemin,
                           vmax=valuemax)
            plt.xlim([tracestart, traceend])
            plt.ylim([zend, zstart])
            plt.title('Shot No.' + shot + titlesurf)
            plt.xlabel('Trace No.')
            plt.ylabel('Vertical (z) Depth/Time')
            if colorbaron:
                plt.colorbar()
    plt.show()
    #
    return True
Ejemplo n.º 4
0
def checkPsSeisData(psseisdata):
    return psseis_ays.checkPsSeis(psseisdata)
Ejemplo n.º 5
0
 def checkPsSeis(self, name):
     return psseis_ays.checkPsSeis(self.psseisdata[name])
Ejemplo n.º 6
0
def plotPsSeisShotPlayer(psseis,
                         initshot=None,
                         colormap=None,
                         flipcmap=False,
                         valuemin=-1.0,
                         valuemax=1.0,
                         titlesurf='',
                         colorbaron=False,
                         interpolation='bicubic',
                         playerconfig=None,
                         fontstyle=None,
                         qicon=None):
    if psseis_ays.checkPsSeis(psseis) is False:
        print('ERROR in plotPsSeisShotPlayer: no pre-stack seismic found')
        sys.exit()
    #
    shotlist = list(sorted(psseis.keys()))
    #
    if initshot is None:
        print(
            'WARNING in plotPsSeisShotPlayer: to be initialized by the first shot'
        )
        initshot = shotlist[0]
    if playerconfig is None:
        playerconfig = {}
        playerconfig['First'] = 'A'
        playerconfig['Previous'] = 'S'
        playerconfig['Backward'] = 'Z'
        playerconfig['Pause'] = 'X'
        playerconfig['Forward'] = 'C'
        playerconfig['Next'] = 'D'
        playerconfig['Last'] = 'F'
        playerconfig['Interval'] = 5
    #
    def process_key(event):
        fig = event.canvas.figure
        ax = fig.axes[0]
        if event.key == playerconfig['First'].lower():
            first_shot(ax, shotlist, pref='Shot No. ', surf=titlesurf)
            fig.canvas.draw()
        if event.key == playerconfig['Previous'].lower():
            previous_shot(ax,
                          shotlist,
                          step=playerconfig['Interval'],
                          pref='Shot No. ',
                          surf=titlesurf)
            fig.canvas.draw()
        if event.key == playerconfig['Next'].lower():
            next_shot(ax,
                      shotlist,
                      step=playerconfig['Interval'],
                      pref='Shot No. ',
                      surf=titlesurf)
            fig.canvas.draw()
        if event.key == playerconfig['Last'].lower():
            last_shot(ax, shotlist, pref='Shot No. ', surf=titlesurf)
            fig.canvas.draw()
        if event.key == playerconfig['Backward'].lower():
            while True:
                previous_shot(ax,
                              shotlist,
                              step=playerconfig['Interval'],
                              pref='Shot No. ',
                              surf=titlesurf)
                fig.canvas.draw()
                plt.pause(0.2)
        if event.key == playerconfig['Forward'].lower():
            while True:
                next_shot(ax,
                          shotlist,
                          step=playerconfig['Interval'],
                          pref='Shot No. ',
                          surf=titlesurf)
                fig.canvas.draw()
                plt.pause(0.2)
        if event.key == playerconfig['Pause'].lower():
            plt.pause(0)

    #
    remove_keymap_conflicts({
        playerconfig['First'].lower(), playerconfig['Previous'].lower(),
        playerconfig['Backward'].lower(), playerconfig['Pause'].lower(),
        playerconfig['Forward'].lower(), playerconfig['Next'].lower(),
        playerconfig['Last'].lower()
    })
    #
    vis_font.updatePltFont(fontstyle)
    #
    fig, ax = plt.subplots(facecolor='white', figsize=(8, 8))
    ax.set_xlabel('Trace No.')
    ax.set_ylabel('Vertical (z) Depth/Time')
    volume = psseis
    ax.volume = volume
    ax.index = shotlist.index(initshot)
    ax.set_title('Shot No. ' + shotlist[ax.index] + titlesurf)
    #
    zstart = volume[shotlist[ax.index]]['ShotInfo']['ZStart']
    zend = volume[shotlist[ax.index]]['ShotInfo']['ZEnd']
    #
    ntrace = np.shape(volume[shotlist[ax.index]]['ShotData'])
    ntrace = ntrace[1] * ntrace[2]
    data = np.reshape(
        np.transpose(volume[shotlist[ax.index]]['ShotData'], [0, 2, 1]),
        [-1, ntrace])
    cat = ax.imshow(
        data,
        cmap=vis_cmap.makeColorMap(colormap, flipcmap),
        aspect='auto',  #float(len(tracerange)) / float(len(zrange)),
        extent=[1, ntrace, zend, zstart],
        interpolation=interpolation,
        vmin=valuemin,
        vmax=valuemax)

    #
    if colorbaron:
        fig.colorbar(cat)
    fig.canvas.mpl_connect('key_press_event', process_key)
    if qicon is not None:
        fig.canvas.set_window_title('2D Window - Pre-stack Gather')
        #
        # Commented by HD on June 7, 2018 to avoid crash
        # plt.get_current_fig_manager().window.setWindowIcon(qicon)
    plt.show()
    #
    return
Ejemplo n.º 7
0
 def checkPsSeis(self):
     return psseis_ays.checkPsSeis(self.psseisdata)