Exemplo n.º 1
0
    def AlgorithmRun(self):
        # Setting threads
        set_thread_num(int(self.threadsNum.value()))

        if self.isVariogramValid() == 1:
            if self.AlgorithmType.currentIndex() == 0:
                check, self.Err = self.SKWidget.isValuesValid()
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.log += "Starting Simple Kriging Algorithm\n"
                    self.algName = '_SK'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.SKWidget.getSearchRanges()
                    IntPoints = self.SKWidget.getIntPoints()
                    Mean = self.contCubes.meanOf(self.currIndex)
                    self.NewThread = SKT.SKThread(self.contCubes.property(self.currIndex),
                                                  self.contCubes.gridObject(self.currIndex),
                                                  EllipsoidRanges, IntPoints,
                                                  Variogram, Mean
                                                 )
#                    self.emitLog(
#                       '# RUNNING SIMPLE KRIGING\n' +
#                       'ellipsRanges = %s\n' % (EllipsoidRanges,) +
#                       'intPoints = %i\n' % (IntPoints,) +
#                       'mean = %f\n' % (Mean,) +
#                       'result = simple_kriging(prop, gridObject, '+
#                       'ellipsRanges, intPoints, variogram, mean)'
#                   )

                    #info = ['Simple Kriging', self.NewThread]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'Simple Kriging'
                    self.algoInfo.emit(info)

                    #QtCore.QObject.connect(self.NewThread,
                    #                       QtCore.SIGNAL("msg(QString)"),
                    #                        self.UpdateUI)
                    #QtCore.QObject.connect(self.NewThread,
                    #                       QtCore.SIGNAL("progress(QString)"),
                    #                       self.UpdateProgress)
                    #QtCore.QObject.connect(self.NewThread,
                    #                       QtCore.SIGNAL("Result(PyQt_PyObject)"),
                    #                       self.CatchResult)
                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()
                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(self.__tr("Wait while algorithm is processing"))

            elif self.AlgorithmType.currentIndex() == 1:
                check, self.Err = self.OKWidget.isValuesValid()
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.algName = '_OK'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.OKWidget.getSearchRanges()
                    IntPoints = self.OKWidget.getIntPoints()
                    self.NewThread = OKT.OKThread(self.contCubes.property(self.currIndex),
                                               self.contCubes.gridObject(self.currIndex),
                                               EllipsoidRanges, IntPoints,
                                               Variogram)
#                   self.emitLog(
#                       '# RUNNING ORDINARY KRIGING\n' +
#                       'ellipsRanges = %s\n' % (EllipsoidRanges,) +
#                        'intPoints = %i\n' % (IntPoints,) +
#                       'result = ordinary_kriging(prop, gridObject, '+
#                       'ellipsRanges, intPoints, variogram)'
#                   )

                    #info = ['Ordinary Kriging', self]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'Ordinary Kriging'
                    self.algoInfo.emit(info)

                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)


                    self.NewThread.start()
                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(self.__tr("Wait while algorithm is processing"))

            elif self.AlgorithmType.currentIndex() == 2:
                check, self.Err = self.LVMWidget.isValuesValid()
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.log += "Starting Local Varying Mean Algorithm\n"
                    self.algName = '_LVM'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.LVMWidget.getSearchRanges()
                    IntPoints = self.LVMWidget.getIntPoints()
                    Mean = self.LVMWidget.getMean(self.contCubes)
                    self.NewThread = LVMT.LVMThread(self.contCubes.property(self.currIndex),
                                               self.contCubes.gridObject(self.currIndex),
                                               Mean, EllipsoidRanges,
                                               IntPoints, Variogram)
#self.emitLog(
#                       '# RUNNING LVM KRIGING\n' +
#                       'ellipsRanges = %s\n' % (EllipsoidRanges,) +
#                       'intPoints = %i\n' % (IntPoints,) +
#                       'mean = %s\n' % (Mean,) +
#                       'result = lvm_kriging(prop, gridObject, '+
#                       'mean, ellipsRanges, intPoints, variogram)'
#                   )

                    #info = ['LVM Kriging', self]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'LVM Kriging'
                    self.algoInfo.emit(info)

                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()

                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(self.__tr("Wait while algorithm is processing"))

            elif self.AlgorithmType.currentIndex() == 3:
                check, self.Err = self.SGSWidget.isValuesValid(self.Err)
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.log += "Starting Sequantial Gaussian Algorithm\n"
                    self.algName = '_SGS'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.SGSWidget.getSearchRanges()
                    IntPoints = self.SGSWidget.getIntPoints()
                    Seed = self.SGSWidget.GetSeed()
                    UseHd = self.SGSWidget.GetUseHd()
                    KrType = self.SGSWidget.GetKrType()
                    Mean = self.SGSWidget.getMean(self.contCubes)
                    Mask = self.SGSWidget.GetMask(self.contCubes)
                    self.NewThread = SGST.SGSThread(self.contCubes.property(self.currIndex),
                                                self.contCubes.gridObject(self.currIndex),
                                                EllipsoidRanges, IntPoints,
                                                Variogram, Seed, KrType, Mean,
                                                UseHd, Mask)

                    #info = ['SGS', self]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'SGS'
                    self.algoInfo.emit(info)

                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()
                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(self.__tr("Wait while algorithm is processing"))
Exemplo n.º 2
0
    def AlgorithmRun(self):
        # Setting threads
        set_thread_num(int(self.threadsNum.value()))

        if self.AlgorithmType.currentIndex() == 0:
            k = 0
            MaxIndicators = self.contCubes.indicatorsCount(self.currIndex)
            for i in xrange(MaxIndicators):
                j, errors = self.Tab4Tabs[i].isVariogramValid()
                if j == 0:
                    self.Err += 'In tab #' + str(i) + ':\n' + errors
                k += j
            if k != MaxIndicators:
                self.ShowError(self.Err)
            else:
                self.hide()

                self.log += "Starting Indicator Kriging Algorithm\n"
                self.algName = '_IK'

                Variograms = range(MaxIndicators)
                MargProbs = range(MaxIndicators)
                VarData = range(MaxIndicators)

                EllipsoidRanges = self.IKWidget.getSearchRanges()
                IntPoints = self.IKWidget.getIntPoints()

                for i in xrange(MaxIndicators):
                    Variograms[i] = self.Tab4Tabs[i].GetVariogram()
                    MargProbs[i] = self.Tab4Tabs[i].GetMargProbs()
                    VarData[i] = { "cov_model" : Variograms[i],
                                   "max_neighbours" : IntPoints,
                                   "radiuses" : EllipsoidRanges
                                 }

                self.NewThread = IKT.IKThread(self.contCubes.property(self.currIndex),
                                              self.contCubes.gridObject(self.currIndex),
                                              VarData,
                                              MargProbs)

#                info = ['Indicator Kriging', self]
#                self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                self.algoInfo.emit('Indicator Kriging')

                self.NewThread.logMessage.connect(self.UpdateUI)
                self.NewThread.progressMessage.connect(self.UpdateProgress)
                self.NewThread.propSignal.connect(self.CatchResult)

                self.NewThread.start()
                self.RunButton.setDisabled(1)
                self.RunButton.setToolTip(self.__tr("Wait while algorithm is processing"))

        elif self.AlgorithmType.currentIndex() == 1:
            k = 0
            MaxIndicators = self.contCubes.indicatorsCount(self.currIndex)
            for i in xrange(MaxIndicators):
                j, errors = self.Tab4Tabs[i].isVariogramValid()
                if j == 0:
                    self.Err += 'In variogram tab #' + str(i) + ':\n' + errors
                k += j
            if k != MaxIndicators:
                self.ShowError(self.Err)
            else:
                self.hide()

                self.log += "Starting Sequantial Indicator Algorithm\n"
                self.algName = '_SIS'

                Variograms = range(MaxIndicators)
                MargProbs = range(MaxIndicators)
                VarData = range(MaxIndicators)

                EllipsoidRanges = self.SISWidget.getSearchRanges()
                IntPoints = self.SISWidget.getIntPoints()
                Seed = self.SISWidget.GetSeed()
                UseCorr = self.SISWidget.GetUseCorr()
                Mask = self.SISWidget.GetMask(self.contCubes) # is right?

                for i in xrange(MaxIndicators):
                    Variograms[i] = self.Tab4Tabs[i].GetVariogram()
                    MargProbs[i] = self.Tab4Tabs[i].GetMargProbs()
                    VarData[i] = { "cov_model" : Variograms[i],
                                   "max_neighbours" : IntPoints,
                                   "radiuses" : EllipsoidRanges
                                 }

                self.NewThread = SIST.SISThread(self.contCubes.property(self.currIndex),
                                              self.contCubes.gridObject(self.currIndex),
                                              VarData, MargProbs,
                                              Seed, UseCorr,
                                              Mask)

#                info = ['SIS', self]
#                self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                self.algoInfo.emit('SIS')

                self.NewThread.logMessage.connect(self.UpdateUI)
                self.NewThread.progressMessage.connect(self.UpdateProgress)
                self.NewThread.propSignal.connect(self.CatchResult)

                self.NewThread.start()
                self.RunButton.setDisabled(1)
                self.RunButton.setToolTip(self.__tr("Wait while algorithm is processing"))
Exemplo n.º 3
0
    def AlgorithmRun(self):
        # Setting threads
        set_thread_num(int(self.threadsNum.value()))

        if self.AlgorithmType.currentIndex() == 0:
            k = 0
            MaxIndicators = self.contCubes.indicatorsCount(self.currIndex)
            for i in xrange(MaxIndicators):
                j, errors = self.Tab4Tabs[i].isVariogramValid()
                if j == 0:
                    self.Err += 'In tab #' + str(i) + ':\n' + errors
                k += j
            if k != MaxIndicators:
                self.ShowError(self.Err)
            else:
                self.hide()

                self.log += "Starting Indicator Kriging Algorithm\n"
                self.algName = '_IK'

                Variograms = range(MaxIndicators)
                MargProbs = range(MaxIndicators)
                VarData = range(MaxIndicators)

                EllipsoidRanges = self.IKWidget.getSearchRanges()
                IntPoints = self.IKWidget.getIntPoints()

                for i in xrange(MaxIndicators):
                    Variograms[i] = self.Tab4Tabs[i].GetVariogram()
                    MargProbs[i] = self.Tab4Tabs[i].GetMargProbs()
                    VarData[i] = {
                        "cov_model": Variograms[i],
                        "max_neighbours": IntPoints,
                        "radiuses": EllipsoidRanges
                    }

                self.NewThread = IKT.IKThread(
                    self.contCubes.property(self.currIndex),
                    self.contCubes.gridObject(self.currIndex), VarData,
                    MargProbs)

                #                info = ['Indicator Kriging', self]
                #                self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                self.algoInfo.emit('Indicator Kriging')

                self.NewThread.logMessage.connect(self.UpdateUI)
                self.NewThread.progressMessage.connect(self.UpdateProgress)
                self.NewThread.propSignal.connect(self.CatchResult)

                self.NewThread.start()
                self.RunButton.setDisabled(1)
                self.RunButton.setToolTip(
                    self.__tr("Wait while algorithm is processing"))

        elif self.AlgorithmType.currentIndex() == 1:
            k = 0
            MaxIndicators = self.contCubes.indicatorsCount(self.currIndex)
            for i in xrange(MaxIndicators):
                j, errors = self.Tab4Tabs[i].isVariogramValid()
                if j == 0:
                    self.Err += 'In variogram tab #' + str(i) + ':\n' + errors
                k += j
            if k != MaxIndicators:
                self.ShowError(self.Err)
            else:
                self.hide()

                self.log += "Starting Sequantial Indicator Algorithm\n"
                self.algName = '_SIS'

                Variograms = range(MaxIndicators)
                MargProbs = range(MaxIndicators)
                VarData = range(MaxIndicators)

                EllipsoidRanges = self.SISWidget.getSearchRanges()
                IntPoints = self.SISWidget.getIntPoints()
                Seed = self.SISWidget.GetSeed()
                UseCorr = self.SISWidget.GetUseCorr()
                Mask = self.SISWidget.GetMask(self.contCubes)  # is right?

                for i in xrange(MaxIndicators):
                    Variograms[i] = self.Tab4Tabs[i].GetVariogram()
                    MargProbs[i] = self.Tab4Tabs[i].GetMargProbs()
                    VarData[i] = {
                        "cov_model": Variograms[i],
                        "max_neighbours": IntPoints,
                        "radiuses": EllipsoidRanges
                    }

                self.NewThread = SIST.SISThread(
                    self.contCubes.property(self.currIndex),
                    self.contCubes.gridObject(self.currIndex), VarData,
                    MargProbs, Seed, UseCorr, Mask)

                #                info = ['SIS', self]
                #                self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                self.algoInfo.emit('SIS')

                self.NewThread.logMessage.connect(self.UpdateUI)
                self.NewThread.progressMessage.connect(self.UpdateProgress)
                self.NewThread.propSignal.connect(self.CatchResult)

                self.NewThread.start()
                self.RunButton.setDisabled(1)
                self.RunButton.setToolTip(
                    self.__tr("Wait while algorithm is processing"))
Exemplo n.º 4
0
    def AlgorithmRun(self):
        # Setting threads
        set_thread_num(int(self.threadsNum.value()))

        if self.isVariogramValid() == 1:
            if self.AlgorithmType.currentIndex() == 0:
                check, self.Err = self.SKWidget.isValuesValid()
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.log += "Starting Simple Kriging Algorithm\n"
                    self.algName = '_SK'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.SKWidget.getSearchRanges()
                    IntPoints = self.SKWidget.getIntPoints()
                    Mean = self.contCubes.meanOf(self.currIndex)
                    self.NewThread = SKT.SKThread(
                        self.contCubes.property(self.currIndex),
                        self.contCubes.gridObject(self.currIndex),
                        EllipsoidRanges, IntPoints, Variogram, Mean)
                    #                    self.emitLog(
                    #                       '# RUNNING SIMPLE KRIGING\n' +
                    #                       'ellipsRanges = %s\n' % (EllipsoidRanges,) +
                    #                       'intPoints = %i\n' % (IntPoints,) +
                    #                       'mean = %f\n' % (Mean,) +
                    #                       'result = simple_kriging(prop, gridObject, '+
                    #                       'ellipsRanges, intPoints, variogram, mean)'
                    #                   )

                    #info = ['Simple Kriging', self.NewThread]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'Simple Kriging'
                    self.algoInfo.emit(info)

                    #QtCore.QObject.connect(self.NewThread,
                    #                       QtCore.SIGNAL("msg(QString)"),
                    #                        self.UpdateUI)
                    #QtCore.QObject.connect(self.NewThread,
                    #                       QtCore.SIGNAL("progress(QString)"),
                    #                       self.UpdateProgress)
                    #QtCore.QObject.connect(self.NewThread,
                    #                       QtCore.SIGNAL("Result(PyQt_PyObject)"),
                    #                       self.CatchResult)
                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()
                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(
                        self.__tr("Wait while algorithm is processing"))

            elif self.AlgorithmType.currentIndex() == 1:
                check, self.Err = self.OKWidget.isValuesValid()
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.algName = '_OK'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.OKWidget.getSearchRanges()
                    IntPoints = self.OKWidget.getIntPoints()
                    self.NewThread = OKT.OKThread(
                        self.contCubes.property(self.currIndex),
                        self.contCubes.gridObject(self.currIndex),
                        EllipsoidRanges, IntPoints, Variogram)
                    #                   self.emitLog(
                    #                       '# RUNNING ORDINARY KRIGING\n' +
                    #                       'ellipsRanges = %s\n' % (EllipsoidRanges,) +
                    #                        'intPoints = %i\n' % (IntPoints,) +
                    #                       'result = ordinary_kriging(prop, gridObject, '+
                    #                       'ellipsRanges, intPoints, variogram)'
                    #                   )

                    #info = ['Ordinary Kriging', self]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'Ordinary Kriging'
                    self.algoInfo.emit(info)

                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()
                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(
                        self.__tr("Wait while algorithm is processing"))

            elif self.AlgorithmType.currentIndex() == 2:
                check, self.Err = self.LVMWidget.isValuesValid()
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.log += "Starting Local Varying Mean Algorithm\n"
                    self.algName = '_LVM'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.LVMWidget.getSearchRanges()
                    IntPoints = self.LVMWidget.getIntPoints()
                    Mean = self.LVMWidget.getMean(self.contCubes)
                    self.NewThread = LVMT.LVMThread(
                        self.contCubes.property(self.currIndex),
                        self.contCubes.gridObject(self.currIndex), Mean,
                        EllipsoidRanges, IntPoints, Variogram)
                    #self.emitLog(
                    #                       '# RUNNING LVM KRIGING\n' +
                    #                       'ellipsRanges = %s\n' % (EllipsoidRanges,) +
                    #                       'intPoints = %i\n' % (IntPoints,) +
                    #                       'mean = %s\n' % (Mean,) +
                    #                       'result = lvm_kriging(prop, gridObject, '+
                    #                       'mean, ellipsRanges, intPoints, variogram)'
                    #                   )

                    #info = ['LVM Kriging', self]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'LVM Kriging'
                    self.algoInfo.emit(info)

                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()

                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(
                        self.__tr("Wait while algorithm is processing"))

            elif self.AlgorithmType.currentIndex() == 3:
                check, self.Err = self.SGSWidget.isValuesValid(self.Err)
                if check == 0:
                    self.ShowError(self.Err)
                else:
                    self.hide()

                    self.log += "Starting Sequantial Gaussian Algorithm\n"
                    self.algName = '_SGS'

                    Variogram = self.GetVariogram()
                    EllipsoidRanges = self.SGSWidget.getSearchRanges()
                    IntPoints = self.SGSWidget.getIntPoints()
                    Seed = self.SGSWidget.GetSeed()
                    UseHd = self.SGSWidget.GetUseHd()
                    KrType = self.SGSWidget.GetKrType()
                    Mean = self.SGSWidget.getMean(self.contCubes)
                    Mask = self.SGSWidget.GetMask(self.contCubes)
                    self.NewThread = SGST.SGSThread(
                        self.contCubes.property(self.currIndex),
                        self.contCubes.gridObject(self.currIndex),
                        EllipsoidRanges, IntPoints, Variogram, Seed, KrType,
                        Mean, UseHd, Mask)

                    #info = ['SGS', self]
                    #self.emit(QtCore.SIGNAL('algorithm(PyQt_PyObject)'), info)
                    info = 'SGS'
                    self.algoInfo.emit(info)

                    self.NewThread.logMessage.connect(self.UpdateUI)
                    self.NewThread.progressMessage.connect(self.UpdateProgress)
                    self.NewThread.propSignal.connect(self.CatchResult)

                    self.NewThread.start()
                    self.RunButton.setDisabled(1)
                    self.RunButton.setToolTip(
                        self.__tr("Wait while algorithm is processing"))