#include <FKStationSignals.h>
Public Member Functions | |
double | absolutePower (int iComp, int iFreqMin, int iFreqMax, double *taperingFunction) |
FKStationSignals (const StationSignals *originalSignals) | |
Complex & | getShift (int offset) |
Complex & | getShift () |
Complex | getShiftedSignal (int component, int iFreq, int offset) |
Complex | getShiftedSignal (int component, int iFreq) |
Complex | getSignalSpectrum (int component, int iFreq) |
void | initPhaseShifts (int n) |
bool | isSelected () const |
void | select (bool s) |
void | setCurrentShift (double kx, double ky) |
void | setPhaseShift (int index, double kx, double ky) |
virtual void | setProcessed (const TimeRange &tw, AbstractParameters *param) |
void | setRelativeCoordinates (const Point2D &p) |
~FKStationSignals () | |
Protected Attributes | |
Complex | _currentShift |
Point2D | _relativeCoordinates |
bool | _selected |
Complex * | _shift |
ArrayCore::FKStationSignals::FKStationSignals | ( | const StationSignals * | originalSignals | ) |
double ArrayCore::FKStationSignals::absolutePower | ( | int | iComp, |
int | iFreqMin, | ||
int | iFreqMax, | ||
double * | taperingFunction | ||
) |
Return absolute power convoluted with taperingFunction, samples are supposed to be locked
References GeopsyCore::DoubleSignal::amplitude2(), GeopsyCore::StationProcessSignals::processed(), and GeopsyCore::StationProcessSignals::processedSamples().
Referenced by ArrayCore::FK::absolutePower().
{ double sum=0.0; for(int i=iFreqMin;i<=iFreqMax;i++) { //printf("%i %lg %lg\n",i,_signals[0].processed->reAmplitude(i),_signals[0].processed->imAmplitude(i)); sum+=processed(iComp)->amplitude2(processedSamples(iComp), i) * taperingFunction[i]; } //printf("Individual power: %lg\n",sum*512); return sum; }
Complex& ArrayCore::FKStationSignals::getShift | ( | int | offset | ) | [inline] |
{return _shift[ offset ];}
Complex& ArrayCore::FKStationSignals::getShift | ( | ) | [inline] |
{return _currentShift;}
Complex ArrayCore::FKStationSignals::getShiftedSignal | ( | int | component, |
int | iFreq, | ||
int | offset | ||
) | [inline] |
References _shift, GeopsyCore::StationProcessSignals::processed(), and GeopsyCore::StationProcessSignals::processedSamples().
Referenced by ArrayCore::FKHorizontal::value(), and ArrayCore::FK::value().
{ Complex spec(processed(component)->complex(processedSamples(component), iFreq) ); spec *= _shift[ offset ]; return spec; }
Complex ArrayCore::FKStationSignals::getShiftedSignal | ( | int | component, |
int | iFreq | ||
) | [inline] |
References _currentShift, GeopsyCore::StationProcessSignals::processed(), and GeopsyCore::StationProcessSignals::processedSamples().
{ Complex spec(processed(component)->complex(processedSamples(component), iFreq) ); spec *= _currentShift; return spec; }
Complex ArrayCore::FKStationSignals::getSignalSpectrum | ( | int | component, |
int | iFreq | ||
) | [inline] |
References GeopsyCore::StationProcessSignals::processed(), and GeopsyCore::StationProcessSignals::processedSamples().
Referenced by ArrayCore::HRFK::crossCorrelationMatrix().
{ return Complex(processed(component)->complex(processedSamples(component), iFreq) ); }
void ArrayCore::FKStationSignals::initPhaseShifts | ( | int | n | ) |
bool ArrayCore::FKStationSignals::isSelected | ( | ) | const [inline] |
Referenced by ArrayCore::FK::absolutePower(), LinearFKActiveArrayStations::beginPreprocess(), LinearFKActiveArrayStations::endPreprocess(), ArrayCore::HRFK::HRFK(), ArrayCore::FK::initGrid(), LinearFKActiveArrayStations::lockSamples(), LinearFKActiveArrayStations::normalize(), LinearFKActiveArrayStations::taper(), LinearFKActiveArrayStations::unlockSamples(), ArrayCore::FKHorizontal::value(), and ArrayCore::FK::value().
{return _selected;}
void ArrayCore::FKStationSignals::select | ( | bool | s | ) | [inline] |
{_selected=s;}
void ArrayCore::FKStationSignals::setCurrentShift | ( | double | kx, |
double | ky | ||
) | [inline] |
References _currentShift, _relativeCoordinates, QGpCoreTools::Complex::setUnitExp(), QGpCoreTools::Point2D::x(), and QGpCoreTools::Point2D::y().
Referenced by ArrayCore::FKHorizontal::value(), and ArrayCore::FK::value().
{ _currentShift.setUnitExp(kx * _relativeCoordinates.x() + ky * _relativeCoordinates.y()); }
void ArrayCore::FKStationSignals::setPhaseShift | ( | int | index, |
double | kx, | ||
double | ky | ||
) |
kx and ky defines the propagation vector
References _relativeCoordinates, _shift, QGpCoreTools::Complex::setUnitExp(), QGpCoreTools::Point2D::x(), and QGpCoreTools::Point2D::y().
Referenced by ArrayCore::FK::initGrid().
{ _shift[index].setUnitExp(kx * _relativeCoordinates.x() + ky * _relativeCoordinates.y()); }
void ArrayCore::FKStationSignals::setProcessed | ( | const TimeRange & | tw, |
AbstractParameters * | param | ||
) | [virtual] |
Set processed signals for all components
Implements GeopsyCore::StationProcessSignals.
References GeopsyCore::StationProcessSignals::copyOriginalSignal(), GeopsyCore::DoubleSignal::fastFourierTransform(), GeopsyCore::StationProcessSignals::nComponents(), GeopsyCore::StationProcessSignals::processed(), GeopsyCore::TaperParameters::setAlpha(), GeopsyCore::TaperParameters::setWindow(), GeopsyCore::DoubleSignal::subtractValue(), and GeopsyCore::DoubleSignal::taper().
{ int nComp=nComponents(); for(int iComp=0; iComp<nComp; iComp++) { copyOriginalSignal(iComp, tw); DoubleSignal * sig=processed(iComp); //printf("nStart=%i nSamples=%i\n",nStart,nSamples); sig->subtractValue(); // Set a 10% taper in time domain TaperParameters param; param.setWindow(TaperParameters::Tukey); param.setAlpha(0.2); sig->taper(param); // Enlarge signal for frequency oversampling /*DoubleSignal * sigLarge=new DoubleSignal(sig->nSamples()*2); sigLarge->setDeltaT(sig->deltaT()); sigLarge->setValue(0.0); sigLarge->copySamplesFrom(sig, 0.0, 0.0, winLen); processed(iComp)=sigLarge; delete sig; sig=sigLarge;*/ // Switch to frequency domain sig->fastFourierTransform(DoubleSignal::Spectrum); /*for(int i=0; i<nSamples/2;i++) printf("%lg %lg\n",(double)i*_signals[0].processed->duration(), _signals[0].processed->spectrumAmplitude(i));*/ } }
void ArrayCore::FKStationSignals::setRelativeCoordinates | ( | const Point2D & | p | ) | [inline] |
Referenced by ArrayCore::FKArrayProcess::FKArrayProcess().
{_relativeCoordinates=p;}
Complex ArrayCore::FKStationSignals::_currentShift [protected] |
Referenced by getShiftedSignal(), and setCurrentShift().
Referenced by setCurrentShift(), and setPhaseShift().
bool ArrayCore::FKStationSignals::_selected [protected] |
Referenced by FKStationSignals().
Complex* ArrayCore::FKStationSignals::_shift [protected] |
Referenced by FKStationSignals(), getShiftedSignal(), initPhaseShifts(), setPhaseShift(), and ~FKStationSignals().