Exemple #1
0
 def clickBtnImportSurveyManual(self):
     self.refreshMsgBox()
     #
     _inlstart = basic_data.str2int(self.ldtinlstart.text())
     _xlstart = basic_data.str2int(self.ldtxlstart.text())
     _zstart = basic_data.str2int(self.ldtzstart.text())
     _inlstep = basic_data.str2int(self.ldtinlstep.text())
     _xlstep = basic_data.str2int(self.ldtxlstep.text())
     _zstep = basic_data.str2int(self.ldtzstep.text())
     _inlnum = basic_data.str2int(self.ldtinlnum.text())
     _xlnum = basic_data.str2int(self.ldtxlnum.text())
     _znum = basic_data.str2int(self.ldtznum.text())
     if _inlstart is False or _xlstart is False or _zstart is False \
         or _inlstep is False or _xlstep is False or _zstep is False \
         or _inlnum is False or _xlnum is False or _znum is False:
         print("ImportSurveyManual: Non-integer survey information")
         QtWidgets.QMessageBox.critical(self.msgbox, 'Create Survey',
                                        'Non-integer survey information')
         return
     if _inlnum <= 0 or _xlnum <= 0 or _znum <= 0:
         print("ImportSurveyManual: Zero survey dimension")
         QtWidgets.QMessageBox.critical(self.msgbox, 'Create Survey',
                                        'Zero survey dimension')
         return
     if _inlstep <= 0 or _xlstep <= 0 or _zstep == 0:
         print("ImportSurveyManual: Zero survey step")
         QtWidgets.QMessageBox.critical(self.msgbox, 'Create Survey',
                                        'Zero survey step')
         return
     #
     self.survinfo = seis_ays.createSeisInfoFrom3DMat(seis3dmat=np.zeros(
         [_znum, _xlnum, _inlnum]),
                                                      inlstart=_inlstart,
                                                      inlstep=_inlstep,
                                                      xlstart=_xlstart,
                                                      xlstep=_xlstep,
                                                      zstart=_zstart,
                                                      zstep=_zstep)
     #
     QtWidgets.QMessageBox.information(self.msgbox, "Create Survey",
                                       "Survey created successfully")
     return
Exemple #2
0
 def clickBtnApply(self):
     self.refreshMsgBox()
     #
     if self.checkSurvInfo() is False:
         print("EditSurvey: No seismic survey found")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Edit Survey',
                                        'No seismic survey found')
         return
     #
     _inlnum = basic_data.str2int(self.ldtinlnum.text())
     _xlnum = basic_data.str2int(self.ldtxlnum.text())
     _znum = basic_data.str2int(self.ldtznum.text())
     _inlstart = basic_data.str2int(self.ldtinlstart.text())
     _inlstep = basic_data.str2int(self.ldtinlstep.text())
     _xlstart = basic_data.str2int(self.ldtxlstart.text())
     _xlstep = basic_data.str2int(self.ldtxlstep.text())
     _zstart = basic_data.str2int(self.ldtzstart.text())
     _zstep = basic_data.str2int(self.ldtzstep.text())
     if _inlstart is False or _inlstep is False or _inlnum is False\
         or _xlstart is False or _xlstep is False or _xlnum is False\
         or _zstart is False or _zstep is False or _znum is False:
         print("EditSurvey: Non-integer survey selection")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Edit Survey',
                                        'Non-integer survey selection')
         return
     #
     _zerodata = np.zeros([_znum, _xlnum, _inlnum])
     self.survinfo = seis_ays.createSeisInfoFrom3DMat(_zerodata,
                                                      inlstart=_inlstart, inlstep=_inlstep,
                                                      xlstart=_xlstart, xlstep=_xlstep,
                                                      zstart=_zstart, zstep=_zstep
                                                      )
     #
     # QtWidgets.QMessageBox.information(self.msgbox,
     #                                   "Edit Survey",
     #                                   "Survey edited successfully")
     #
     self.dialog.close()
Exemple #3
0
 def changeLdtSlice(self):
     if len(self.ldtslice.text()) > 0:
         _val = basic_data.str2int(self.ldtslice.text())
         if _val >= self.slbslice.minimum(
         ) and _val <= self.slbslice.maximum():
             self.slbslice.setValue(_val)
Exemple #4
0
 def clickBtnImportPsSeisImageSet(self):
     self.refreshMsgBox()
     #
     _nimage = len(self.imagelist)
     if _nimage <= 0:
         print("ImportPsSeisImageSet: No image selected for import")
         QtWidgets.QMessageBox.critical(
             self.msgbox, 'Import Pre-stack Seismic ImageSet',
             'No image selected for import')
         return
     #
     _ninl = basic_data.str2int(self.ldtdimsinl.text())
     _nxl = basic_data.str2int(self.ldtdimsxl.text())
     _nz = basic_data.str2int(self.ldtdimsz.text())
     if _ninl is False or _nxl is False or _nz is False:
         print("ImportPsSeisImageSet: Non-integer survey dimensions")
         QtWidgets.QMessageBox.critical(
             self.msgbox, 'Import Pre-stack Seismic ImageSet',
             'Non-integer dimensions')
         return
     if _ninl <= 0 or _nxl <= 0 or _nz <= 0:
         print("ImportPsSeisImageSet: Zero survey dimensions")
         QtWidgets.QMessageBox.critical(
             self.msgbox, 'Import Pre-stack Seismic ImageSet',
             'Zero survey dimensions')
         return
     #
     # Progress dialog
     _pgsdlg = QtWidgets.QProgressDialog()
     icon = QtGui.QIcon()
     icon.addPixmap(
         QtGui.QPixmap(os.path.join(self.iconpath, "icons/image.png")),
         QtGui.QIcon.Normal, QtGui.QIcon.Off)
     _pgsdlg.setWindowIcon(icon)
     _pgsdlg.setWindowTitle('Import Pre-stack Seismic ImageSet')
     _pgsdlg.setCancelButton(None)
     _pgsdlg.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
     _pgsdlg.forceShow()
     _pgsdlg.setFixedWidth(400)
     #
     if self.cbbtype.currentIndex() == 0:
         _shots = np.linspace(0,
                              len(self.imagelist) - 1,
                              len(self.imagelist),
                              dtype=int)
         # _pgsdlg.setWindowTitle('Import ' + str(len(_shots)) + ' Pre-stack Seismic ImageSet')
         _imagedata = psseis_vis.loadPsSeisShot(self.imagelist,
                                                _shots,
                                                ispref=False,
                                                inlnum=_ninl,
                                                inlstart=0,
                                                inlstep=1,
                                                xlnum=_nxl,
                                                xlstart=0,
                                                xlstep=1,
                                                znum=_nz,
                                                zstart=0,
                                                zstep=-1,
                                                qpgsdlg=_pgsdlg)
     _psseisdata = {}
     if checkPsSeisData(_imagedata):
         _psseisdata[self.ldtsave.text()] = _imagedata
     #
     # add new data to psseisdata
     for key in _psseisdata.keys():
         if key in self.psseisdata.keys() and checkPsSeisData(
                 self.psseisdata[key]):
             reply = QtWidgets.QMessageBox.question(
                 self.msgbox, 'Import Pre-stack Seismic ImageSet',
                 key + ' already exists. Overwrite?',
                 QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                 QtWidgets.QMessageBox.No)
             if reply == QtWidgets.QMessageBox.No:
                 return
         self.psseisdata[key] = _psseisdata[key]
     #
     QtWidgets.QMessageBox.information(
         self.msgbox, "Import Pre-stack Seismic ImageSet",
         str(_nimage) +
         " image(s) imported as Pre-stack Seismic successfully")
     return
Exemple #5
0
    def clickBtnApply(self):
        self.refreshMsgBox()
        #
        if self.ldtsave.text() in self.pointdata.keys():
            reply = QtWidgets.QMessageBox.question(self.msgbox, 'Convert Seismic to PointSet',
                                                   self.ldtsave.text() + ' already exists. Overwrite?',
                                                   QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                                                   QtWidgets.QMessageBox.No)

            if reply == QtWidgets.QMessageBox.No:
                return
        #
        if self.checkSurvInfo() is False:
            print("ConvertSeis2PointSet: No seismic survey found")
            QtWidgets.QMessageBox.critical(self.msgbox,
                                           'Convert Seismic to PointSet',
                                           'No seismic survey found')
            return
        #
        if self.rdbsrvpart.isChecked():
            _inlstart = basic_data.str2int(self.ldtinlstart.text())
            _xlstart = basic_data.str2int(self.ldtxlstart.text())
            _zstart = basic_data.str2int(self.ldtzstart.text())
            _inlend = basic_data.str2int(self.ldtinlend.text())
            _xlend = basic_data.str2int(self.ldtxlend.text())
            _zend = basic_data.str2int(self.ldtzend.text())
            if _inlstart is False or _xlstart is False or _zstart is False \
                    or _inlend is False or _xlend is False or _zend is False:
                print("ConvertSeis2PointSet: Non-integer survey selection")
                QtWidgets.QMessageBox.critical(self.msgbox,
                                               'Convert Seismic to PointSet',
                                               'Non-integer survey selection')
                return
        #
        _survinfo = self.survinfo
        #
        if self.rdbsrvall.isChecked():
            _pts = seis_ays.convertSeisInfoTo2DMat(self.survinfo)
        if self.rdbsrvpart.isChecked():
            _inlstart_idx = _inlstart - _survinfo['ILStart']
            _inlstart_idx = int(_inlstart_idx / _survinfo['ILStep'])
            _xlstart_idx = _xlstart - _survinfo['XLStart']
            _xlstart_idx = int(_xlstart_idx / _survinfo['XLStep'])
            _zstart_idx = _zstart - _survinfo['ZStart']
            _zstart_idx = int(_zstart_idx / _survinfo['ZStep'])
            if _inlstart_idx < 0:
                _inlstart_idx = 0
            if _xlstart_idx < 0:
                _xlstart_idx = 0
            if _zstart_idx < 0:
                _zstart_idx = 0
            if _inlstart_idx >= _survinfo['ILNum']:
                _inlstart_idx = _survinfo['ILNum'] - 1
            if _xlstart_idx >= _survinfo['XLNum']:
                _xlstart_idx = _survinfo['XLNum'] - 1
            if _zstart_idx >= _survinfo['ZNum']:
                _zstart_idx = _survinfo['ZNum'] - 1
            _inlend_idx = _inlend - _survinfo['ILStart']
            _inlend_idx = int(_inlend_idx / _survinfo['ILStep'])
            _xlend_idx = _xlend - _survinfo['XLStart']
            _xlend_idx = int(_xlend_idx / _survinfo['XLStep'])
            _zend_idx = _zend - _survinfo['ZStart']
            _zend_idx = int(_zend_idx / _survinfo['ZStep'])
            if _inlend_idx >= _survinfo['ILNum']:
                _inlend_idx = _survinfo['ILNum'] - 1
            if _xlend_idx >= _survinfo['XLNum']:
                _xlend_idx = _survinfo['XLNum'] - 1
            if _zend_idx >= _survinfo['ZNum']:
                _zend_idx = _survinfo['ZNum'] - 1
            if _inlend_idx < _inlstart_idx:
                _inlend_idx = _inlstart_idx
            if _xlend_idx < _xlstart_idx:
                _xlend_idx = _xlstart_idx
            if _zend_idx < _zstart_idx:
                _zend_idx = _zstart_idx
            #
            _inlidx = np.arange(_inlstart_idx, _inlend_idx + 1,
                                self.cbbinlitvl.currentIndex() + 1, dtype=int)
            _xlidx = np.arange(_xlstart_idx, _xlend_idx + 1,
                               self.cbbxlitvl.currentIndex() + 1, dtype=int)
            _zidx = np.arange(_zstart_idx, _zend_idx + 1,
                              self.cbbzitvl.currentIndex() + 1, dtype=int)
            #
            _inl = _inlidx * _survinfo['ILStep'] + _survinfo['ILStart']
            _xl = _xlidx * _survinfo['XLStep'] + _survinfo['XLStart']
            _z = _zidx * _survinfo['ZStep'] + _survinfo['ZStart']
            #
            _pts = seis_ays.retrieveSeisILSliceFrom3DMat(np.zeros([self.survinfo['ZNum'], self.survinfo['XLNum'], self.survinfo['ILNum']]),
                                                         inlsls=_inl, verbose=False, seisinfo=self.survinfo)
            _pts = seis_ays.retrieveSeisXLSliceFrom3DMat(seis_ays.convertSeis2DMatTo3DMat(_pts), xlsls=_xl, verbose=False,
                                                         seisinfo=seis_ays.getSeisInfoFrom2DMat(_pts))
            _pts = seis_ays.retrieveSeisZSliceFrom3DMat(seis_ays.convertSeis2DMatTo3DMat(_pts), zsls=_z, verbose=False,
                                                        seisinfo=seis_ays.getSeisInfoFrom2DMat(_pts))
        #
        self.pointdata[self.ldtsave.text()] = {}
        self.pointdata[self.ldtsave.text()]['Inline'] = _pts[:, 0:1]
        self.pointdata[self.ldtsave.text()]['Crossline'] = _pts[:, 1:2]
        self.pointdata[self.ldtsave.text()]['Z'] = _pts[:, 2:3]
        #
        _proplist = self.lwgattrib.selectedItems()
        _proplist = [f.text() for f in _proplist]
        #
        # Progress dialog
        _pgsdlg = QtWidgets.QProgressDialog()
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(os.path.join(self.iconpath, "icons/seismic.png")),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        _pgsdlg.setWindowIcon(icon)
        _pgsdlg.setWindowTitle('Retrieve ' + str(len(_proplist)) + ' Property(s)')
        _pgsdlg.setCancelButton(None)
        _pgsdlg.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        _pgsdlg.forceShow()
        _pgsdlg.setFixedWidth(400)
        _pgsdlg.setMaximum(len(_proplist))

        for _idx in range(len(_proplist)):
            QtCore.QCoreApplication.instance().processEvents()
            _pgsdlg.setValue(_idx)
            #
            if self.rdbsrvall.isChecked():
                self.pointdata[self.ldtsave.text()][_proplist[_idx]] = self.seisdata[_proplist[_idx]]
            if self.rdbsrvpart.isChecked():
                _data = self.seisdata[_proplist[_idx]]
                _data = \
                    np.transpose(np.reshape(_data, [self.survinfo['ILNum'], self.survinfo['XLNum'], self.survinfo['ZNum']]),
                                 [2, 1, 0])
                self.pointdata[self.ldtsave.text()][_proplist[_idx]] = \
                    seis_ays.retrieveSeisSampleFrom3DMat(_data, seisinfo=self.survinfo, verbose=False,
                                                         samples=_pts)[:, 3:4]
        _pgsdlg.setValue(len(_proplist))
        #
        QtWidgets.QMessageBox.information(self.msgbox,
                                          "Convert Seismic to PointSet",
                                          str(len(_pts)) + " seismic converted successfully")
Exemple #6
0
 def clickBtnRtrvSeisProp(self):
     self.refreshMsgBox()
     #
     _attriblist = self.lwgattrib.selectedItems()
     if len(_attriblist) < 1:
         print("No property selected for retrieval")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Retrieve Seismic Property',
                                        'No property selected for export')
         return
     #
     if self.checkSeisData() is False:
         print("RtrvSeisProp: No seismic data loaded")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Retrieve Seismic Property',
                                        'No seismic data loaded')
         return
     #
     _wdinl = basic_data.str2int(self.ldtdimsinl.text())
     _wdxl = basic_data.str2int(self.ldtdimsxl.text())
     _wdz = basic_data.str2int(self.ldtdimsz.text())
     if _wdinl is False or _wdxl is False or _wdz is False:
         print("RtrvSeisProp: Non-integer retrieval window")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Retrieve Seismic Property',
                                        'Non-integer retrieval window')
         return
     if _wdinl < 0 or _wdxl < 0 or _wdz < 0:
         print("RtrvSeisProp: Non-positive retrieval window")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Retrieve Seismic Property',
                                        'Non-positive retrieval window')
         return
     #
     _wdsize = (2 * _wdinl + 1) * (2 * _wdxl + 1) * (2 * _wdz + 1)
     #
     # Progress dialog
     _pgsdlg = QtWidgets.QProgressDialog()
     icon = QtGui.QIcon()
     icon.addPixmap(
         QtGui.QPixmap(os.path.join(self.iconpath, "icons/retrieve.png")),
         QtGui.QIcon.Normal, QtGui.QIcon.Off)
     _pgsdlg.setWindowIcon(icon)
     _pgsdlg.setWindowTitle('Retrieve Seismic Property')
     _pgsdlg.setCancelButton(None)
     _pgsdlg.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
     _pgsdlg.forceShow()
     _pgsdlg.setFixedWidth(400)
     #
     _targetdata = basic_mdt.exportMatDict(self.seisdata,
                                           ['Inline', 'Crossline', 'Z'])
     #
     for i in range(len(_attriblist)):
         #
         _pgsdlg.setWindowTitle('Retrieve ' + str(i + 1) + ' of ' +
                                str(len(_attriblist)) + ' Property')
         #
         print("RtrvSeisProp: Retrieve %d of %d Properties: %s" %
               (i + 1, len(_attriblist), _attriblist[i].text()))
         _npydata = self.npydata[_attriblist[i].text()]
         _npydata = \
             np.transpose(np.reshape(_npydata, [self.npyinfo['ILNum'], self.npyinfo['XLNum'], self.npyinfo['ZNum']]),
                          [2, 1, 0])
         _data = seis_ays.retrieveSeisWindowFrom3DMat(_npydata,
                                                      _targetdata,
                                                      seisinfo=self.npyinfo,
                                                      wdinl=_wdinl,
                                                      wdxl=_wdxl,
                                                      wdz=_wdz,
                                                      verbose=False,
                                                      qpgsdlg=_pgsdlg)
         _data = _data[:, 3:3 + _wdsize]
         _data = np.reshape(
             _data, [-1, 2 * _wdz + 1, 2 * _wdxl + 1, 2 * _wdinl + 1])
         if _wdinl == 0:
             _data = np.squeeze(_data, axis=3)
         if _wdxl == 0:
             _data = np.squeeze(_data, axis=2)
         if _wdz == 0:
             _data = np.squeeze(_data, axis=1)
         if np.ndim(_data) < 2:
             _data = np.reshape(_data, [-1, 1])
         self.seisdata[_attriblist[i].text()] = _data
         #
         # _pgsdlg.setValue(i + 1)
         #
     #
     QtWidgets.QMessageBox.information(
         self.msgbox, "Retrieve Seismic Property",
         str(len(_attriblist)) + " properties retrieved successfully")
     return
Exemple #7
0
 def clickBtnImportSeisImageSet(self):
     self.refreshMsgBox()
     #
     _nimage = len(self.imagelist)
     if _nimage <= 0:
         print("ImageSeisImageSet: No image selected for import")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Import Seismic ImageSet',
                                        'No image selected for import')
         return
     #
     _ninl = basic_data.str2int(self.ldtdimsinl.text())
     _nxl = basic_data.str2int(self.ldtdimsxl.text())
     _nz = basic_data.str2int(self.ldtdimsz.text())
     if _ninl is False or _nxl is False or _nz is False:
         print("ImageSeisImageSet: Non-integer survey dimensions")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Import Seismic ImageSet',
                                        'Non-integer dimensions')
         return
     if _ninl <= 0 or _nxl <= 0 or _nz <= 0:
         print("ImageSeisImageSet: Zero survey dimensions")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Import Seismic ImageSet',
                                        'Zero survey dimensions')
         return
     #
     # Progress dialog
     _pgsdlg = QtWidgets.QProgressDialog()
     icon = QtGui.QIcon()
     icon.addPixmap(
         QtGui.QPixmap(os.path.join(self.iconpath, "icons/image.png")),
         QtGui.QIcon.Normal, QtGui.QIcon.Off)
     _pgsdlg.setWindowIcon(icon)
     _pgsdlg.setWindowTitle('Import Seismic ImageSet')
     _pgsdlg.setCancelButton(None)
     _pgsdlg.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
     _pgsdlg.forceShow()
     _pgsdlg.setFixedWidth(400)
     #
     if self.cbbtype.currentIndex() == 0:
         # _pgsdlg.setWindowTitle('Import ' + str(_ninl) + ' Seismic ImageSet')
         _imagedata = seis_vis.loadSeisILSliceTo3DMat(self.imagelist,
                                                      inlsls=np.linspace(
                                                          0,
                                                          _ninl - 1,
                                                          _ninl,
                                                          dtype=int),
                                                      ispref=False,
                                                      xlnum=_nxl,
                                                      znum=_nz,
                                                      qpgsdlg=_pgsdlg)
     if self.cbbtype.currentIndex() == 1:
         # _pgsdlg.setWindowTitle('Import ' + str(_nxl) + ' Seismic Image')
         _imagedata = seis_vis.loadSeisXLSliceTo3DMat(self.imagelist,
                                                      xlsls=np.linspace(
                                                          0,
                                                          _nxl - 1,
                                                          _nxl,
                                                          dtype=int),
                                                      ispref=False,
                                                      inlnum=_ninl,
                                                      znum=_nz,
                                                      qpgsdlg=_pgsdlg)
     if self.cbbtype.currentIndex() == 2:
         # _pgsdlg.setWindowTitle('Import ' + str(_nz) + ' Seismic Image')
         _imagedata = seis_vis.loadSeisZSliceTo3DMat(self.imagelist,
                                                     zsls=np.linspace(
                                                         0,
                                                         -_nz + 1,
                                                         _nz,
                                                         dtype=int),
                                                     ispref=False,
                                                     inlnum=_ninl,
                                                     xlnum=_nxl,
                                                     qpgsdlg=_pgsdlg)
     _seisdata = {}
     _survinfo = seis_ays.createSeisInfoFrom3DMat(_imagedata)
     _imagedata = np.reshape(np.transpose(_imagedata, [2, 1, 0]), [-1, 1])
     if checkSeisData(_imagedata, _survinfo):
         _seisdata[self.ldtsave.text()] = _imagedata
     #
     # add new data to seisdata
     if checkSurvInfo(_survinfo):
         self.survinfo = _survinfo
     for key in _seisdata.keys():
         if key in self.seisdata.keys() and checkSeisData(
                 self.seisdata[key], self.survinfo):
             reply = QtWidgets.QMessageBox.question(
                 self.msgbox, 'Import Seismic ImageSet',
                 key + ' already exists. Overwrite?',
                 QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                 QtWidgets.QMessageBox.No)
             if reply == QtWidgets.QMessageBox.No:
                 return
         self.seisdata[key] = _seisdata[key]
     #
     QtWidgets.QMessageBox.information(
         self.msgbox, "Import Seismic ImageSet",
         str(_nimage) + " image(s) imported as Seismic successfully")
     return
 def clickBtnExportSeisImageSet(self):
     self.refreshMsgBox()
     #
     _attriblist = self.lwgattrib.selectedItems()
     if len(_attriblist) < 1:
         print("ExportSeisImageSet: No property selected for export")
         QtWidgets.QMessageBox.critical(self.msgbox,
                                        'Export Seismic ImageSet',
                                        'No property selected for export')
         return
     if self.rdbslicedef.isChecked():
         for s in self.ldtslicedef.text().split(','):
             if basic_data.str2int(s) is False:
                 print("ExportSeisImageSet: Non-integer slice selection")
                 QtWidgets.QMessageBox.critical(
                     self.msgbox, 'Export Seismic ImageSet',
                     'Non-integer slice selection')
                 return
     #
     # Progress dialog
     _pgsdlg = QtWidgets.QProgressDialog()
     icon = QtGui.QIcon()
     icon.addPixmap(
         QtGui.QPixmap(os.path.join(self.iconpath, "icons/image.png")),
         QtGui.QIcon.Normal, QtGui.QIcon.Off)
     _pgsdlg.setWindowIcon(icon)
     _pgsdlg.setWindowTitle('Export ' + str(len(_attriblist)) +
                            ' Seismic Image')
     _pgsdlg.setCancelButton(None)
     _pgsdlg.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
     _pgsdlg.forceShow()
     _pgsdlg.setFixedWidth(400)
     # _pgsdlg.setMaximum(len(_attriblist))
     #
     _cmap = self.cbbcmap.currentIndex()
     _flip = self.cbxflip.isChecked()
     for i in range(len(_attriblist)):
         #
         # QtCore.QCoreApplication.instance().processEvents()
         # _pgsdlg.setValue(i)
         _pgsdlg.setWindowTitle('Export ' + str(i + 1) + ' of ' +
                                str(len(_attriblist)) + ' Seismic ImageSet')
         #
         _sls = None
         if self.rdbslicedef.isChecked():
             _sls = [
                 basic_data.str2int(s)
                 for s in self.ldtslicedef.text().split(',')
             ]
         _imagefile = os.path.join(self.ldtsave.text(),
                                   _attriblist[i].text() + '_')
         _data = self.seisdata[_attriblist[i].text()]
         _data = np.reshape(_data, [_data.shape[0], -1])
         _data = np.mean(_data, axis=1)
         _data = np.reshape(_data, [len(_data), 1])
         _data = np.transpose(
             np.reshape(_data, [
                 self.survinfo['ILNum'], self.survinfo['XLNum'],
                 self.survinfo['ZNum']
             ]), [2, 1, 0])
         print("ExportSeisImageSet: Export %d of %d ImageSet: %s" %
               (i + 1, len(_attriblist), _attriblist[i].text()))
         if self.cbbtype.currentIndex() == 0:
             seis_vis.saveSeisILSliceFrom3DMat(_data,
                                               _imagefile,
                                               inlsls=_sls,
                                               seisinfo=self.survinfo,
                                               valuemin=np.min(_data),
                                               valuemax=np.max(_data),
                                               colormap=self.cmaps[_cmap],
                                               flipcmap=_flip,
                                               verbose=False)
         if self.cbbtype.currentIndex() == 1:
             seis_vis.saveSeisXLSliceFrom3DMat(_data,
                                               _imagefile,
                                               xlsls=_sls,
                                               seisinfo=self.survinfo,
                                               valuemin=np.min(_data),
                                               valuemax=np.max(_data),
                                               colormap=self.cmaps[_cmap],
                                               flipcmap=_flip,
                                               verbose=False,
                                               qpgsdlg=_pgsdlg)
         if self.cbbtype.currentIndex() == 2:
             seis_vis.saveSeisZSliceFrom3DMat(_data,
                                              _imagefile,
                                              zsls=_sls,
                                              seisinfo=self.survinfo,
                                              valuemin=np.min(_data),
                                              valuemax=np.max(_data),
                                              colormap=self.cmaps[_cmap],
                                              flipcmap=_flip,
                                              verbose=False)
         #
     # _pgsdlg.setValue(len(_attriblist))
     #
     QtWidgets.QMessageBox.information(
         self.msgbox, "Export Seismic ImageSet",
         str(len(_attriblist)) +
         " properties exported as ImageSet successfully")
     return
Exemple #9
0
 def changeLdtXl(self):
     if len(self.ldtxl.text()) > 0:
         _val = basic_data.str2int(self.ldtxl.text())
         if _val >= self.slbxl.minimum() and _val <= self.slbxl.maximum():
             self.slbxl.setValue(_val)
Exemple #10
0
    def clickBtnEditPointSet(self):
        self.refreshMsgBox()
        #
        _pointlist = self.lwgpoint.selectedItems()
        if len(_pointlist) < 1:
            print("EditPointSet: No pointset selected for editing")
            QtWidgets.QMessageBox.critical(self.msgbox, 'Edit PointSet',
                                           'No pointset selected for editing')
            return
        #
        if self.cbbaction.currentIndex() == 0:
            self.pointdata[_pointlist[0].text() + '_copy'] = self.pointdata[
                _pointlist[0].text()].copy()
        if self.cbbaction.currentIndex() == 1:
            self.pointdata.pop(_pointlist[0].text())
        if self.cbbaction.currentIndex() == 2:
            if len(self.ldtrename.text()) < 1:
                print("EditPointSet: No name specified for rename")
                QtWidgets.QMessageBox.critical(self.msgbox, 'Edit PointSet',
                                               'No name specified for rename')
                return
            if self.ldtrename.text() in self.pointdata.keys():
                reply = QtWidgets.QMessageBox.question(
                    self.msgbox, 'Edit PointSet',
                    self.ldtrename.text() + ' already exists. Overwrite?',
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                    QtWidgets.QMessageBox.No)

                if reply == QtWidgets.QMessageBox.No:
                    return
            self.pointdata[self.ldtrename.text()] = self.pointdata[
                _pointlist[0].text()]
            self.pointdata.pop(_pointlist[0].text())
        if self.cbbaction.currentIndex() == 3:
            _filter = QtWidgets.QDialog()
            _gui = gui_filterpointset()
            _gui.pointname = _pointlist[0].text()
            _gui.pointdata = self.pointdata[_pointlist[0].text()].copy()
            _gui.setupGUI(_filter)
            _filter.exec()
            self.pointdata[_pointlist[0].text()] = _gui.pointdata.copy()
            _filter.show()
        if self.cbbaction.currentIndex() == 4:
            _size = basic_data.str2int(self.ldtrename.text())
            if _size is False:
                print("EditPointSet: Non-integer size")
                QtWidgets.QMessageBox.critical(self.msgbox, 'Edit PointSet',
                                               'Non-integer size')
                return
            self.pointdata[
                _pointlist[0].text()] = basic_mdt.retrieveDictRandom(
                    self.pointdata[_pointlist[0].text()], batch_size=_size)
        if self.cbbaction.currentIndex() == 5:
            if self.cbbrename.currentText() not in self.pointdata.keys():
                print("EditPointSet: No pointset selected for appending")
                QtWidgets.QMessageBox.critical(
                    self.msgbox, 'Edit PointSet',
                    'No pointset selected for appending')
                return
            _pts = {}
            for f in self.pointdata[self.cbbrename.currentText()].keys():
                if f in self.pointdata[_pointlist[0].text()].keys():
                    _pts[f] = np.concatenate(
                        (self.pointdata[_pointlist[0].text()][f],
                         self.pointdata[self.cbbrename.currentText()][f]),
                        axis=0)
            self.pointdata[_pointlist[0].text()] = _pts
        if self.cbbaction.currentIndex() == 6:
            _editpoint = QtWidgets.QDialog()
            _gui = gui_editseispointset()
            _gui.seispointdata = self.pointdata[_pointlist[0].text()]
            _gui.rootpath = self.rootpath
            _gui.setupGUI(_editpoint)
            _editpoint.exec()
            self.pointdata[_pointlist[0].text()] = _gui.seispointdata
            _editpoint.show()
        if self.cbbaction.currentIndex() == 7:
            _view = QtWidgets.QDialog()
            _gui = gui_viewpointset()
            _gui.pointname = _pointlist[0].text()
            _gui.pointdata = self.pointdata[_pointlist[0].text()]
            _gui.linestyle = self.linestyle
            _gui.setupGUI(_view)
            _view.exec()
            # self.pointdata = _gui.pointdata.copy()
            _view.show()
        if self.cbbaction.currentIndex() == 8:
            _cplt = QtWidgets.QDialog()
            _gui = gui_plot2dpointsetcrossplt()
            _gui.pointdata = {}
            _gui.pointdata[_pointlist[0].text()] = self.pointdata[
                _pointlist[0].text()]
            _gui.linestyle = self.linestyle
            _gui.setupGUI(_cplt)
            _cplt.exec()
            _cplt.show()
        #
        self.refreshLwgPoint()
        # if self.cbbaction.currentIndex() != 3:
        # QtWidgets.QMessageBox.information(self.msgbox,
        #                                   "Edit PointSet",
        #                                   "PointSet edited successfully")
        return