#include <SubSignalPool.h>
Public Types | |
typedef QList< Signal * > ::const_iterator | const_iterator |
typedef QList< Signal * >::iterator | iterator |
Public Member Functions | |
void | addAll () |
void | addFile (int fileN) |
void | addFile (const SignalFile *sf) |
void | addGroup (AbstractSignalGroup *g) |
void | addList (QString signalList) |
void | addReceiver (Point point) |
void | addSignal (Signal *sig) |
void | addSignal (int id) |
void | addSource (Point point) |
void | addSubPool (const SubSignalPool &subPool) |
void | agc (double width) |
bool | associate3Components () |
Signal * | at (int index) const |
QStringList | availableTimePicks () const |
double | azimuth () const |
iterator | begin () |
const_iterator | begin () const |
int | checkDuplicateRays () |
bool | contains (const Signal *sig) const |
void | convolution (const Signal *referenceSig) |
SubSignalPool | copy () const |
void | correlations (double maxDelay, const Signal *referenceSig=0) |
int | count () const |
void | cut (const TimeRangeParameters ¶m) |
void | debugSignalSharing () |
void | decimateAmplitude (int maxCount, double maxRef) |
void | decimateTime (int factor) |
void | discreteFourierTransform () |
bool | empty () |
iterator | end () |
const_iterator | end () const |
void | exportTable (QString fileName, const MetaDataFieldList ¶m) |
void | fastFourierTransform (DoubleSignal::SignalType st) |
void | filter (const FilterParameters ¶m) |
Signal * | first () const |
void | importTable (QString fileName) |
int | indexOf (const Signal *sig) const |
void | insertSignal (Signal *sig, Signal *refSig=0, bool before=true) |
bool | isEmpty () const |
bool | isHeaderModified () const |
bool | isReadOnlySamples () const |
Signal * | last () const |
int | linearSearch (const Point &source, const Point &receiver) |
int | maximumTimePickCount () const |
bool | merge () |
bool | mergeStations () |
void | multiply (double value) |
const QString & | name () const |
void | normalizedCorrelations (double maxDelay, const Signal *referenceSig=0) |
bool | operator!= (const SubSignalPool &o) const |
SubSignalPool & | operator= (const SubSignalPool &o) |
bool | operator== (const SubSignalPool &o) const |
void | overSample (double factor) |
void | pickCoppens (const QString &pickName, double delta, double tend, double tstart=0., bool relative=false, double mute=0.0) |
void | pickMinMax (const QString &pickNameb, double from, double to, Signal::PickWhat what) |
Curve< Point > | receivers () const |
void | remove (Signal *sig) |
void | remove (Signal::Components comp) |
void | removeAll () |
void | removeAt (int i) |
void | rotateComponents (Matrix3x3 rotMatrix) |
int | samplesCount () |
bool | save (QString filePath, bool useOriginalBaseName, SignalFileFormat format, int maximumSignalsPerFile=0, const QString &pickName=QString::null) const |
bool | saveGeopsySignal (QString filePath) const |
void | setHeaderModified (bool b) const |
void | setName (const QString &n) |
void | shift (double dt) |
void | sort () |
Curve< Point > | sources () const |
void | stalta (double tsta, double tlta) |
void | stddevClip (double factor) |
SubSignalPool () | |
SubSignalPool (const SubSignalPool &subPool) | |
void | subtractSignal (Signal *bysig) |
void | subtractSignals (SubSignalPool *bySubPool) |
void | subtractValue (double val=0.0) |
void | taper (const TimeRangeParameters &range, const TaperParameters ¶m) |
TimeRange | timeRange () const |
void | unglitch (double threshold) |
void | waveletTransform (const MorletParameters ¶m) |
void | whiten () |
~SubSignalPool () | |
Static Public Member Functions | |
static bool | isExportFormat (const SignalFileFormat &f) |
Protected Attributes | |
QString | _name |
typedef QList<Signal *>::const_iterator GeopsyCore::SubSignalPool::const_iterator |
typedef QList<Signal *>::iterator GeopsyCore::SubSignalPool::iterator |
GeopsyCore::SubSignalPool::SubSignalPool | ( | ) | [inline] |
{}
GeopsyCore::SubSignalPool::SubSignalPool | ( | const SubSignalPool & | subPool | ) |
GeopsyCore::SubSignalPool::~SubSignalPool | ( | ) | [inline] |
{removeAll();}
void GeopsyCore::SubSignalPool::addAll | ( | ) |
References _name, addSubPool(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, GeopsyCore::SignalDB::subPool(), QGpCoreTools::tr(), and TRACE.
{ TRACE; addSubPool(geopsyCore->currentDB() ->subPool()); _name=tr("All signals"); }
void GeopsyCore::SubSignalPool::addFile | ( | int | fileN | ) |
References GeopsyCore::SignalFilePool::at(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::SignalDB::filePool(), GeopsyCore::geopsyCore, and TRACE.
Referenced by GeopsyGui::SubPoolWindow::addFile(), GeopsyGui::SignalFileItem::getSelection(), GeopsyCore::GeopsyCoreEngine::load(), GeopsyGui::CityLoader::on_loadBut_clicked(), GeopsyCore::SignalDB::removeFile(), GeopsyCore::SignalFile::save(), GeopsyCore::AllFilesGroup::subPool(), GeopsyCore::TemporaryFilesGroup::subPool(), GeopsyCore::PermanentFilesGroup::subPool(), GeopsyCore::SignalFile::xml_polish(), and GeopsyCore::SignalFile::xml_writeChildren().
void GeopsyCore::SubSignalPool::addFile | ( | const SignalFile * | sf | ) |
References _name, begin(), GeopsyCore::GeopsyCoreEngine::currentDB(), end(), GeopsyCore::Signal::file(), GeopsyCore::geopsyCore, GeopsyCore::SignalFile::shortName(), GeopsyCore::SignalDB::subPool(), QGpCoreTools::tr(), and TRACE.
{ TRACE; const SubSignalPool & dbList=geopsyCore->currentDB() ->subPool(); for(const_iterator it=dbList.begin(); it!=dbList.end(); ++it) { Signal * sig=* it; if(sig->file()==sFile) { //qDebug( "SubSignalPool::addFile signal id %i %s", sig->id(), sig->name().toAscii().data()); append(sig); } } if(_name.isEmpty()) _name=tr( "File %1" ).arg(sFile->shortName()); else _name += tr( "+File %1" ).arg(sFile->shortName()); }
References addSubPool(), GeopsyCore::AbstractSignalGroup::subPool(), and TRACE.
Referenced by GeopsyGui::SignalGroupItem::getSelection(), and GeopsyCore::SignalProcess::subtractSignalsCore().
{ TRACE; addSubPool(g->subPool()); }
void GeopsyCore::SubSignalPool::addList | ( | QString | signalList | ) |
void GeopsyCore::SubSignalPool::addReceiver | ( | Point | point | ) |
void GeopsyCore::SubSignalPool::addSignal | ( | Signal * | sig | ) | [inline] |
Reimplemented in GeopsyCore::SignalDB.
Referenced by GeopsyCore::StationSignals::addSignal(), GeopsyGui::SubPoolWindow::addSignal(), addSignal(), StructureStationSignals::addSignals(), GeopsySLink::SeedLinkServer::allSignals(), associate3Components(), GeopsyCore::SignalGroup::convertIds(), convolution(), copy(), correlations(), GeopsyMainWindow::createNewGroup(), cut(), decimateTime(), SignalTableView::getSelection(), MapWindow::getSelection(), ToolLinearFKActive::initStations(), merge(), mergeStations(), normalizedCorrelations(), overSample(), Process::run(), save(), GeopsyGui::ChronogramLayer::selection(), MagnifierSignal::setSignal(), ShotRecord::setSignals(), StackWeights::stack(), stalta(), GeopsyCore::XMLSubSignalPool::subPool(), GeopsySLink::SeedLink::subPool(), GeopsyCore::TemporarySignalsGroup::subPool(), and GeopsyGui::SignalLayer::xml_polishChild().
{append(sig);}
void GeopsyCore::SubSignalPool::addSignal | ( | int | id | ) |
References addSignal(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, GeopsyCore::SignalDB::signal(), and TRACE.
{ TRACE; Signal * sig=geopsyCore->currentDB()->signal(id); if(sig) { addSignal(sig); } }
void GeopsyCore::SubSignalPool::addSource | ( | Point | point | ) |
void GeopsyCore::SubSignalPool::addSubPool | ( | const SubSignalPool & | subPool | ) |
References _name, name(), and TRACE.
Referenced by addAll(), addGroup(), GeopsyCore::SignalGroup::addSignals(), GeopsyGui::SubPoolWindow::addSignals(), GraphicWindow::getSelection(), Station::raw(), and GeopsyCore::AbstractSignalGroup::subPool().
{ TRACE; for(const_iterator it=subPool.constBegin(); it!=subPool.constEnd(); ++it) { append( * it); } if(_name.isEmpty()) _name=subPool.name(); else if( !subPool.name().isEmpty()) _name += "+" + subPool.name(); }
void GeopsyCore::SubSignalPool::agc | ( | double | width | ) |
References GeopsyCore::DoubleSignal::agc(), at(), count(), GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by GeopsyCore::SignalProcess::agcCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); if(!sig->warnReadOnlySamples()) { sig->agc(width); } } }
Make sure the the sub pool is organized in terms of a list of 3 component stations, listed by Z N E Returns false if some components are missing or if some error were detected. The signals must be associated in triplets (Vertical, North and East component)
References GeopsyCore::SortKey::add(), addSignal(), at(), GeopsyCore::SortKey::clear(), GeopsyCore::MetaDataFactory::Component, GeopsyCore::Signal::component(), count(), GeopsyCore::DoubleSignal::deltaT(), isEmpty(), MSG_ID, GeopsyCore::MetaDataFactory::Name, GeopsyCore::Signal::name(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::Signal::receiver(), removeAll(), sort(), GeopsyCore::MetaDataFactory::T0, GeopsyCore::Signal::t0(), QGpCoreTools::tr(), and TRACE.
Referenced by ToolPtMotion::initStations(), WaveformConsole::rotate(), and rotateComponents().
{ TRACE; // Sorting SortKey::clear(); SortKey::add(MetaDataFactory::Name); SortKey::add(MetaDataFactory::T0); SortKey::add(MetaDataFactory::Component); sort(); // Testing if all 3 components are present (warning only) // Testing if nsamples and sampling rate are constant SubSignalPool triplet; double deltaT=0; int nSamp=0; double t0=0; QString stat; Point rec; int n=count(); for(int i=0;i < n; ) { Signal * sig=at(i); if(deltaT==0) { deltaT=sig->deltaT(); nSamp=sig->nSamples(); t0=sig->t0(); stat=sig->name(); rec=sig->receiver(); triplet.addSignal(sig); i++; continue; } if(sig->name()==stat && sig->receiver()==rec && sig->t0()==t0) { if(sig->deltaT()!=deltaT || sig->nSamples()!=nSamp) { Message::warning(MSG_ID, tr( "Associating 3 components" ), tr( "For station %1, the sampling rate or the number of samples " "is not the same for all component, skiping %2 component." ) .arg(stat).arg(sig->component()), Message::cancel()); return false; } else { triplet.addSignal(sig); } i++; } else { if( !check3ComponentTriplet(triplet) ) return false; triplet.removeAll(); deltaT=0; } } if( !triplet.isEmpty()) { if( !check3ComponentTriplet(triplet) ) return false; } return true; }
Signal* GeopsyCore::SubSignalPool::at | ( | int | index | ) | const [inline] |
Reimplemented in GeopsyCore::SignalDB.
Referenced by GeopsyGui::SubPoolWindow::addSignal(), StructureStationSignals::addSignals(), agc(), associate3Components(), GeopsyCore::SignalDB::at(), convolution(), GeopsyCore::SignalProcess::convolutionCore(), GeopsyCore::StationProcessSignals::copyOriginalSignal(), correlations(), GeopsyCore::SignalProcess::correlationsCore(), GeopsyMainWindow::createNewGroup(), TFAResults::createObjects(), DampingResults::createObjects(), SignalTableItem::data(), decimateTime(), discreteFourierTransform(), GeopsyGui::ChronogramLayer::exportGaps(), fastFourierTransform(), filter(), SignalTableView::getSelection(), GeopsyCore::SignalProcess::headerCore(), ToolNR::highlightShot(), GeopsyGui::SignalLayer::highlightSignal(), ManualPick::init(), ShotRecord::isSameReceiverSet(), GeopsyGui::PickLayer::keyPressEvent(), linearSearch(), GeopsyCore::SignalFile::loadGeopsySignal(), GeopsyGui::SignalLayer::maxAmplitude(), GeopsyGui::SignalLayer::minMaxY(), GeopsyGui::PickLayer::mouseMoveEvent(), GeopsyGui::PickLayer::mousePressEvent(), normalizedCorrelations(), GeopsyCore::SignalProcess::normalizedCorrelationsCore(), operator==(), StructureStationSignals::organizeSubPool(), overSample(), GeopsyGui::PickLayer::paintData(), GeopsyGui::SignalLayer::paintData(), GeopsyGui::ChronogramLayer::rangeUpdate(), ShotRecord::receiverIndex(), remove(), removeAt(), GeopsyCore::SignalFile::save(), GeopsyGui::ChronogramLayer::selection(), MonoStation::AbstractTool::setCurrentDisplayStation(), SignalTableItem::setData(), GeopsyCore::SignalProcess::setHeaderCore(), GeopsyCore::StationProcessSignals::setHighPassFilter(), GeopsyGui::PickLayer::setPick(), MagnifierSignal::setSignal(), SignalViewer::setSignals(), ShotRecord::setSignals(), Convolution::setSubPool(), Correlations::setSubPool(), SubtractSignals::setSubPool(), shift(), MonoStation::AbstractTool::signalMousePressed(), StackWeights::stack(), ToolTFA::start(), stddevClip(), ChronogramWindow::subPoolUpdate(), MapWindow::subPoolUpdate(), GraphicWindow::subPoolUpdate(), GeopsyGui::SignalLayer::subPoolUpdate(), GeopsyCore::SignalProcess::subtractSignalCore(), subtractSignals(), GraphicWindow::updateLabels(), T0Correlation::value(), waveletTransform(), whiten(), GeopsyGui::TimeWindowLayer::xml_layerPolish(), GeopsyCore::SignalFile::xml_polish(), GeopsyGui::SignalLayer::xml_setProperty(), GeopsyGui::TimeWindowLayer::xml_writeChildren(), and GeopsyCore::XMLSubSignalPool::XMLSubSignalPool().
{return QList<Signal *>::at(index);}
QStringList GeopsyCore::SubSignalPool::availableTimePicks | ( | ) | const |
References begin(), end(), GeopsyCore::TimePick::names(), GeopsyCore::TimePick::staticId(), TRACE, and QGpCoreTools::unique().
{ TRACE; QStringList names; for(const_iterator it=begin(); it!=end(); ++it) { const TimePick * o=static_cast<const TimePick *>((*it)->metaData(TimePick::staticId())); names.append(o->names()); } qSort(names); unique(names); return names; }
double GeopsyCore::SubSignalPool::azimuth | ( | ) | const |
Return the general azimuth of the sources of the subpool. If only one source is detected, the general azimuth includes the receivers (-M_PI/2 to M_PI/2)
References GeopsyCore::SortKey::add(), QGpCoreTools::Curve< pointType >::append(), QGpCoreTools::Curve< pointType >::azimuth(), begin(), GeopsyCore::SortKey::clear(), QGpCoreTools::Curve< pointType >::count(), count(), end(), GeopsyCore::Signal::receiver(), sort(), GeopsyCore::Signal::source(), GeopsyCore::MetaDataFactory::SourceReceiverDistance, GeopsyCore::MetaDataFactory::SourceReceiverRoughAzimuth, GeopsyCore::MetaDataFactory::SourceX, GeopsyCore::MetaDataFactory::SourceY, GeopsyCore::MetaDataFactory::SourceZ, and TRACE.
Referenced by ToolRefra::initStations().
{ TRACE; if(count()==0) return 0; SubSignalPool ordered=*this; SortKey::clear(); SortKey::add(MetaDataFactory::SourceX); SortKey::add(MetaDataFactory::SourceY); SortKey::add(MetaDataFactory::SourceZ); SortKey::add(MetaDataFactory::SourceReceiverRoughAzimuth); SortKey::add(MetaDataFactory::SourceReceiverDistance); ordered.sort(); Curve<Point> srcList; iterator it=ordered.begin(); Signal * sig=*it; srcList.append(sig->source()); Point p=sig->source(); for(++it; it!= ordered.end(); ++it) { sig=*it; if(sig->source()!=p) { p=sig->source(); srcList.append(sig->source()); } } if(srcList.count()==1) { // only one source, add receivers to define azimuth it=ordered.begin(); for(it=ordered.begin(); it!=ordered.end(); ++it) { sig=*it; if(sig->receiver()!=p) { p=sig->receiver(); srcList.append(sig->receiver()); } } } return srcList.azimuth(); }
iterator GeopsyCore::SubSignalPool::begin | ( | ) | [inline] |
Referenced by addFile(), addReceiver(), GeopsyCore::StationList::addSignals(), addSource(), GeopsyGui::TimeWindowLayer::addTimeWindows(), availableTimePicks(), azimuth(), MonoStation::CategoryGroupItem::belongsTo(), copy(), PtMotionResults::createObjects(), cut(), debugSignalSharing(), decimateAmplitude(), exportTable(), MonoStation::CategoryGroupItem::flags(), geopsyToFile(), importTable(), StationCoordinates::init(), ToolRefra::initStations(), ToolLinearFKActive::initStations(), isHeaderModified(), GeopsyCore::SignalDB::isModified(), isReadOnlySamples(), maximumTimePickCount(), GeopsyCore::StationSignals::maxTime(), merge(), mergeStations(), GeopsyCore::StationSignals::minTime(), multiply(), GeopsyCore::StationGroup::name(), operator=(), ShotRecord::organizeSubPool(), MonoStation::SpectrumStationSignals::organizeSubPool(), pickCoppens(), pickMinMax(), receivers(), GeopsyCore::SignalDB::removeFile(), rotateComponents(), samplesCount(), save(), saveGeopsySignal(), GeopsyCore::SignalProcess::setHeaderCore(), setHeaderModified(), GeopsyCore::StationProcessSignals::setHighPassFilter(), GeopsyCore::StationSignals::setKeep(), GeopsyMainWindow::setReceivers(), GeopsyCore::StationSignals::setSampling(), MonoStation::CategoryGroupItem::setSignals(), GeopsyMainWindow::setSources(), ToolArrayBase::setTimeWindowLayer(), GeopsyCore::SignalDB::signal(), sources(), stalta(), GeopsyCore::TemporarySignalsGroup::subPool(), GeopsyGui::SignalLayer::subPoolUpdate(), SubSignalPool(), GeopsyCore::SubSignalPoolProcess::SubSignalPoolProcess(), subtractSignal(), subtractValue(), taper(), GeopsyCore::StationSignals::timeRange(), timeRange(), unglitch(), GeopsyGui::SignalLayer::updateGrid(), PtMotionResults::updateSignals(), GeopsyCore::SignalDB::xml_polish(), GeopsyCore::SignalFile::xml_writeChildren(), GeopsyCore::SignalGroup::xml_writeProperties(), and GeopsyCore::SignalDB::~SignalDB().
{return QList<Signal *>::begin();}
const_iterator GeopsyCore::SubSignalPool::begin | ( | ) | const [inline] |
{return QList<Signal *>::begin();}
References TRACE.
{ TRACE; int ndrays=0; /* TODO: not usefull if tomography is not included in geopsy to be revised in a more object oriented form (e.g. DupRay witch all necessary search properties PointList sources,receivers; SubSignalPool sigs(_pool,(bool)false); int index; for(iterator it=begin(); it!=end(); ++it) { Signal * sig=* it; delete sig->duplicateRaysPool(); sig->duplicateRaysPool(NULL); sig->duplicateRaysID(-1); // Look for a source corresponding to this one index=sources.indexOf(sig->source()); // For this source, look for a matching receiver while(index>-1 && receivers.at(index)!=sig->receiver()) index=sources.findNext(&sig->source()); if(index==-1) { // Look for a source corresponding to this receiver index=sources.find (&sig->receiver()); // For this source, look for a matching receiver while(index >-1 && *(receivers.at(index))!=sig->source()) index=sources.findNext(&sig->receiver()); } if(index==-1) { sources.append(&sig->source()); receivers.append(&sig->receiver()); sigs.append(sig); } else { Signal * otherSig=sigs.at(index); SubSignalPool* dupPool=otherSig->duplicateRaysPool(); if(dupPool==NULL) { ndrays++; // Set duplicate for the other signal dupPool=new SubSignalPool(_pool,(bool)false); otherSig->duplicateRaysPool(dupPool); dupPool->append(sig); otherSig->duplicateRaysID(ndrays); // Set Duplicate for signal i SubSignalPool* tmpPool=new SubSignalPool(_pool,(bool)false); sig->duplicateRaysPool(tmpPool); tmpPool->append(otherSig); sig->duplicateRaysID(ndrays); } else { SubSignalPool* tmpPool=new SubSignalPool(_pool,(bool)false); tmpPool->append(otherSig); SubSignalPoolIterator itDup(*dupPool); for(Signal * dupSig=itDup.current();dupSig;dupSig=++itDup) { dupSig->duplicateRaysPool()->append(sig); tmpPool->append(dupSig); } dupPool->append(sig); sig->duplicateRaysID(otherSig->duplicateRaysID()); sig->duplicateRaysPool(tmpPool); } } }*/ return ndrays; }
bool GeopsyCore::SubSignalPool::contains | ( | const Signal * | sig | ) | const [inline] |
References contains().
{return QList<Signal *>::contains(const_cast<Signal *>(sig));}
void GeopsyCore::SubSignalPool::convolution | ( | const Signal * | referenceSig | ) |
Computes convolution product with respect to referenceSig
References _name, addSignal(), at(), GeopsyCore::DoubleSignal::convolution(), count(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, setName(), GeopsyCore::Signal::setTemporary(), and TRACE.
Referenced by GeopsyCore::SignalProcess::convolutionCore().
{ TRACE; SubSignalPool convSubPool; convSubPool.setName(_name); int n=count(); for(int i=0; i< n; i++) { Signal * sig=at(i); if(sig!=referenceSig) { Signal * convSig=new Signal(geopsyCore->currentDB()); convSig->setTemporary(); convSig->convolution(referenceSig, sig); convSubPool.addSignal(convSig); } } *this=convSubPool; }
SubSignalPool GeopsyCore::SubSignalPool::copy | ( | ) | const |
References _name, addSignal(), begin(), GeopsyCore::Signal::copySamplesFrom(), end(), and TRACE.
Referenced by Station::filter1(), Station::filter2(), and GeopsyCore::SignalProcess::saveStepCore().
{ TRACE; SubSignalPool c; c._name=_name; for(const_iterator it=begin(); it!=end(); ++it) { Signal * sig=new Signal( **it); sig->copySamplesFrom( *it); c.addSignal(sig); } return c; }
void GeopsyCore::SubSignalPool::correlations | ( | double | maxDelay, |
const Signal * | referenceSig = 0 |
||
) |
Computes all possible correlations from this subpool if referenceSig is null.
The correlation is computed with a maximum delay of delay.
References _name, addSignal(), at(), GeopsyCore::Signal::correlation(), count(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, setName(), GeopsyCore::Signal::setTemporary(), and TRACE.
Referenced by GeopsyCore::SignalProcess::correlationsCore().
{ TRACE; SubSignalPool corrSubPool; corrSubPool.setName(_name); int n=count(); if(referenceSig) { for(int i=0; i< n; i++ ) { Signal * sig=at(i); if(sig!=referenceSig) { Signal * corrSig=new Signal(geopsyCore->currentDB()); corrSig->setTemporary(); corrSig->correlation(referenceSig, sig, maxDelay); corrSubPool.addSignal(corrSig); } } } else { for(int i=0; i< n-1; i++ ) { Signal * sig=at(i); for(int j=i+1; j< n; j++) { Signal * corrSig=new Signal(geopsyCore->currentDB()); corrSig->setTemporary(); corrSig->correlation(sig, at(j), maxDelay); corrSubPool.addSignal(corrSig); } } } *this=corrSubPool; }
int GeopsyCore::SubSignalPool::count | ( | ) | const [inline] |
Reimplemented in GeopsyCore::SignalDB.
Referenced by GeopsyGui::SubPoolWindow::addSignal(), StructureStationSignals::addSignals(), agc(), associate3Components(), azimuth(), convolution(), GeopsyCore::StationProcessSignals::copyOriginalSignal(), correlations(), GeopsyCore::SignalDB::count(), GeopsyMainWindow::createNewGroup(), PtMotionResults::createObjects(), TFAResults::createObjects(), DampingResults::createObjects(), GeopsyGui::SignalGroupItem::data(), decimateTime(), discreteFourierTransform(), GeopsyGui::SignalLayer::drawingAmplitude(), GeopsyGui::SignalLayer::drawSignal(), GeopsyGui::ChronogramLayer::exportGaps(), fastFourierTransform(), filter(), geopsyToFile(), SignalTableView::getSelection(), MapWindow::getSelection(), SignalTableItem::index(), ManualPick::init(), ToolStructure::initStations(), ToolLinearFKActive::initStations(), ToolNR::initStations(), ShotRecord::isSameReceiverSet(), GeopsyGui::PickLayer::keyPressEvent(), linearSearch(), GeopsyCore::SignalFile::loadGeopsySignal(), GeopsyGui::SignalLayer::maxAmplitude(), GeopsyGui::SignalLayer::minMaxY(), normalizedCorrelations(), ShotRecord::nReceivers(), operator==(), StructureStationSignals::organizeSubPool(), overSample(), GeopsyGui::PickLayer::paintData(), GeopsyGui::ChronogramLayer::rangeUpdate(), ShotRecord::receiverIndex(), remove(), SignalTableItem::rowCount(), Process::run(), GeopsyCore::SignalFile::save(), save(), saveGeopsySignal(), GeopsyGui::ChronogramLayer::selection(), MonoStation::AbstractTool::setCurrentDisplayStation(), SignalTableItem::setData(), GeopsyCore::StationProcessSignals::setHighPassFilter(), GeopsyGui::SignalLayer::setIsigMinMax(), MagnifierSignal::setSignal(), SignalViewer::setSignals(), ShotRecord::setSignals(), Convolution::setSubPool(), Correlations::setSubPool(), SubtractSignals::setSubPool(), shift(), GeopsyGui::SignalLayer::signalAt(), GeopsyCore::SignalProcess::signalCountCore(), GeopsyCore::SignalHeaderScript::SignalHeaderScript(), GraphicWindow::signalsUpdate(), StackWeights::stack(), ToolTFA::start(), stddevClip(), GeopsyGui::SignalLayer::subPoolUpdate(), subtractSignals(), GeopsyGui::SignalLayer::updateGrid(), GraphicWindow::updateLabels(), PtMotionResults::updateSignals(), waveletTransform(), whiten(), GeopsyCore::SignalFile::xml_polish(), GeopsyGui::TimeWindowLayer::xml_writeChildren(), and GeopsyCore::XMLSubSignalPool::XMLSubSignalPool().
{return QList<Signal *>::count();}
void GeopsyCore::SubSignalPool::cut | ( | const TimeRangeParameters & | param | ) |
Cut signals according to param time limits.
References _name, GeopsyCore::TimeRangeParameters::absoluteRange(), addSignal(), begin(), GeopsyCore::Signal::cut(), end(), fastFourierTransform(), setName(), TRACE, and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::cutCore().
{ TRACE; SubSignalPool cuttedSignals; cuttedSignals.setName(_name); // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); for(iterator it=begin(); it!=end(); ++it) { Signal * sig=*it; Signal * newSig=sig->cut(param.absoluteRange(sig)); if(newSig) { cuttedSignals.addSignal(newSig); } } *this=cuttedSignals; }
void GeopsyCore::SubSignalPool::decimateAmplitude | ( | int | maxCount, |
double | maxRef | ||
) |
Decimate signals along amplitude scale. maxCount is the maximum number of discretization steps. maxRef is the amplitude value corresponding to maxCount. If maxRef is negative, the maximum of the signal is taken as a reference.
References begin(), GeopsyCore::DoubleSignal::decimateAmplitude(), end(), GeopsyCore::Signal::maximumAmplitude(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by GeopsyCore::SignalProcess::decimateAmplitudeCore().
{ TRACE; if(maxRef < 0.0) { double invMaxCount=1.0/(double) maxCount; for(iterator it=begin(); it!=end(); ++it) { Signal& sig=** it; if(!sig.warnReadOnlySamples()) { sig.decimateAmplitude(sig.maximumAmplitude() * invMaxCount); } } } else { double delta=maxRef/maxCount; for(iterator it=begin(); it!=end(); ++it) { Signal& sig=** it; if(!sig.warnReadOnlySamples()) { sig.decimateAmplitude(delta); } } } }
void GeopsyCore::SubSignalPool::decimateTime | ( | int | factor | ) |
Decimate signals along time scale.
References _name, addSignal(), at(), count(), GeopsyCore::DoubleSignal::decimateTime(), fastFourierTransform(), GeopsyCore::geopsyCore, setName(), GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), TRACE, and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::decimateTimeCore().
{ TRACE; SubSignalPool decimatedSignals; decimatedSignals.setName(_name); // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i<count(); i++ ) { Signal * sig=at(i); geopsyCore->setProgressValue(i); Signal * newsig=new Signal( *sig); newsig->decimateTime(factor, sig); decimatedSignals.addSignal(newsig); } *this=decimatedSignals; }
References _name, at(), count(), GeopsyCore::DoubleSignal::discreteFourierTransform(), fastFourierTransform(), GeopsyCore::geopsyCore, setName(), GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), TRACE, and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::discreteFourierTransformCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); SubSignalPool fftSignals; fftSignals.setName(_name); // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); sig->discreteFourierTransform(); } }
bool GeopsyCore::SubSignalPool::empty | ( | ) | [inline] |
{return QList<Signal *>::empty();}
iterator GeopsyCore::SubSignalPool::end | ( | ) | [inline] |
Referenced by addFile(), addReceiver(), GeopsyCore::StationList::addSignals(), addSource(), GeopsyGui::TimeWindowLayer::addTimeWindows(), availableTimePicks(), azimuth(), MonoStation::CategoryGroupItem::belongsTo(), copy(), cut(), debugSignalSharing(), decimateAmplitude(), exportTable(), MonoStation::CategoryGroupItem::flags(), geopsyToFile(), importTable(), StationCoordinates::init(), ToolRefra::initStations(), ToolLinearFKActive::initStations(), isHeaderModified(), GeopsyCore::SignalDB::isModified(), isReadOnlySamples(), maximumTimePickCount(), GeopsyCore::StationSignals::maxTime(), merge(), mergeStations(), GeopsyCore::StationSignals::minTime(), multiply(), GeopsyCore::StationGroup::name(), operator=(), ShotRecord::organizeSubPool(), MonoStation::SpectrumStationSignals::organizeSubPool(), pickCoppens(), pickMinMax(), receivers(), GeopsyCore::SignalDB::removeFile(), rotateComponents(), samplesCount(), save(), saveGeopsySignal(), GeopsyCore::SignalProcess::setHeaderCore(), setHeaderModified(), GeopsyCore::StationProcessSignals::setHighPassFilter(), GeopsyCore::StationSignals::setKeep(), GeopsyMainWindow::setReceivers(), GeopsyCore::StationSignals::setSampling(), MonoStation::CategoryGroupItem::setSignals(), GeopsyMainWindow::setSources(), ToolArrayBase::setTimeWindowLayer(), GeopsyCore::SignalDB::signal(), MapWindow::signalsUpdate(), sources(), stalta(), GeopsyCore::TemporarySignalsGroup::subPool(), GeopsyGui::SignalLayer::subPoolUpdate(), SubSignalPool(), GeopsyCore::SubSignalPoolProcess::SubSignalPoolProcess(), subtractSignal(), subtractValue(), taper(), GeopsyCore::StationSignals::timeRange(), timeRange(), unglitch(), GeopsyGui::SignalLayer::updateGrid(), GraphicWindow::updateLabels(), GeopsyCore::SignalDB::xml_polish(), GeopsyCore::SignalFile::xml_writeChildren(), GeopsyCore::SignalGroup::xml_writeProperties(), and GeopsyCore::SignalDB::~SignalDB().
{return QList<Signal *>::end();}
const_iterator GeopsyCore::SubSignalPool::end | ( | ) | const [inline] |
{return QList<Signal *>::end();}
void GeopsyCore::SubSignalPool::exportTable | ( | QString | fileName, |
const MetaDataFieldList & | param | ||
) |
References GeopsyCore::MetaDataFieldList::begin(), begin(), GeopsyCore::MetaDataFactory::Duration, GeopsyCore::MetaDataFieldList::end(), end(), QGpCoreTools::endl(), GeopsyCore::MetaDataFactory::EndTime, GeopsyCore::Signal::header(), GeopsyCore::MetaDataFactory::instance(), MSG_ID, GeopsyCore::MetaDataFactory::name(), str, GeopsyCore::MetaDataFactory::T0, QGpCoreTools::tr(), and TRACE.
Referenced by TableWindow::exportTable().
{ TRACE; QFile f(fileName); if(!f.open(QIODevice::WriteOnly)) { Message::warning(MSG_ID, tr( "Exporting table ..." ), tr( "Unable to save file" ), Message::cancel()); return; } QString str; QTextStream s(&f); s << tr("# This file contains all the variables that were listed in Geopsy's Table\n" "# You can edit this file as you want.\n" "# All columns must be separated by only one tabulation.\n" "# Lines starting with '#' are always ignored when importing.\n" "# The first line starting without '#' must contains the name of each variable.\n" "#\n"); MetaDataFieldList::const_iterator itvar; for(itvar=param.begin();itvar!=param.end();++itvar) { s << MetaDataFactory::instance()->name(*itvar) << "\t"; } s << endl; for(iterator it=begin(); it!=end(); ++it) { Signal * sig=*it; for (itvar=param.begin(); itvar!=param.end(); ++itvar) { switch (itvar->id()) { case MetaDataFactory::T0: case MetaDataFactory::EndTime: case MetaDataFactory::Duration: str=Number::secondsToTime(sig->header(*itvar).toDouble()); break; default: str=sig->header(*itvar).toString(); break; } s << str << "\t"; } s << endl; } }
References at(), count(), GeopsyCore::DoubleSignal::fastFourierTransform(), GeopsyCore::geopsyCore, GeopsyCore::Signal::resetAmplitudes(), GeopsyCore::Signal::setHeaderModified(), GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), and TRACE.
Referenced by cut(), decimateTime(), discreteFourierTransform(), ChronogramWindow::fastFourierTransform(), MapWindow::fastFourierTransform(), GraphicWindow::fastFourierTransform(), TableWindow::fastFourierTransform(), GeopsyCore::SignalProcess::fastFourierTransformCore(), merge(), stalta(), subtractSignal(), and subtractSignals().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); sig->fastFourierTransform(st); sig->resetAmplitudes(); sig->setHeaderModified(true); } }
void GeopsyCore::SubSignalPool::filter | ( | const FilterParameters & | param | ) |
References at(), count(), GeopsyCore::DoubleSignal::filter(), GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by Station::filter1(), Station::filter2(), and GeopsyCore::SignalProcess::filterCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); if(!sig->warnReadOnlySamples()) { sig->filter(param); } } }
Signal* GeopsyCore::SubSignalPool::first | ( | ) | const [inline] |
Referenced by ShotRecord::deltaT(), GeopsyGui::ChronogramLayer::exportGaps(), GeopsyCore::StationSignals::firstValidSignal(), GeopsyCore::SignalProcess::headerCore(), merge(), mergeStations(), GeopsyGui::SignalLayer::minMaxY(), ShotRecord::nSamples(), GeopsyGui::SignalLayer::properties(), MonoStation::AbstractTool::refreshSignal(), Process::run(), GeopsyGui::TimeRangeParameterWidget::setPicks(), SignalViewer::setSignals(), ShotRecord::t0(), and ManualPick::~ManualPick().
{return QList<Signal *>::first();}
void GeopsyCore::SubSignalPool::importTable | ( | QString | fileName | ) |
References GeopsyCore::MetaDataFieldList::add(), GeopsyCore::MetaDataFieldList::begin(), begin(), GeopsyCore::MetaDataFactory::DeltaT, GeopsyCore::MetaDataFieldList::end(), end(), GeopsyCore::MetaDataIndex::id(), GeopsyCore::MetaDataFactory::index(), GeopsyCore::MetaDataFactory::instance(), GeopsyCore::MetaDataIndex::isValid(), QGpCoreTools::StringSection::isValid(), MSG_ID, QGpCoreTools::StringSection::nextField(), QGpCoreTools::StringSection::set(), GeopsyCore::Signal::setHeader(), GeopsyCore::Signal::setHeaderModified(), str, QGpCoreTools::StringSection::toString(), QGpCoreTools::tr(), and TRACE.
Referenced by TableWindow::importTable().
{ TRACE; QFile f(fileName); if( !f.open(QIODevice::ReadOnly) ) { Message::warning(MSG_ID, tr( "Importing Table ..." ), tr("Unable to open file %1").arg(fileName), Message::cancel()); return ; } QString str; // Get the list of variable (IDs) QTextStream s(&f); str=s.readLine().trimmed(); while(str[ 0 ]=='#' ) { str=s.readLine().trimmed(); // comment line } MetaDataFieldList varList; MetaDataIndex varItem; StringSection strItem; StringSection strLine(str); const QChar * ptr=0; strItem=strLine.nextField(ptr, "\t" ); bool doDeltaT=false; while(strItem.isValid()) { varItem=MetaDataFactory::instance()->index(strItem.toString()); if(!varItem.isValid()) { Message::warning(MSG_ID, tr("Importing Table ..."), tr("Unrecognized meta data: '%1'").arg(strItem.toString()), Message::cancel()); return; } if(varItem.id()==MetaDataFactory::DeltaT) { switch (Message::warning(MSG_ID, tr( "Importing table ..." ), tr( "You are about to modify the DeltaT of your signals. " "This action may alter their time scale. " "Do you want to proceed?\n\n" "- If you answer 'No'', all the other variables will be imported as usual.\n" "- If you answer 'Cancel', nothing will be imported." ), Message::yes(), Message::no(), Message::cancel()) ) { case Message::Answer0: doDeltaT=true; break; case Message::Answer1: doDeltaT=false; break; default: return ; } } varList.add(varItem); strItem=strLine.nextField(ptr, "\t" ); } // Get the values for(iterator it=begin(); it!=end() && !s.atEnd(); ++it) { Signal * sig=* it; str=s.readLine().trimmed(); while(str[ 0 ]=='#' ) { str=s.readLine().trimmed(); // comment line } ptr=0; strLine.set(str.data(), str.size()); strItem=strLine.nextField(ptr, "\t" ); for(MetaDataFieldList::iterator itvar=varList.begin();itvar!=varList.end();++itvar) { if(itvar->id()!=MetaDataFactory::DeltaT || doDeltaT) { sig->setHeader(*itvar, strItem.toString()); } strItem=strLine.nextField(ptr, "\t" ); } sig->setHeaderModified(true); } }
int GeopsyCore::SubSignalPool::indexOf | ( | const Signal * | sig | ) | const [inline] |
Referenced by insertSignal(), SignalTableView::refresh(), GeopsyGui::SubPoolWindow::refreshSignal(), remove(), GeopsyCore::SignalGroup::removeSignal(), MagnifierSignal::setSignal(), GeopsyCore::SignalDB::signalDeleted(), and GeopsyGui::SignalLayer::xml_writeProperties().
{return QList<Signal *>::indexOf(const_cast<Signal *>(sig));}
void GeopsyCore::SubSignalPool::insertSignal | ( | Signal * | sig, |
Signal * | refSig = 0 , |
||
bool | before = true |
||
) |
References QGpCoreTools::SharedObject::addReference(), indexOf(), and TRACE.
Referenced by StructureStationSignals::organizeSubPool().
bool GeopsyCore::SubSignalPool::isEmpty | ( | ) | const [inline] |
Referenced by GeopsyGui::SubPoolWindow::addSignals(), associate3Components(), GeopsyGui::SignalLayer::boundingRect(), GeopsyMainWindow::createNewGroup(), GeopsyGui::ChronogramLayer::exportGaps(), MapWindow::getSelection(), ChronogramWindow::getSelection(), ToolLinearFKActive::initStations(), GeopsyCore::GeopsyCoreEngine::load(), loadSignals(), merge(), mergeStations(), modeExport(), modeTool(), modeWaveform(), ToolNR::newGraphicViewer(), GeopsyGui::CityLoader::on_loadBut_clicked(), operator=(), ToolNR::optimizeStack(), GeopsyGui::SignalLayer::properties(), removeAll(), GeopsyGui::TimeRangeParameterWidget::setPicks(), ToolNR::uniformStack(), GeopsyGui::SignalLayer::updateGrid(), and ChronogramWindow::updateLabels().
{return QList<Signal *>::isEmpty();}
static bool GeopsyCore::SubSignalPool::isExportFormat | ( | const SignalFileFormat & | f | ) | [static] |
bool GeopsyCore::SubSignalPool::isHeaderModified | ( | ) | const |
References begin(), end(), and TRACE.
Referenced by GeopsyCore::SignalDB::isModified().
{ TRACE; for(const_iterator it=begin(); it!=end(); ++it) { if((*it)->isHeaderModified()) return true; } return false; }
bool GeopsyCore::SubSignalPool::isReadOnlySamples | ( | ) | const |
References begin(), end(), and TRACE.
Referenced by GeopsyMainWindow::activeWindowChanged().
{ TRACE; for(const_iterator it=begin(); it!=end(); ++it) { if(( *it) ->isReadOnlySamples()) return true; } return false; }
Signal* GeopsyCore::SubSignalPool::last | ( | ) | const [inline] |
Referenced by GeopsyCore::StationSignals::lastValidSignal(), and removeAll().
{return QList<Signal *>::last();}
int GeopsyCore::SubSignalPool::linearSearch | ( | const Point & | source, |
const Point & | receiver | ||
) |
References at(), count(), GeopsyCore::Signal::receiver(), GeopsyCore::Signal::source(), and TRACE.
int GeopsyCore::SubSignalPool::maximumTimePickCount | ( | ) | const |
References begin(), end(), and TRACE.
Referenced by GeopsyMainWindow::exportSignal(), and ToolRefra::initStations().
{ TRACE; int n=0; for(const_iterator it=begin(); it!=end(); ++it) { int t=(*it)->timePickCount(); if(t>n) n=t; } return n; }
bool GeopsyCore::SubSignalPool::merge | ( | ) |
Merge all traces of the subpool into a single trace
References addSignal(), begin(), CONST_LOCK_SAMPLES, database, GeopsyCore::DoubleSignal::deltaT(), end(), fastFourierTransform(), first(), isEmpty(), MSG_ID, name(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), removeAll(), GeopsyCore::DynamicSignal::set(), GeopsyCore::Signal::setComponent(), GeopsyCore::Signal::setDeltaT(), GeopsyCore::Signal::setName(), GeopsyCore::Signal::setT0(), GeopsyCore::Signal::setTimeReference(), GeopsyCore::TimeRange::start(), GeopsyCore::Signal::t0(), timeRange(), QGpCoreTools::tr(), TRACE, GeopsyCore::DoubleSignal::type(), UNLOCK_SAMPLES, and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::mergeCore(), and mergeStations().
{ TRACE; if(isEmpty()) return false; // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); iterator it; Signal * sig; for(it=begin(); it!=end(); ++it) { sig=* it; if(sig->type()!=Signal::Waveform) { Message::warning(MSG_ID, tr( "Merging signals ..." ), tr( "Some signals are not waveforms" ), Message::cancel(), true); return false; } } // Get the min and max time TimeRange r=timeRange(); // Check if they have the same sampling frequency it=begin(); sig=* it; double dT=sig->deltaT(); for( ; it!=end(); ++it) { double d_jump=(sig->t0() - r.start())/dT; int i_jump=(int) floor(d_jump + 0.5); if(dT!=sig->deltaT() && fabs(d_jump - (double) i_jump) < 0.001) { Message::warning(MSG_ID, tr( "Merging signals ..." ), tr( "All signals must have the same sampling frequency " "and differences between t0 must be a multiple of dT." ), Message::cancel(), true); return false; } } // Allocate the new signal DynamicSignal * mergedsig=new DynamicSignal(first()->database()); mergedsig->setDeltaT(first()->deltaT()); mergedsig->setName(first()->name()); mergedsig->setComponent(first()->component()); mergedsig->setTimeReference(first()->timeReference()); mergedsig->setT0(first()->t0()); // Copy samples in it for(it=begin(); it!=end(); ++it) { sig=*it; CONST_LOCK_SAMPLES(double, samples, sig) mergedsig->set(sig->t0(), samples, sig->nSamples()); UNLOCK_SAMPLES(sig) } removeAll(); addSignal(mergedsig); return true; }
Merge only signals that have common names, components and that have compatible T0.
References _name, GeopsyCore::SortKey::add(), addSignal(), begin(), GeopsyCore::SortKey::clear(), GeopsyCore::MetaDataFactory::Component, GeopsyCore::Signal::component(), GeopsyCore::DoubleSignal::deltaT(), end(), first(), isEmpty(), merge(), MSG_ID, GeopsyCore::MetaDataFactory::Name, GeopsyCore::Signal::name(), GeopsyCore::Signal::receiver(), removeAll(), SAFE_UNINITIALIZED, setName(), sort(), GeopsyCore::MetaDataFactory::T0, GeopsyCore::Signal::t0(), QGpCoreTools::tr(), TRACE, and GeopsyCore::Signal::Vertical.
Referenced by GeopsyCore::SignalProcess::mergeStationsCore().
{ TRACE; // Sorting SortKey::clear(); SortKey::add(MetaDataFactory::Name); SortKey::add(MetaDataFactory::Component); SortKey::add(MetaDataFactory::T0); sort(); SubSignalPool toMerge; SubSignalPool merged; merged.setName(_name); double deltaT=0; Signal::Components comp; SAFE_UNINITIALIZED(comp, Signal::Vertical); QString stat; Point rec; for(iterator it=begin(); it!=end(); ) { Signal * sig=* it; if(deltaT==0) { deltaT=sig->deltaT(); stat=sig->name(); rec=sig->receiver(); comp=sig->component(); toMerge.addSignal(sig); ++it; continue; } if(sig->name()==stat && sig->receiver()==rec && sig->component()==comp) { if(sig->deltaT()!=deltaT) { Message::warning(MSG_ID, tr( "Merging station components" ), tr( "For station %1, the sampling rate is not the " "same for all parts, skiping %2 part." ) .arg(stat).arg(Number::secondsToTime(sig->t0(), Number::Weeks, 3) ), Message::cancel(), true); return false; } else { toMerge.addSignal(sig); } ++it; } else { if( ! toMerge.merge()) return false; merged.addSignal(toMerge.first()); toMerge.removeAll(); deltaT=0; } } if( !toMerge.isEmpty()) { if( ! toMerge.merge()) return false; merged.addSignal(toMerge.first()); } *this=merged; return true; }
void GeopsyCore::SubSignalPool::multiply | ( | double | value | ) |
References begin(), end(), GeopsyCore::SignalTemplate< sampleType >::multiply(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by GeopsyCore::SignalProcess::multiplyCore().
const QString& GeopsyCore::SubSignalPool::name | ( | ) | const [inline] |
Reimplemented in GeopsyCore::SignalDB.
Referenced by GeopsyCore::SignalGroup::addSignals(), addSubPool(), ToolSpectrum::initStations(), ToolHVRotate::initStations(), ToolSpectrumRotate::initStations(), ToolStructure::initStations(), ToolHV::initStations(), ToolArrayBase::initStations(), ToolSPAC::initStations(), ToolNR::initStations(), merge(), GeopsyCore::SignalDB::name(), GeopsyCore::SignalProcess::restoreStepCore(), GeopsyCore::SignalGroup::setSignals(), and ToolTFA::start().
{return _name;}
void GeopsyCore::SubSignalPool::normalizedCorrelations | ( | double | maxDelay, |
const Signal * | referenceSig = 0 |
||
) |
Computes all possible normalized correlations from this subpool if referenceSig is null.
The correlation is computed with a maximum delay of delay.
References _name, addSignal(), at(), count(), GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, GeopsyCore::Signal::normalizedCorrelation(), setName(), GeopsyCore::Signal::setTemporary(), and TRACE.
Referenced by GeopsyCore::SignalProcess::normalizedCorrelationsCore().
{ TRACE; SubSignalPool corrSubPool; corrSubPool.setName(_name); int n=count(); if(referenceSig) { for(int i=0; i< n; i++ ) { Signal * sig=at(i); if(sig!=referenceSig) { Signal * corrSig=new Signal(geopsyCore->currentDB()); corrSig->setTemporary(); corrSig->normalizedCorrelation(referenceSig, sig, maxDelay); corrSubPool.addSignal(corrSig); } } } else { for(int i=0; i< n-1; i++ ) { Signal * sig=at(i); for(int j=i+1; j< n; j++) { Signal * corrSig=new Signal(geopsyCore->currentDB()); corrSig->setTemporary(); corrSig->normalizedCorrelation(sig, at(j), maxDelay); corrSubPool.addSignal(corrSig); } } } *this=corrSubPool; }
bool GeopsyCore::SubSignalPool::operator!= | ( | const SubSignalPool & | o | ) | const [inline] |
{return !operator==(o);}
SubSignalPool & GeopsyCore::SubSignalPool::operator= | ( | const SubSignalPool & | o | ) |
bool GeopsyCore::SubSignalPool::operator== | ( | const SubSignalPool & | o | ) | const |
void GeopsyCore::SubSignalPool::overSample | ( | double | factor | ) |
References _name, addSignal(), at(), count(), GeopsyCore::geopsyCore, GeopsyCore::DoubleSignal::overSample(), setName(), GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), and TRACE.
Referenced by GeopsyCore::SignalProcess::overSampleCore().
{ TRACE; SubSignalPool sampledSignals; sampledSignals.setName(_name); geopsyCore->setProgressMaximum(count() - 1); geopsyCore->setProgressValue(0); for(int i=0; i < count(); ++i) { Signal * sig=at(i); Signal * newsig=new Signal( *sig); newsig->overSample(factor, sig); sampledSignals.addSignal(newsig); geopsyCore->setProgressValue(i); } *this=sampledSignals; }
void GeopsyCore::SubSignalPool::pickCoppens | ( | const QString & | pickName, |
double | delta, | ||
double | tend, | ||
double | tstart = 0. , |
||
bool | relative = false , |
||
double | mute = 0.0 |
||
) |
void GeopsyCore::SubSignalPool::pickMinMax | ( | const QString & | pickNameb, |
double | from, | ||
double | to, | ||
Signal::PickWhat | what | ||
) |
Curve< Point > GeopsyCore::SubSignalPool::receivers | ( | ) | const |
Returns a vector of all receivers.
References QGpCoreTools::Curve< pointType >::append(), begin(), end(), GeopsyCore::Signal::receiver(), and TRACE.
Referenced by GeopsyGui::SignalLayer::subPoolUpdate().
{ TRACE; Curve<Point> l; for(const_iterator it=begin(); it!=end(); ++it) { Signal * sig=*it; l.append(sig->receiver()); } return l; }
void GeopsyCore::SubSignalPool::remove | ( | Signal * | sig | ) |
Remove signal pointed by sig
References indexOf(), removeAt(), and QGpCoreTools::SharedObject::removeReference().
Referenced by ToolStructure::initStations(), GeopsyCore::SignalDB::removeSignal(), and Process::run().
{ int index=indexOf(sig); if(index>-1) { QList<Signal *>::removeAt(index); Signal::removeReference(sig); } }
void GeopsyCore::SubSignalPool::remove | ( | Signal::Components | comp | ) |
References at(), GeopsyCore::Signal::component(), count(), removeAt(), and QGpCoreTools::SharedObject::removeReference().
{ int i=0; while(i < int(count()) ) { Signal * sig=at(i); if(sig->component()==comp) { QList<Signal *>::removeAt(i); Signal::removeReference(sig); } else i++; } }
void GeopsyCore::SubSignalPool::removeAll | ( | ) |
Remove all signals
References isEmpty(), last(), QGpCoreTools::SharedObject::removeReference(), and TRACE.
Referenced by ToolLinearFKActive::addArray(), associate3Components(), GeopsyCore::SignalDB::clear(), GeopsyCore::SignalGroup::convertIds(), merge(), mergeStations(), operator=(), Process::run(), save(), and MagnifierSignal::setSignal().
{ TRACE; while( !isEmpty() > 0) { Signal * sig=last(); removeLast(); Signal::removeReference(sig); } }
void GeopsyCore::SubSignalPool::removeAt | ( | int | i | ) |
Remove signal at index i in subpool
References at(), QGpCoreTools::SharedObject::removeReference(), and TRACE.
Referenced by remove(), GeopsyCore::SignalGroup::removeSignal(), and GeopsyCore::SignalDB::signalDeleted().
{ TRACE; Signal * sig=at(i); QList<Signal *>::removeAt(i); Signal::removeReference(sig); }
void GeopsyCore::SubSignalPool::rotateComponents | ( | Matrix3x3 | rotMatrix | ) |
References associate3Components(), begin(), end(), LOCK_SAMPLES, QGpCoreTools::CacheProcess::next(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), QGpCoreTools::Point::set(), TRACE, UNLOCK_SAMPLES, GeopsyCore::Signal::warnReadOnlySamples(), and QGpCoreTools::Point2D::x().
Referenced by GeopsyCore::SignalProcess::rotateComponentsCore().
{ TRACE; if( !associate3Components()) return ; int nSamples; Point p; Signal * sigV, * sigN, * sigE; SubSignalPoolProcess cp(*this); for(iterator it=begin(); it!=end(); ++it) { sigV=* it; nSamples=sigV->nSamples(); LOCK_SAMPLES(double, sampV, sigV) ++it; if(it!=end()) { sigN=* it; LOCK_SAMPLES(double, sampN, sigN) ++it; if(it!=end()) { sigE=* it; LOCK_SAMPLES(double, sampE, sigE) if( !sigV->warnReadOnlySamples() && !sigN->warnReadOnlySamples() && !sigE->warnReadOnlySamples()) { for(int i=0;i < nSamples;i++ ) { p.set(sampE[ i ], sampN[ i ], sampV[ i ] ); p=rotMatrix*p; sampE[ i ]=p.x(); sampN[ i ]=p.y(); sampV[ i ]=p.z(); } } UNLOCK_SAMPLES(sigE) } UNLOCK_SAMPLES(sigN) } UNLOCK_SAMPLES(sigV) cp.next(3); } }
bool GeopsyCore::SubSignalPool::save | ( | QString | filePath, |
bool | useOriginalBaseName, | ||
SignalFileFormat | format, | ||
int | maximumSignalsPerFile = 0 , |
||
const QString & | pickName = QString::null |
||
) | const |
Export subPool signals to file filePAth with format f. If format is SignalFile::Unknown, The format is guessed from the extension of filePath. If useOriginalBaseName is true, filePath is considered as a directory (f is mandatory).
References addSignal(), GeopsyCore::SignalFileFormat::Ascii, GeopsyCore::SignalFileFormat::AsciiOneColumn, begin(), count(), GeopsyCore::SignalFileFormat::Custom, GeopsyCore::SignalFileFormat::customFormat(), end(), QGpCoreTools::endl(), GeopsyCore::SignalFileFormat::fromSuffix(), GeopsyCore::SignalFileFormat::GeopsySignal, GeopsyCore::SignalFileFormat::Gse2, GeopsyCore::SignalFileFormat::id(), GeopsyCore::AbstractFileFormat::isReadOnly(), GeopsyCore::SignalFileFormat::MiniSeed, MSG_ID, GeopsyCore::SignalFileFormat::MultiGse2, removeAll(), GeopsyCore::SignalFileFormat::SacBigEndian, GeopsyCore::SignalFileFormat::SacLittleEndian, GeopsyCore::SignalFileFormat::Saf, GeopsyCore::AbstractFileFormat::save(), saveGeopsySignal(), GeopsyCore::SignalFileFormat::Seg2, GeopsyCore::SignalFileFormat::SegYBigEndian, GeopsyCore::SignalFileFormat::SegYLittleEndian, SIGNALFILEFORMAT_READONLY, GeopsyCore::SignalFileFormat::Single, GeopsyCore::AbstractFileFormat::storage(), GeopsyCore::SignalFileFormat::SuBigEndian, GeopsyCore::SignalFileFormat::SuLittleEndian, GeopsyCore::SignalFileFormat::Tomo, GeopsyCore::SignalFileFormat::toString(), QGpCoreTools::tr(), TRACE, GeopsyCore::SignalFileFormat::Unknown, and GeopsyCore::SignalFileFormat::Wav.
Referenced by GeopsyCore::SignalProcess::exportFileCore(), GeopsyMainWindow::exportSignal(), modeExport(), and Process::run().
{ TRACE; // Split eventually the subpool into various subsubpool of maximumSignalsPerFile signals and save them. if(maximumSignalsPerFile>0) { SubSignalPool subPool; maximumSignalsPerFile--; for(const_iterator it=begin();it!=end();it++) { subPool.addSignal( *it); if(subPool.count()==maximumSignalsPerFile) { if(!save(filePath, useOriginalBaseName, format, 0, pickName)) { return false; } subPool.removeAll(); } } return true; } if(format.id()==SignalFileFormat::Unknown) { if(useOriginalBaseName) { Message::warning(MSG_ID, tr("Exporting signals"), tr("No path given with option 'use original base name'. Cannot guess " "ouput file format from extension."), true); return false; } format=SignalFileFormat::fromSuffix(filePath); if(format.id()==SignalFileFormat::Unknown) { Message::warning(MSG_ID, tr("Exporting signals"), tr("Cannot determine export format from file extension"), true); return false; } } if(useOriginalBaseName) { QFileInfo fi(filePath); if(!fi.exists() || !fi.isDir()) { Message::warning(MSG_ID, tr("Exporting signals"), tr("%1 does not exists or is not a directory (option 'original base name' is on).").arg(filePath), true); return false; } } switch (format.id()) { case SignalFileFormat::Custom: if(!format.customFormat() || format.customFormat()->isReadOnly()) { App::stream() << tr("Format %1 is currently not supported for export.").arg(format.toString()) << endl; return false; } if(format.customFormat()->storage()==SignalFileFormat::Single) { break; } // Else custom format with export capabilities of multiple signal in one file case SignalFileFormat::Seg2: case SignalFileFormat::SuLittleEndian: case SignalFileFormat::SuBigEndian: case SignalFileFormat::SegYLittleEndian: case SignalFileFormat::SegYBigEndian: case SignalFileFormat::Gse2: case SignalFileFormat::MultiGse2: case SignalFileFormat::GeopsySignal: case SignalFileFormat::Tomo: case SignalFileFormat::Ascii: case SignalFileFormat::AsciiOneColumn: case SignalFileFormat::Saf: case SignalFileFormat::Wav: case SignalFileFormat::MiniSeed: // For multi signal formats if(!exportFilePath(filePath, useOriginalBaseName, format)) return false; if(useOriginalBaseName){ QFileInfo fi(filePath); QString newFilePath=File::uniqueName(fi.fileName(), fi.path()); if(newFilePath!=filePath) { if(Message::warning(MSG_ID, tr("Exporting signals"), tr("File %1 already exists, saving to %2?").arg(filePath).arg(newFilePath), Message::yes(), Message::no())==Message::Answer1) { return false; } App::stream() << tr("File %1 already exists, saving to %2").arg(filePath).arg(newFilePath) << endl; filePath=newFilePath; } } break; case SignalFileFormat::SacLittleEndian: case SignalFileFormat::SacBigEndian: break; SIGNALFILEFORMAT_READONLY App::stream() << tr("Format %1 is currently not supported for export.").arg(format.toString()) << endl; return false; } switch (format.id()) { case SignalFileFormat::Seg2: return saveSeg2(filePath); case SignalFileFormat::SuLittleEndian: return saveSu(filePath, QDataStream::LittleEndian); case SignalFileFormat::SuBigEndian: return saveSu(filePath, QDataStream::BigEndian); case SignalFileFormat::SegYLittleEndian: return saveSegY(filePath, QDataStream::LittleEndian); case SignalFileFormat::SegYBigEndian: return saveSegY(filePath, QDataStream::BigEndian); case SignalFileFormat::SacLittleEndian: return saveSac(filePath, useOriginalBaseName, QDataStream::LittleEndian); case SignalFileFormat::SacBigEndian: return saveSac(filePath, useOriginalBaseName, QDataStream::BigEndian); case SignalFileFormat::Gse2: case SignalFileFormat::MultiGse2: return saveGse2(filePath); case SignalFileFormat::GeopsySignal: return saveGeopsySignal(filePath); case SignalFileFormat::Tomo: return saveArrivalTimes(filePath, pickName); case SignalFileFormat::Ascii: if(!format.customFormat()) { return saveAsciiMultiColumns(filePath); } break; case SignalFileFormat::Custom: if(format.customFormat()) { return format.customFormat()->save(*this, filePath); } break; case SignalFileFormat::AsciiOneColumn: return saveAsciiOneColumn(filePath); case SignalFileFormat::Saf: return saveSaf(filePath); case SignalFileFormat::Wav: return saveWav(filePath); case SignalFileFormat::MiniSeed: return saveMiniSeed(filePath); SIGNALFILEFORMAT_READONLY break; } return false; }
bool GeopsyCore::SubSignalPool::saveGeopsySignal | ( | QString | filePath | ) | const |
Save samples in a binary format (double) for quick access. This format is machine dependent. Hence, a magic int and double number is stored at the beginning of the file. If the correct value can be retrieved there very little chance than the internal representation of number is different on this machine and on the machine that generated the file.
Format for current version (2) ------------------------------
Header: char*16 (16) "GeopsySignal " (tag ending with 0) int (4) Magic integer number double (8) Magic float number int (4) version (currently=2) int (4) offset to first data (currently=22+n*4) int (4) nSignals int*nSignals (4*nSignals) nSamples
Format for each signal: double*nSamples (8*...) samples
N samples is stored even if it is not necessary for database reloading. It makes this format a minimum self-contained. This binary file format is generally with a database file (.gpy) with contains the header information with a XML format.
Format for version 1 -------------------- Header: char*10 (10) "DBSignals" (tag) int (4) version (=1) int (4) offset to first data (currently=22+n*12) int (4) nSignals int*nSignals (4*...) nSamples int*nSignals (4*...) conversionFactors
Format for each signal: double*nSamples (8*...) samples
References begin(), CONST_LOCK_SAMPLES, count(), end(), GeopsyCore::GeopsySignalHeader::field, GEOPSYSIGNAL_HEADERSIZE, GEOPSYSIGNAL_MAGICFLOAT, GEOPSYSIGNAL_MAGICINT, GEOPSYSIGNAL_TAG, GEOPSYSIGNAL_VERSION, GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::GeopsySignalHeader::raw, GeopsyCore::DoubleSignal::saveType(), TRACE, UNLOCK_SAMPLES, and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalFile::save(), and save().
{ TRACE; QFile f(filePath); if( !f.open(QIODevice::WriteOnly) ) return false; GeopsySignalHeader h; memcpy(h.field.tag, GEOPSYSIGNAL_TAG, 16); h.field.magicInt=GEOPSYSIGNAL_MAGICINT; h.field.magicFloat=GEOPSYSIGNAL_MAGICFLOAT; h.field.version=GEOPSYSIGNAL_VERSION; h.field.nSignals=count(); h.field.offset=GEOPSYSIGNAL_HEADERSIZE + h.field.nSignals * 4; if(f.write(h.raw, GEOPSYSIGNAL_HEADERSIZE)!=GEOPSYSIGNAL_HEADERSIZE) return false; for(const_iterator it=begin(); it!=end(); ++it) { qint32 nSamples=( *it) ->nSamples(); if(f.write((const char *)&nSamples, 4)!=4) return false; } for(const_iterator it=begin(); it!=end(); ++it) { int nWritten=0; const DoubleSignal * sig=const_cast<const Signal *>(*it)->saveType(Signal::Waveform); CONST_LOCK_SAMPLES(double, sigSamples, sig) nWritten=f.write((const char *)sigSamples, sizeof(double)*sig->nSamples()); UNLOCK_SAMPLES(sig) (*it)->restoreType(sig); if(!sigSamples || nWritten!=(int)sizeof(double)*sig->nSamples()) return false; } return true; }
void GeopsyCore::SubSignalPool::setHeaderModified | ( | bool | b | ) | const |
References begin(), end(), and TRACE.
Referenced by GeopsyCore::SignalDB::save().
{ TRACE; for(const_iterator it=begin(); it!=end(); ++it) { (*it)->setHeaderModified(b); } }
void GeopsyCore::SubSignalPool::setName | ( | const QString & | n | ) | [inline] |
Reimplemented in GeopsyCore::SignalDB.
Referenced by GeopsyCore::SignalGroup::addSignals(), GeopsyCore::SignalGroup::convertIds(), convolution(), correlations(), cut(), decimateTime(), discreteFourierTransform(), Station::filter1(), Station::filter2(), MapWindow::getSelection(), ChronogramWindow::getSelection(), TableWindow::getSelection(), mergeStations(), normalizedCorrelations(), overSample(), Station::raw(), GeopsyCore::SignalProcess::restoreStepCore(), GeopsyCore::SignalGroup::setName(), GeopsyCore::SignalDB::setName(), ShotRecord::setSignals(), GeopsyCore::SignalGroup::setSignals(), stalta(), GeopsySLink::SeedLink::subPool(), GeopsyCore::AllSignalsGroup::subPool(), GeopsyCore::AbstractSignalGroup::subPool(), GeopsyCore::TemporarySignalsGroup::subPool(), GeopsyCore::AllFilesGroup::subPool(), GeopsyCore::TemporaryFilesGroup::subPool(), and GeopsyCore::PermanentFilesGroup::subPool().
{_name=n;}
void GeopsyCore::SubSignalPool::shift | ( | double | dt | ) |
References at(), count(), GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), GeopsyCore::DoubleSignal::shift(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by GeopsyCore::SignalProcess::shiftCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); geopsyCore->setProgressValue(0); for(int i=0; i < count(); ++i) { Signal * sig=at(i); if(!sig->warnReadOnlySamples()) { sig->shift(dt); } geopsyCore->setProgressValue(i); } }
void GeopsyCore::SubSignalPool::sort | ( | ) | [inline] |
References GeopsyCore::SortKey::lessThan().
Referenced by associate3Components(), azimuth(), ToolLinearFKActive::initStations(), mergeStations(), ShotRecord::organizeSubPool(), MonoStation::SpectrumStationSignals::organizeSubPool(), GeopsyCore::StationSignals::organizeSubPool(), and GeopsyMainWindow::sort().
{qSort(begin(), end(), SortKey::lessThan);}
Curve< Point > GeopsyCore::SubSignalPool::sources | ( | ) | const |
Returns a vector of all receivers.
References QGpCoreTools::Curve< pointType >::append(), begin(), end(), GeopsyCore::Signal::source(), and TRACE.
Referenced by ToolRefra::initStations().
{ TRACE; Curve<Point> l; for(const_iterator it=begin(); it!=end(); ++it) { Signal * sig=*it; l.append(sig->source()); } return l; }
void GeopsyCore::SubSignalPool::stalta | ( | double | tsta, |
double | tlta | ||
) |
Computes STA/LTA ratios
References _name, GeopsyCore::DoubleSignal::abs(), addSignal(), begin(), GeopsyCore::DoubleSignal::copySamplesFrom(), end(), fastFourierTransform(), setName(), GeopsyCore::DoubleSignal::stalta(), TRACE, and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::staltaCore().
{ TRACE; SubSignalPool staltaSignals; staltaSignals.setName(_name); // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); for(iterator it=begin(); it!=end(); ++it) { Signal * sig=* it; DoubleSignal * cpsig=new DoubleSignal( *sig); cpsig->copySamplesFrom(sig); cpsig->abs(); Signal * ratiosig=new Signal( *sig); cpsig->stalta(tsta, tlta, ratiosig); delete cpsig; staltaSignals.addSignal(ratiosig); } *this=staltaSignals; }
void GeopsyCore::SubSignalPool::stddevClip | ( | double | factor | ) |
References at(), count(), GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), GeopsyCore::DoubleSignal::stddevClip(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by GeopsyCore::SignalProcess::stddevClipCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); if(!sig->warnReadOnlySamples()) { sig->stddevClip(factor); } } }
void GeopsyCore::SubSignalPool::subtractSignal | ( | Signal * | bysig | ) |
References begin(), GeopsyCore::Signal::constLockSamples(), end(), fastFourierTransform(), QGpCoreTools::CacheProcess::next(), GeopsyCore::SignalTemplate< sampleType >::subtractSignal(), TRACE, GeopsyCore::SignalTemplate< sampleType >::unlockSamples(), GeopsyCore::Signal::warnReadOnlySamples(), and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::subtractSignalCore().
{ TRACE; // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); bool bySigIncludedInSubpool=false; SubSignalPoolProcess cp(*this); bysig->constLockSamples(); for(iterator it=begin(); it!=end(); ++it) { Signal * sig=* it; if(sig!=bysig) { // avoid bysig to zeroed, postponed to the end if( !sig->warnReadOnlySamples()) { sig->subtractSignal(bysig); } } else { bySigIncludedInSubpool=true; } cp.next(); } if(bySigIncludedInSubpool) { // Set it to 0 if(!bysig->warnReadOnlySamples()) { bysig->subtractSignal(bysig); } } bysig->unlockSamples(); }
void GeopsyCore::SubSignalPool::subtractSignals | ( | SubSignalPool * | bySubPool | ) |
References at(), count(), fastFourierTransform(), GeopsyCore::SignalTemplate< sampleType >::subtractSignal(), TRACE, GeopsyCore::Signal::warnReadOnlySamples(), and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::subtractSignalsCore().
{ TRACE; if(count()!=bySubPool->count()) return ; // Make sure all signals are in time series fastFourierTransform(Signal::Waveform); for(int i=0; i < count(); ++i) { Signal * sig=at(i); Signal * bysig=bySubPool->at(i); if(!sig->warnReadOnlySamples()) { sig->subtractSignal(bysig); } } }
void GeopsyCore::SubSignalPool::subtractValue | ( | double | val = 0.0 | ) |
References begin(), end(), GeopsyCore::DoubleSignal::subtractValue(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by Station::filter1(), Station::filter2(), and GeopsyCore::SignalProcess::subtractValueCore().
void GeopsyCore::SubSignalPool::taper | ( | const TimeRangeParameters & | range, |
const TaperParameters & | param | ||
) |
Multiplies signal in in time domain by a window function.
References GeopsyCore::TimeRangeParameters::absoluteRange(), begin(), end(), GeopsyCore::Signal::taper(), TRACE, and GeopsyCore::Signal::warnReadOnlySamples().
Referenced by GeopsyCore::SignalProcess::taperCore().
Find minimum and maximum time over all signal of subPool and returns it as a TimeRange. It handles signals not in Waveform and return the spectrum limits.
References begin(), GeopsyCore::DoubleSignal::deltaF(), GeopsyCore::DoubleSignal::deltaT(), end(), GeopsyCore::DoubleSignal::isComplex(), GeopsyCore::DoubleSignal::isSpectrum(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::Signal::t0(), tmax, tmin, and TRACE.
Referenced by GeopsyGui::SignalLayer::boundingRect(), ManualPick::init(), merge(), GraphicWindow::setLimits(), GeopsyGui::TimeRangeParameterWidget::setPicks(), and GraphicWindow::signalsUpdate().
{ TRACE; double tmin=1e99; double tmax=-1e99; for(const_iterator it=begin(); it!=end(); ++it) { Signal * sig=* it; double tminsig, tmaxsig; if(sig->isSpectrum()) { if(sig->isComplex()) tmaxsig=0.5/sig->deltaT(); else tmaxsig=sig->deltaF() * (double) sig->nSamples(); tminsig=0.1; } else { tminsig=sig->t0(); if(sig->isComplex()) tmaxsig=0.5/sig->deltaF(); else tmaxsig=tminsig + sig->deltaT() * (double) sig->nSamples(); } if(tminsig < tmin) tmin=tminsig; if(tmaxsig > tmax) tmax=tmaxsig; } return TimeRange(tmin,tmax); }
void GeopsyCore::SubSignalPool::unglitch | ( | double | threshold | ) |
References begin(), end(), TRACE, GeopsyCore::DoubleSignal::unglitch(), and GeopsyCore::Signal::warnReadOnlySamples().
void GeopsyCore::SubSignalPool::waveletTransform | ( | const MorletParameters & | param | ) |
References GeopsyCore::ComplexSignal::abs(), at(), count(), GeopsyCore::geopsyCore, GeopsyCore::DoubleSignal::morletWavelet(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), GeopsyCore::DoubleSignal::setType(), TRACE, GeopsyCore::Signal::warnReadOnlySamples(), and GeopsyCore::DoubleSignal::Waveform.
Referenced by GeopsyCore::SignalProcess::waveletTransformCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); if(!sig->warnReadOnlySamples()) { ComplexSignal * sigComp=sig->morletWavelet(param); DoubleSignal * sigAbs=sigComp->abs(); sig->SignalTemplate<double>::copySamplesFrom(sigAbs, 0, 0, sig->nSamples()); sig->setType(Signal::Waveform); delete sigAbs; delete sigComp; } } }
void GeopsyCore::SubSignalPool::whiten | ( | ) |
References at(), count(), GeopsyCore::geopsyCore, GeopsyCore::GeopsyCoreEngine::setProgressMaximum(), GeopsyCore::GeopsyCoreEngine::setProgressValue(), TRACE, GeopsyCore::Signal::warnReadOnlySamples(), and GeopsyCore::DoubleSignal::whiten().
Referenced by GeopsyCore::SignalProcess::whitenCore().
{ TRACE; geopsyCore->setProgressMaximum(count() - 1); for(int i=0; i < count(); ++i) { Signal * sig=at(i); geopsyCore->setProgressValue(i); if(!sig->warnReadOnlySamples()) { sig->whiten(); } } }
QString GeopsyCore::SubSignalPool::_name [protected] |
Referenced by addAll(), addFile(), addSubPool(), convolution(), copy(), correlations(), cut(), decimateTime(), discreteFourierTransform(), mergeStations(), normalizedCorrelations(), GeopsyCore::SignalDB::open(), operator=(), operator==(), overSample(), GeopsyCore::SignalDB::save(), GeopsyCore::SignalDB::saveAs(), and stalta().