#include <cfftw.hh>
Public Member Functions | |
cfftw (int N, double T) | |
Constructor. | |
~cfftw () | |
void | FFT (cplx *in, cplx *out) |
Transforms from time to frequency using the Physics convention. | |
void | IFFT (cplx *in, cplx *out) |
Transforms from frequency to time using the Physics convention. | |
void | fftshift (cplx *in) |
void | ifftshift (cplx *in) |
void | timewindow (cplx *in, double T_half, double T_001) |
double | freq (int i) |
int | index (int k) |
int | give_N (void) |
bool | is_GEL (void) |
Public Attributes | |
double | T |
T = OptSignal::TimeWindow is in seconds. | |
double | F |
F = OptSignal::FreqWindow is in Hertz. | |
double | delta_f |
delta_f = 1/T = OptSignal::DeltaFreq is in Hertz | |
double | delta_t |
cplx * | work |
Private Attributes | |
int | N |
int | N_half |
fftw_plan | forw |
fftw_plan | backw |
cplx * | shift_work |
int | shift_len1 |
int | shift_len2 |
cfftw::cfftw | ( | int | N_in, | |
double | T_in | |||
) |
Constructor.
Constructor.
N_in | integer size of discrete Fourier transform | |
T_in | Total time window in seconds |
References backw, delta_t, F, forw, N, N_half, NewCplx(), shift_len1, shift_len2, shift_work, T, and work.
cfftw::~cfftw | ( | ) |
References backw, forw, FreeCplx(), shift_work, and work.
Referenced by NoiseCovariance::~NoiseCovariance().
Transforms from time to frequency using the Physics convention.
Transforms from time to frequency using the Physics convention
FreqVector = FFT(TimeVector) := 1/N IFFT_fftw (TimeVector)
where IFFT_fftw is the inverse Fourier transform in FFTW.
Note that cfftw::fftshift() is not called by cfftw::FFT()
in | TimeVector | |
out | FreqVector |
References backw, N, and work.
Referenced by OptAmplifier::AmplifyOptSignalScalarSinTim(), ElecFilter::AnritsuFilter(), ElecFilter::AnritsuFilterPaola(), NoiseCovariance::ComputeColumnPropagator(), electrical_filter(), ElecFilter::ElectricalFilterB4(), ElecFilter::ElectricalFilterB5(), ElecFilter::ElectricalFilterGaussian(), OptSignal::EOM_ElectricalFilterBessel4(), OptSignal::EOM_ElectricalFilterGaussian(), OptSignal::EOM_FilterElecData(), OptSignal::EOM_GeneratePerfectRectBinaryElecData(), OptSignal::EOM_GenerateRaisedCosineBinaryElecData(), OptSignal::EOM_GenerateSmoothedRectBinaryElecDataArctanh(), OptSignal::EOM_GenerateSmoothedRectBinaryElecDataSuperGauss(), OptSignal::EOM_SinusoidallyModulateElecData(), ElecFilter::FilterElecSignal(), MachZehnder::GeneratePerfectRectBinaryElecData(), OptSignal::GenerateSignalStringGaussianOrSech(), OptSignal::GenerateSignalStringGaussianOrSechWithPhaseShift(), OptSignal::GenerateSignalStringRZGaussianPattern(), OptSignal::GenerateSignalStringUsingInputSequence(), MachZehnder::GenerateSinusoidalElecSignal(), OptFiber::GetNumOutPD_Vector(), ElecFilter::IntegrateAndDumpFilter(), OptFiber::PropagateFiberDecoupledNLS(), OptFiber::PropagateFiberScalarNLS(), OptFiber::PropagateFiberScalarNLSWriteData(), Photodetector::Time2Freq(), OptSignal::Time2Freq(), ElecFilter::Time2Freq(), OptSignal::Time2FreqScalar(), SaturableAbsorber::UpdateFreq(), OptFiberLocalError::UpdateFreq(), OptSpectrumAnalyzer::UpdateOSA(), Photodetector::WorkTime2Freq(), and ElecFilter::WriteTimePowerFilter().
void cfftw::fftshift | ( | cplx * | in | ) |
cfftw::fftshift() works like its namesake in MATLAB.
It swaps the upper and lower halves of cplx vector called in. If vector length is odd, first "half" is LARGER than second.
References shift_len1, shift_len2, shift_work, and work.
Referenced by OptAmplifier::AmplifyHomogeneous(), OptAmplifier::ApplyPolynomial(), NoiseCovariance::ComputeReducedSignal(), Photodetector::fftshift(), OptSignal::fftshift(), OptSignal::GetAveragePowerFreqDomainInsideChannel(), OptSignal::GetAveragePowerFreqDomainInsideChannels(), OptSignal::GetDegreeOfPolarization(), OptSpectrumAnalyzer::GetOSAOutputLinear(), OptSpectrumAnalyzer::GetPeakPowerdBm(), OptSignal::GetTotalStokesParametersInBandwidth(), OptSpectrumAnalyzer::GetValleyPowerdBm(), OptSpectrumAnalyzer::OutputOSA(), RamanAmp::PrepareSignalLastRound(), RamanAmp::PrepareSignalStart(), OptAmplifier::PropagateSignalandNoise(), OptSpectrumAnalyzer::UpdateOSA_OLD(), OptSignal::WriteComplexFieldsFreq(), OptAmplifier::WriteFileBiasedNoiseFreq(), NoiseCovariance::WriteFileFreqField(), Photodetector::WriteFileFreqPower(), OptSignal::WriteFileFreqPower(), MachZehnder::WriteFileFreqPower(), OptSignal::WriteFileFreqPowerdBm(), OptSpectrumAnalyzer::WriteFileOutputOSA(), OptSignal::WriteFileWavelengthPower(), ElecFilter::WriteFreqCplxFilter(), OptSignal::WriteFreqPhaseX(), ElecFilter::WriteFreqPowerFilter(), and RamanAmp::WriteSignalNoise().
double cfftw::freq | ( | int | i | ) | [inline] |
Returns frequency in Hertz at index i, in range [-FreqWindow/2,FreqWindow/2 - DeltaFreq]
Referenced by OptAmplifier::AddRippleToGain(), OptAmplifier::AdjustGainFixedTotalOutputPowerVector(), OptAmplifier::AmplifyAlternateOptSignalWithoutNoiseWithPrevioslyComputedGain(), OptAmplifier::AmplifyOptSignalScalar(), OptAmplifier::AmplifyOptSignalScalarSinFreq(), OptAmplifier::AmplifyOptSignalVector(), OptAmplifier::AmplifyOptSignalVectorWithGainProfile(), ElecFilter::AnritsuFilter(), ElecFilter::AnritsuFilterPaola(), OptFiberLocalError::ApplySaturableGainOperator(), NoiseCovariance::ComputeArtificialDispersionCompensationOperator(), OptFiberLocalError::ComputeDispersionOperator(), OptFiberLocalError::ComputeFreqDomainOperator(), ElecFilter::ComputeMatchAndFilter(), OptSignal::ComputeMeanFreqSignal(), OptSignal::ComputeRMSSpectralWidth(), electrical_filter(), ElecFilter::ElectricalFilterB4(), ElecFilter::ElectricalFilterB5(), ElecFilter::ElectricalFilterGaussian(), OptSignal::EOM_ElectricalFilterBessel4(), OptSignal::EOM_ElectricalFilterGaussian(), OptFiberLocalError::FiberAmplifierAddMonteCarloNoise(), ElecFilter::IntegrateAndDumpFilter(), optical_filter(), OptFiber::PropagateFiberCoupledNLS(), OptFiber::PropagateFiberDecoupledNLS(), OptFiber::PropagateFiberScalarNLS(), OptFiber::PropagateFiberScalarNLSWriteData(), OptFiber::PropagateFullNonlinearFiberCoupledNLS(), OptAmplifier::PropagateSignalandNoise(), NoiseCovariance::Propagator(), OptFilter::WriteFreqPowerBandpassFilter(), OptFilter::WriteFreqPowerDemuxLoopFilter(), OptFilter::WriteFreqPowerFabryPerotFilter(), OptFilter::WriteFreqPowerGaussianFilter(), ElecFilter::WriteFreqPowerGaussianFilter(), OptFilter::WriteFreqPowerSantecFilter(), OptFilter::WriteFreqPowerSuperGaussianFilter(), and OptAmplifier::WriteGainProfile().
int cfftw::give_N | ( | void | ) | [inline] |
Referenced by ElecFilter::AnritsuFilter(), ElecFilter::AnritsuFilterPaola(), ElecFilter::ElecFilter(), electrical_filter(), ElecFilter::ElectricalFilterB4(), ElecFilter::ElectricalFilterB5(), ElecFilter::ElectricalFilterGaussian(), OptSignal::EOM_ElectricalFilterBessel4(), OptSignal::EOM_ElectricalFilterGaussian(), ElecFilter::InitElecFilter(), ElecSignalStat::InitElecSignalStat(), Photodetector::InitPhotodetector(), ElecFilter::IntegrateAndDumpFilter(), OptAmplifier::OptAmplifier(), OptFiber::OptFiber(), OptFiberLocalError::OptFiberLocalError(), optical_filter(), RamanAmp::RamanAmp(), SaturableAbsorber::SaturableAbsorber(), Photodetector::SetOptSignal(), ElecFilter::SetPhotodetector(), OptFilter::WriteFreqPowerBandpassFilter(), OptFilter::WriteFreqPowerDemuxLoopFilter(), OptFilter::WriteFreqPowerFabryPerotFilter(), OptFilter::WriteFreqPowerGaussianFilter(), OptFilter::WriteFreqPowerSantecFilter(), OptFilter::WriteFreqPowerSuperGaussianFilter(), and RamanAmp::WriteSignalNoise().
Transforms from frequency to time using the Physics convention.
Transforms from frequency to time using the Physics convention
TimeVector = IFFT(FreqVector) := FFT_fftw (FreqVector)
where FFT_fftw is the Fourier transform in FFTW.
Note that cfftw::fftshift() is not called by cfftw::IFFT()
in | FreqVector | |
out | TimeVector |
Referenced by RamanAmp::AddNoise(), OptAmplifier::AmplifyHomogeneous(), OptAmplifier::AmplifyOptSignalScalar(), OptAmplifier::AmplifyOptSignalScalarSinFreq(), OptAmplifier::AmplifyOptSignalVector(), OptAmplifier::AmplifyOptSignalVectorWithGainProfile(), ElecFilter::AnritsuFilter(), ElecFilter::AnritsuFilterPaola(), NoiseCovariance::ApplyArtificialCentralChannelDemux(), NoiseCovariance::ApplyArtificialDispersionCompensation(), OptAmplifier::ApplyPolynomial(), NoiseCovariance::ComputeReducedSignal(), electrical_filter(), ElecFilter::ElectricalFilterB4(), ElecFilter::ElectricalFilterB5(), ElecFilter::ElectricalFilterGaussian(), OptSignal::EOM_ElectricalFilterBessel4(), OptSignal::EOM_ElectricalFilterGaussian(), Photodetector::Freq2Time(), OptSignal::Freq2Time(), ElecFilter::Freq2Time(), OptSignal::Freq2TimeScalar(), ElecFilter::IntegrateAndDumpFilter(), optical_filter(), NoiseCovariance::Perturb(), RamanAmp::PrepareNextStep(), OptFiber::PropagateFiberDecoupledNLS(), OptFiber::PropagateFiberScalarNLS(), OptFiber::PropagateFiberScalarNLSWriteData(), RamanAmp::PropagateNoise(), RamanAmp::PropagateSignalandNoise(), OptAmplifier::PropagateSignalandNoise(), NoiseCovariance::Propagator(), NoiseCovariance::RestoreChannels(), OptAmplifier::TimeShiftBiasedNoise(), OptSpectrumAnalyzer::UpdateOSA(), SaturableAbsorber::UpdateTime(), OptFiberLocalError::UpdateTime(), and OptAmplifier::WriteFileBiasedNoiseTime().
void cfftw::ifftshift | ( | cplx * | in | ) |
cfftw::ifftshift() works like its namesake in MATLAB.
It swaps the upper and lower halves of cplx vector called in Undoes effect of cfftw::fftshift() If vector length is odd, first "half" SHORTER than second.
References shift_len1, shift_len2, shift_work, and work.
Referenced by RamanAmp::AddNoise(), OptAmplifier::AmplifyHomogeneous(), OptAmplifier::ApplyPolynomial(), NoiseCovariance::ComputeReducedSignal(), OptSignal::GetAveragePowerFreqDomainInsideChannel(), OptSignal::GetAveragePowerFreqDomainInsideChannels(), OptSignal::GetDegreeOfPolarization(), OptSpectrumAnalyzer::GetOSAOutputLinear(), OptSpectrumAnalyzer::GetPeakPowerdBm(), OptSignal::GetTotalStokesParametersInBandwidth(), OptSpectrumAnalyzer::GetValleyPowerdBm(), Photodetector::ifftshift(), OptSignal::ifftshift(), OptSpectrumAnalyzer::OutputOSA(), RamanAmp::PrepareNextStep(), RamanAmp::PrepareSignalLastRound(), RamanAmp::PrepareSignalStart(), RamanAmp::PropagateNoise(), RamanAmp::PropagateSignalandNoise(), OptAmplifier::PropagateSignalandNoise(), ElecFilter::ReadMeasuredFilterData(), OptSpectrumAnalyzer::UpdateOSA_OLD(), OptSignal::WriteComplexFieldsFreq(), OptAmplifier::WriteFileBiasedNoiseFreq(), NoiseCovariance::WriteFileFreqField(), Photodetector::WriteFileFreqPower(), OptSignal::WriteFileFreqPower(), MachZehnder::WriteFileFreqPower(), OptSignal::WriteFileFreqPowerdBm(), OptSpectrumAnalyzer::WriteFileOutputOSA(), OptSignal::WriteFileWavelengthPower(), ElecFilter::WriteFreqCplxFilter(), OptSignal::WriteFreqPhaseX(), ElecFilter::WriteFreqPowerFilter(), and RamanAmp::WriteSignalNoise().
int cfftw::index | ( | int | k | ) | [inline] |
Returns index in range [0, N-1] given input index in range [-N/2, N/2-1]
Referenced by ChiSquareReceiver::ComputeTimeIndependentPartOfFilterMatrix(), and NoiseCovariance::Perturb().
bool cfftw::is_GEL | ( | void | ) | [inline] |
void cfftw::timewindow | ( | cplx * | in, | |
double | T_half, | |||
double | T_001 | |||
) |
fftw_plan cfftw::backw [private] |
double cfftw::delta_f |
delta_f = 1/T = OptSignal::DeltaFreq is in Hertz
Referenced by ElecFilter::ElecFilter(), ElecFilter::InitElecFilter(), ElecSignalStat::InitElecSignalStat(), Photodetector::InitPhotodetector(), OptAmplifier::OptAmplifier(), OptFiber::OptFiber(), OptFiberLocalError::OptFiberLocalError(), RamanAmp::RamanAmp(), Photodetector::SetOptSignal(), ElecFilter::SetPhotodetector(), NoiseCovariance::WriteFileAWGNNoiseFreeSignalAndNoiseSpectralDensity(), and NoiseCovariance::WriteFileNoiseFreeSignalAndCovarianceMatrix().
double cfftw::delta_t |
Referenced by cfftw(), timewindow(), and NoiseCovariance::WriteFileNoiseFreeSignalAndCovarianceMatrix().
double cfftw::F |
F = OptSignal::FreqWindow is in Hertz.
Referenced by cfftw().
fftw_plan cfftw::forw [private] |
int cfftw::N [private] |
Referenced by cfftw(), FFT(), and timewindow().
int cfftw::N_half [private] |
Referenced by cfftw().
int cfftw::shift_len1 [private] |
Referenced by cfftw(), fftshift(), and ifftshift().
int cfftw::shift_len2 [private] |
Referenced by cfftw(), fftshift(), and ifftshift().
cplx* cfftw::shift_work [private] |
Referenced by cfftw(), fftshift(), ifftshift(), and ~cfftw().
double cfftw::T |
T = OptSignal::TimeWindow is in seconds.
Referenced by cfftw(), and timewindow().
Referenced by ElecFilter::AnritsuFilter(), ElecFilter::AnritsuFilterPaola(), cfftw(), electrical_filter(), ElecFilter::ElectricalFilterB4(), ElecFilter::ElectricalFilterB5(), ElecFilter::ElectricalFilterGaussian(), OptSignal::EOM_ElectricalFilterBessel4(), OptSignal::EOM_ElectricalFilterGaussian(), FFT(), fftshift(), IFFT(), ifftshift(), ElecFilter::IntegrateAndDumpFilter(), and ~cfftw().