Public Member Functions | Static Public Member Functions
StructureStationSignals Class Reference

Brief description of class still missing. More...

#include <StructureStationSignals.h>

Inheritance diagram for StructureStationSignals:
GeopsyCore::StationSignals

List of all members.

Public Member Functions

bool addSignals (const SubSignalPool &subPool, int &iSubPool, QString *log=0)
 StructureStationSignals ()

Static Public Member Functions

static bool organizeSubPool (SubSignalPool *subPool, bool doAverage)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation


Member Function Documentation

bool StructureStationSignals::addSignals ( const SubSignalPool subPool,
int &  iSubPool,
QString *  log = 0 
)

subPool must be organized with organizeSubPool()

iSubPool is the index of first signal to consider. This index is incremented as signals are included in this station. On return it is set to the index of the signal for next station.

If log is different from 0, log messages are output to *log.

References GeopsyCore::StationSignals::_signals, GeopsyCore::SubSignalPool::addSignal(), GeopsyCore::SubSignalPool::at(), GeopsyCore::SubSignalPool::count(), GeopsyCore::DoubleSignal::fastFourierTransform(), GeopsyCore::Signal::id(), MSG_ID, QGpCoreTools::tr(), and TRACE.

Referenced by ToolStructure::initStations().

{
  TRACE;
  for(int iComp=0; iComp<3; iComp++, iSubPool++) {
    if(iSubPool==subPool.count()) {
      Message::warning(MSG_ID, tr("Checking available signals"),
                           tr("Odd number of signal required." ), Message::cancel());
      return false;
    }
    Signal * sig=subPool.at(iSubPool);
    if(log)
      ( *log) += QString( "    signal ID %1 added\n" ).arg(sig->id());
    // Make sure signals are in time
    sig->fastFourierTransform(Signal::Waveform);
    _signals[iComp].addSignal(sig);
  }
  return true;
}
bool StructureStationSignals::organizeSubPool ( SubSignalPool subPool,
bool  doAverage 
) [static]

References GeopsyCore::Signal::add(), GeopsyCore::SubSignalPool::at(), GeopsyCore::SubSignalPool::count(), GeopsyCore::DoubleSignal::deltaT(), GeopsyCore::SubSignalPool::insertSignal(), MSG_ID, GeopsyCore::SignalTemplate< sampleType >::multiply(), GeopsyCore::StationSignals::name(), GeopsyCore::Signal::name(), GeopsyCore::Signal::nameComponent(), GeopsyCore::SignalTemplate< sampleType >::nSamples(), GeopsyCore::SparseTimeRange::range(), GeopsyCore::Signal::setComponent(), GeopsyCore::Signal::setName(), GeopsyCore::SignalTemplate< sampleType >::subtractSignal(), GeopsyCore::Signal::t0(), GeopsyCore::Signal::timeRange(), and TRACE.

Referenced by ToolStructure::initStations().

{
  TRACE;
  // No sorting here signals are processed in order
  int nSignals=subPool->count();
  for(int i=0;i < nSignals;i++ ) {
    Signal * ch1Sig=subPool->at(i);
    ++i;
    if(i < nSignals) {
      Signal * ch2Sig=subPool->at(i);
      if(ch1Sig->t0()!=ch2Sig->t0() || ch1Sig->deltaT()!=ch2Sig->deltaT() ||
            ch1Sig->nSamples()!=ch2Sig->nSamples()) {
        Message::warning(MSG_ID, "Associating pairs of signals",
                              QString( "For channel 1 %1, the sampling rate, the "
                                      "number of samples or the T0 "
                                      "is not the same as for the channel 2, signal %2." )
                              .arg(ch1Sig->name()).arg(ch2Sig->name()),
                              Message::cancel());
        return false;
      }
      Signal * opSig=Signal::newCopy(ch1Sig);
      opSig->setComponent(Signal::UndefinedComponent);
      QString name;
      if(doAverage) {
        opSig->add(ch2Sig, opSig->timeRange().range());
        opSig->multiply(0.5);
        name="(" + ch1Sig->nameComponent() + "+" + ch2Sig->nameComponent() + ")/2";
        opSig->setName(name);
      } else {
        opSig->subtractSignal(ch2Sig);
        name=ch2Sig->nameComponent() + "-" + ch1Sig->nameComponent();
        opSig->setName(name);
      }
      // add them to subpool (automatically visible in window)
      subPool->insertSignal(opSig, ch2Sig, false);
      nSignals++;
      i++; // do not include newly created signal in next pair of signals
    }
  }
  return true;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines