Brief description of class still missing. More...
#include <ToolNR.h>
Public Slots | |
void | highlightShot (int shotIndex) |
void | newGraphicViewer () |
void | optimizeStack () |
void | t0Apply () |
void | t0Revert () |
void | uniformStack () |
Public Member Functions | |
ToolNR (QWidget *parent) | |
~ToolNR () | |
Protected Member Functions | |
virtual bool | initStations (SubSignalPool *subPool) |
virtual void | updateAllFields () |
Brief description of class still missing.
Full description of class still missing
ToolNR::ToolNR | ( | QWidget * | parent | ) |
Description of constructor still missing
References highlightShot(), newGraphicViewer(), optimizeStack(), t0Apply(), t0Revert(), QGpCoreTools::tr(), TRACE, and uniformStack().
: ToolBase(parent, 0) { TRACE; setWindowIcon(QIcon( ":/images/nr-22x22.png" )); setObjectName("ToolNR"); QVBoxLayout * baseLayout=new QVBoxLayout(this); _d=new ToolNRd(this); baseLayout->addWidget(_d); _d->highlightShot->addItem(tr("None")); connect(_d->t0Apply, SIGNAL(clicked()), this, SLOT(t0Apply()) ); connect(_d->t0Revert, SIGNAL(clicked()), this, SLOT(t0Revert()) ); connect(_d->uniformStack, SIGNAL(clicked()), this, SLOT(uniformStack()) ); connect(_d->optimizeStack, SIGNAL(clicked()), this, SLOT(optimizeStack()) ); connect(_d->highlightShot, SIGNAL(activated(int)), this, SLOT(highlightShot(int)) ); connect(_d->stackGraphic, SIGNAL(clicked()), this, SLOT(newGraphicViewer()) ); }
ToolNR::~ToolNR | ( | ) |
void ToolNR::highlightShot | ( | int | shotIndex | ) | [slot] |
References GeopsyCore::SubSignalPool::at(), SciFigs::GraphContentLayer::deepUpdate(), ShotRecord::nReceivers(), GeopsyGui::SignalLayer::setSignalColor(), GeopsyGui::ToolBase::signalLayer(), and TRACE.
Referenced by ToolNR().
{ TRACE; int nShots=_shots.count(); SignalLayer * l=signalLayer(); if(l) { for(int i=0; i<nShots; i++ ) { ShotRecord& shot=*_shots.at(i); int nReceivers=shot.nReceivers(); QColor c=(shotIndex-1==i) ? Qt::green : Qt::black; for(int j=0; j<nReceivers; j++) { l->setSignalColor(shot.at(j), c); } } } l->deepUpdate(); }
bool ToolNR::initStations | ( | SubSignalPool * | subPool | ) | [protected, virtual] |
Reimplemented from GeopsyGui::ToolBase.
References GeopsyGui::ToolBase::_subPool, GeopsyCore::SubSignalPool::count(), GeopsyCore::geopsyCore, ShotRecord::isSameReceiverSet(), MSG_ID, GeopsyCore::SubSignalPool::name(), ShotRecord::organizeSubPool(), GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), ShotRecord::setSignals(), GeopsyGui::ToolBase::setWindowTitle(), str, QGpCoreTools::tr(), TRACE, and GeopsyGui::ToolBase::updateSubPool().
{ TRACE; _subPool=subPool; if(!ShotRecord::organizeSubPool(_subPool)) return false; int nSignals=_subPool->count(); QString str=tr("NR toolbox - ") + _subPool->name(); setWindowTitle(str); geopsyCore->setProgressMaximum(nSignals); for(int i=0;i < nSignals; ) { geopsyCore->setProgressValue(i); ShotRecord * shot=new ShotRecord; shot->setSignals( *subPool, i); if( !_shots.isEmpty() && !shot->isSameReceiverSet( *_shots.last()) ) { Message::warning(MSG_ID, tr("Gathering shots"), tr( "Shots recorded at %1 and %2 have not the same set or receivers." ). arg(_shots.last()->name()).arg(shot->name()), Message::cancel()); delete shot; return false; } _shots.append(shot); _d->highlightShot->addItem(shot->name()); } _d->t0TimeLimits->setPicks(_subPool); _d->stackGlobalTimeLimits->setPicks(_subPool); _d->stackSignalTimeLimits->setPicks(_subPool); emit updateSubPool(); return true; }
void ToolNR::newGraphicViewer | ( | ) | [slot] |
References geopsyGui, GeopsyCore::SubSignalPool::isEmpty(), TRACE, and uniformStack().
Referenced by ToolNR().
{ TRACE; if(_stack.isEmpty()) { uniformStack(); } geopsyGui->newGraphicWindow(_stack); }
void ToolNR::optimizeStack | ( | ) | [slot] |
References DinverCore::Neighborhood::bestModelIndex(), QGpCoreTools::endl(), GeopsyCore::geopsyCore, GeopsyCore::SubSignalPool::isEmpty(), DinverCore::Neighborhood::misfit(), DinverCore::Neighborhood::model(), DinverCore::Neighborhood::setForward(), StackWeights::setGlobalTimeLimits(), StackWeights::setReceiverIndex(), StackWeights::setSignalTimeLimits(), StackWeights::setWeights(), GeopsyCore::GeopsyCoreEngine::showMessage(), StackWeights::stack(), DinverCore::Neighborhood::start(), QGpCoreTools::tr(), TRACE, and GeopsyGui::ToolBase::updateSubPool().
Referenced by ToolNR().
{ TRACE; int nReceivers=_shots[0]->nReceivers(); bool firstTime=_stack.isEmpty(); TimeRangeParameters globalTimeLimits, signalTimeLimits; _d->stackGlobalTimeLimits->getParameters(globalTimeLimits); _d->stackSignalTimeLimits->getParameters(signalTimeLimits); for(int i=0; i<nReceivers; i++ ) { geopsyCore->showMessage(tr("Optimizing weights for receiver %1").arg(i)); StackWeights forward(_shots); forward.setReceiverIndex(i); forward.setGlobalTimeLimits(globalTimeLimits); forward.setSignalTimeLimits(signalTimeLimits); Neighborhood na; na.setForward(&forward); na.start(50, 50, 50, 10); int bestIndex=na.bestModelIndex(); forward.setWeights(na.model(bestIndex) ); forward.stack(_stack); App::stream() << tr("Noise level [%1]=%2").arg(i).arg(na.misfit(bestIndex) ) << endl; } if(firstTime) showStackResults(); emit updateSubPool(); }
void ToolNR::t0Apply | ( | ) | [slot] |
References T0GridSearch::bestT0(), QGpCoreTools::endl(), T0GridSearch::function(), GeopsyCore::geopsyCore, QGpCoreTools::GridSearch::globalMax(), T0GridSearch::setFunction(), T0GridSearch::setGrid(), T0Correlation::setReceiverRange(), T0Correlation::setTimeLimits(), GeopsyCore::GeopsyCoreEngine::showMessage(), QGpCoreTools::tr(), and TRACE.
Referenced by ToolNR().
{ TRACE; int nShots=_shots.count(); int minRecIndex=_shots[0]->receiverIndex(_d->t0MinDistance->value())+1; int maxRecIndex=_shots[0]->receiverIndex(_d->t0MaxDistance->value()); TimeRangeParameters timeLimits; _d->t0TimeLimits->getParameters(timeLimits); double t0s[nShots]; t0s[0]=_shots[0]->t0(); for(int i=1; i<nShots; i++ ) { geopsyCore->showMessage(tr("Adjusting phase shifts for shot %1 (%2/%3) ...").arg(_shots[i]->name()).arg(i).arg(nShots-1)); T0GridSearch grid; grid.setFunction(new T0Correlation(_shots[0], _shots[i])); grid.setGrid(_shots[0]->deltaT(), _shots[i]->t0()); grid.function()->setTimeLimits(timeLimits); grid.function()->setReceiverRange(minRecIndex, maxRecIndex); grid.globalMax(); t0s[i]=grid.bestT0(); } // Caluclate the average T0 double averageT0=0.0; for(int i=0; i<nShots; i++ ) { averageT0+=t0s[i]; } averageT0/=nShots; // Shift shots double baseShift=averageT0-t0s[0]; for(int i=0; i<nShots; i++ ) { double t0=t0s[i]-baseShift; App::stream() << tr("Shifted T0 for shot[%1]=%2").arg(i).arg(t0) << endl; _shots[i]->setT0(t0); } shotsToSubPool(); }
void ToolNR::t0Revert | ( | ) | [slot] |
void ToolNR::uniformStack | ( | ) | [slot] |
References QGpCoreTools::endl(), GeopsyCore::SubSignalPool::isEmpty(), StackWeights::misfit(), StackWeights::setGlobalTimeLimits(), StackWeights::setReceiverIndex(), StackWeights::setSignalTimeLimits(), StackWeights::setUniformWeights(), StackWeights::stack(), QGpCoreTools::tr(), TRACE, and GeopsyGui::ToolBase::updateSubPool().
Referenced by newGraphicViewer(), and ToolNR().
{ TRACE; int nReceivers=_shots[0]->nReceivers(); bool firstTime=_stack.isEmpty(); TimeRangeParameters globalTimeLimits, signalTimeLimits; _d->stackGlobalTimeLimits->getParameters(globalTimeLimits); _d->stackSignalTimeLimits->getParameters(signalTimeLimits); for(int i=0; i<nReceivers; i++ ) { StackWeights forward(_shots); forward.setGlobalTimeLimits(globalTimeLimits); forward.setSignalTimeLimits(signalTimeLimits); forward.setReceiverIndex(i); forward.setUniformWeights(); forward.stack(_stack); bool ok; App::stream() << tr("Noise level [%1]=%2").arg(i).arg(forward.misfit(ok)) << endl; } if(firstTime) showStackResults(); emit updateSubPool(); }
void ToolNR::updateAllFields | ( | ) | [protected, virtual] |
Reimplemented from GeopsyGui::ToolBase.
References TRACE.
{ TRACE; _d->t0TimeLimits->updateAllFields(); _d->stackGlobalTimeLimits->updateAllFields(); _d->stackSignalTimeLimits->updateAllFields(); }