Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

ElecFilter Class Reference

#include <ocsElecFilter.hh>

List of all members.

Public Member Functions

 ElecFilter ()
void InitElecFilter (cfftw *fft2, fftPowerMatrices sfftPM2, ElecFilterParam ElecFilter)
 ElecFilter (string InFileName, Photodetector *oPhotodetector2)
 ElecFilter (ElecFilter *oElecFilter2, Photodetector *oPhotodetector2)
 ElecFilter (string InFileName, Photodetector *oPhotodetector2, cplx *MeasuredFilterFreq2, bool ReadMeasuredFilterFlag)
 ElecFilter (string InFileName, cfftw *fft2, fftPowerMatrices sfftPM2)
void FilterElecSignal (void)
void SetPhotodetector (Photodetector *oPhotodetector2)
string GetAnritsuFilterFileName (void)
typeElecFilter GetTypeElecFilter (void)
int GetOrderElecFilter (void)
double GetCenterFreqElecFilter (void)
double GetFreqFWHM_ElecFilter (void)
cplx GetMeasuredFilterFreq (int ii)
void SetFreqFWHM_ElecFilter (double FreqFWHM_ElecFilter2)
void Set_f_3dB_ElecFilter (double f_3dB_ElecFilter2)
double Get_f_3dB_ElecFilter (void)
void WriteFreqPowerGaussianFilter (string OutFileName)
void WriteTimePowerFilter (string OutFileName)
void WriteFreqPowerFilter (string OutFileName)
double ComputeMatchAndFilter (void)
void GetClockRecoveryTime (BitString *oBitString)
void WriteFreqCplxFilter (string OutFileName)
double GetCurrentEquivalentSpectralWidth (void)
void WriteFilterImpulseResponse (string FileNameImpulseResponseTime, string FileNameImpulseResponseFreq)
int GetDebugLevel (void)

Public Attributes

double * AverageCurrentInBit

Private Member Functions

void ElectricalFilterB5 (cplx *my_power_time, cfftw *fft, double omega_0, double fwhm_norm)
void ElectricalFilterB4 (cplx *my_power_time, cfftw *fft, double omega_0, double fwhm_norm)
void ElectricalFilterGaussian (cplx *my_power_time, cfftw *fft, double omega_0, double fwhm_norm)
void IntegrateAndDumpFilter (cplx *my_power_time, cfftw *fft)
 Added by Anshul June'03.
void ElectricalFilterMeasured (void)
void ReadMeasuredFilterData (void)
 Reads in the measured data of an electrical filter.
void ReadMeasuredFilterData (cplx *MeasuredFilterFreq2)
double GetPhase (double Frequency)
void ReadElecPhase (string InFileName)
void ReadElecPhasePaola (string InFileName)
double GetElecGain (double Frequency)
void ReadElecGain (string InFileName)
void AnritsuFilter (cplx *my_power_time, cfftw *fft, double omega_0, double fwhm_norm)
void AnritsuFilterPaola (cplx *my_power_time, cfftw *fft, double omega_0, double fwhm_norm)
double splint (double *xa, double *ya, double *y2a, int n, double x)
void spline (double *x, double *y, int n, double yp1, double ypn, double *y2)
double GaussianSmooth (double *y, int Order, int N)
void IntegrateAndDumpFilter_OLD (void)
 An integrate and dump electric filter as used in Marcuse paper.
void AllocateMemoryForAverageCurrentinBit (void)
double GetAverageCurrentInTimeRange (double LeftTime, double RightTime)
cplx Bessel5 (double omega, double omega_0, double FWHM)
cplx Bessel4 (double omega, double omega_0, double FWHM)
double Gaussian (double omega, double omega_0, double FWHM)
cplx IntegrateAndDump (double freq)
 Added by Anshul.
void Time2Freq (void)
 Converts the ElecFilter's sfftPM data from time to frequency.
void Freq2Time (void)
 Converts the ElecFilter's sfftPM data from frequency to time.

Private Attributes

double * xElecGain
double * yElecGain
double * y2ElecGain
double ElecGainStartFreq
double ElecGainStepFreq
int NumElecGainWidth
string AnritsuFilterFileName
double * xElecPhase
double * yElecPhase
double * y2ElecPhase
double ElecPhaseStartFreq
double ElecPhaseStepFreq
int NumElecPhaseWidth
int RunAnritsuFilter
double GainPeak
double FreqGain3dB
fftPowerMatrices sfftPM
int ObjectInitialized
int qtPoints
double DeltaFreq
double DeltaTime
double FreqWindow
double TimeWindow
double BitLength
double ClockRecoveryTimeForIntegrateAndDump
int StringLength
typeElecFilter TypeElecFilter
 The type of Electric filter.
int OrderElecFilter
double FreqFWHM_ElecFilter
double CenterFreqElecFilter
string MeasuredElecFilterFileName
 Name of the file containing the data for the measured filter.
 Complex array to store frequency data for the Measured Filter.
int DebugLevel

Constructor & Destructor Documentation

ElecFilter::ElecFilter (  ) 

References ObjectInitialized.

ElecFilter::ElecFilter ( string  InFileName,
Photodetector oPhotodetector2 
ElecFilter::ElecFilter ( ElecFilter oElecFilter2,
Photodetector oPhotodetector2 
ElecFilter::ElecFilter ( string  InFileName,
Photodetector oPhotodetector2,
cplx MeasuredFilterFreq2,
bool  ReadMeasuredFilterFlag 
ElecFilter::ElecFilter ( string  InFileName,
cfftw fft2,
fftPowerMatrices  sfftPM2 

Member Function Documentation

void ElecFilter::AllocateMemoryForAverageCurrentinBit ( void   )  [private]

References AverageCurrentInBit, and StringLength.

Referenced by ElecFilter().

void ElecFilter::AnritsuFilter ( cplx my_power_time,
cfftw fft,
double  omega_0,
double  fwhm_norm 
) [private]
void ElecFilter::AnritsuFilterPaola ( cplx my_power_time,
cfftw fft,
double  omega_0,
double  fwhm_norm 
) [private]
cplx ElecFilter::Bessel4 ( double  omega,
double  omega_0,
double  FWHM 
) [private]
Check FWHM for elec filters: Should it be for |H| or |H|^2??

Referenced by ComputeMatchAndFilter(), ElectricalFilterB4(), WriteFreqCplxFilter(), and WriteFreqPowerFilter().

cplx ElecFilter::Bessel5 ( double  omega,
double  omega_0,
double  FWHM 
) [private]
double ElecFilter::ComputeMatchAndFilter ( void   ) 
void ElecFilter::ElectricalFilterB4 ( cplx my_power_time,
cfftw fft,
double  omega_0,
double  fwhm_norm 
) [private]
void ElecFilter::ElectricalFilterB5 ( cplx my_power_time,
cfftw fft,
double  omega_0,
double  fwhm_norm 
) [private]
void ElecFilter::ElectricalFilterGaussian ( cplx my_power_time,
cfftw fft,
double  omega_0,
double  fwhm_norm 
) [private]
void ElecFilter::ElectricalFilterMeasured ( void   )  [private]

This method filters the electrical signal using a measured electrical filter

The filter shape is read in from the file string MeasuredElecFilterFileName using the method ReadMeasuredFilterData.
The filter is applied in the freq domain after which we convert to the time domain,take the real part and update in frequency just to be safe.

References fftPowerMatrices::fPowerSignal, Freq2Time(), MeasuredFilterFreq, qtPoints, sfftPM, Time2Freq(), and fftPowerMatrices::tPowerSignal.

Referenced by FilterElecSignal().

void ElecFilter::FilterElecSignal ( void   ) 

References ANRITSU, AnritsuFilter(), AnritsuFilterPaola(), BESSEL, CenterFreqElecFilter, ElectricalFilterB4(), ElectricalFilterB5(), ElectricalFilterGaussian(), ElectricalFilterMeasured(), cfftw::FFT(), fft, fftPowerMatrices::fPowerSignal, FreqFWHM_ElecFilter, GAUSSIAN, GAUSSIAN_AND_ANRITSU, INTEGRATE_AND_DUMP, IntegrateAndDumpFilter(), MEASURED, ObjectInitialized, OrderElecFilter, sfftPM, fftPowerMatrices::tPowerSignal, and TypeElecFilter.

Referenced by ComputeMatchAndFilter(), ChiSquareReceiver::ComputeTimeIndependentPartOfFilterMatrix(), MachZehnder::FilterBinaryElecData(), GetCurrentEquivalentSpectralWidth(), ElecSignalStat::GetCurrentExtinctionRatio_GaussianStatistics(), ElecSignalStat::GetEnhancementFactor(), ElecSignalStat::GetESNR_GaussianStatistics(), ElecSignalStat::GetESNR_Mark_GaussianStatistics(), ElecSignalStat::GetIntegralForNoiseNoiseVarianceGaussianStatistics(), ElecSignalStat::GetIntegralForSignalNoiseVariance(), ElecSignalStat::GetMeanASE_ASE(), ElecSignalStat::GetMeanNoiseGaussianStatistics(), ElecSignalStat::GetNormalizedEnhancementFactor(), ElecSignalStat::GetNormKcoeff0_GaussianStatistics(), ElecSignalStat::GetNormKcoeff1_GaussianStatistics(), ElecSignalStat::GetNormNumberNoiseModes_GaussianStatistics(), ElecSignalStat::GetQ_FactorFromESNR_GaussianStatistics(), ElecSignalStat::GetQ_FactorGaussianStatisticsFirstPattern(), ElecSignalStat::GetQ_FactorGaussianStatisticsFromBER(), ElecSignalStat::GetQ_FactorGaussianStatisticsWorstPattern(), ElecSignalStat::GetStdDevASE_ASE(), ElecSignalStat::GetStdDevSignal_ASE_BitSlot(), ElecSignalStat::GetStdDevSignal_ASE_TimeIndex(), ElecSignalStat::GetStdDevWorstBit0_GaussianStatistics(), ElecSignalStat::GetStdDevWorstBit1_GaussianStatistics(), ChiSquareReceiver::ReceiveNoiseFreeSignalAndRecoverClock(), ReceiverSubsystem::ReceivePreviouslyDemultiplexedSingleChannnel(), ReceiverSubsystem::ReceiveSignal(), ReceiverSubsystem::ReceiveSignalBackToBack(), ReceiverSubsystem::ReceiveSignalBackToBackCenterFreq(), ReceiverSemiAnalytical::ReceiveSignalBackToBackMonteCarlo(), ReceiverSubsystem::ReceiveSignalCenterFreq(), GaussianReceiver::ReceiveSignalDGD_NoisePartiallyPolarized(), ReceiverSemiAnalytical::ReceiveSignalMonteCarlo(), ReceiverSemiAnalytical::ReceiveSignalSemiAnalytical(), GaussianReceiver::ReceiveSignalUnpolarizedNoise(), GaussianReceiver::RecoverClockAndSetTimeSlices(), WriteFilterImpulseResponse(), and WriteTimePowerFilter().

void ElecFilter::Freq2Time ( void   )  [private]

Converts the ElecFilter's sfftPM data from frequency to time.

References fft, fftPowerMatrices::fPowerSignal, cfftw::IFFT(), sfftPM, and fftPowerMatrices::tPowerSignal.

Referenced by ElectricalFilterMeasured().

double ElecFilter::Gaussian ( double  omega,
double  omega_0,
double  FWHM 
) [private]
double ElecFilter::GaussianSmooth ( double *  y,
int  Order,
int  N 
) [private]

References sq().

Referenced by ReadElecGain(), ReadElecPhase(), and ReadElecPhasePaola().

double ElecFilter::Get_f_3dB_ElecFilter ( void   )  [inline]

References FreqFWHM_ElecFilter.

string ElecFilter::GetAnritsuFilterFileName ( void   )  [inline]

References AnritsuFilterFileName.

Referenced by ElecFilter().

double ElecFilter::GetAverageCurrentInTimeRange ( double  LeftTime,
double  RightTime 
) [private]

Returns the integral of the current in a time interval divided by the width of the time interval

We assume LeftTime >= 0 and RightTime >= LeftTime. LeftTime >= TimeWindow is OK though. If RightTime >= TimeWindow we wrap. We also check that the width of the time window is less than the TimeWindow for the signal.

References DeltaTime, qtPoints, sfftPM, TimeWindow, and fftPowerMatrices::tPowerSignal.

Referenced by IntegrateAndDumpFilter_OLD().

double ElecFilter::GetCenterFreqElecFilter ( void   )  [inline]

References CenterFreqElecFilter.

Referenced by ElecFilter().

void ElecFilter::GetClockRecoveryTime ( BitString oBitString  ) 
double ElecFilter::GetCurrentEquivalentSpectralWidth ( void   ) 
int ElecFilter::GetDebugLevel ( void   )  [inline]

References DebugLevel.

Referenced by ElecFilter().

double ElecFilter::GetElecGain ( double  Frequency  )  [private]
double ElecFilter::GetFreqFWHM_ElecFilter ( void   )  [inline]

References FreqFWHM_ElecFilter.

Referenced by ElecFilter().

cplx ElecFilter::GetMeasuredFilterFreq ( int  ii  )  [inline]

References MeasuredFilterFreq.

Referenced by ElecFilter().

int ElecFilter::GetOrderElecFilter ( void   )  [inline]

References OrderElecFilter.

Referenced by ElecFilter().

double ElecFilter::GetPhase ( double  Frequency  )  [private]
typeElecFilter ElecFilter::GetTypeElecFilter ( void   )  [inline]

References TypeElecFilter.

Referenced by ElecFilter().

void ElecFilter::InitElecFilter ( cfftw fft2,
fftPowerMatrices  sfftPM2,
ElecFilterParam  ElecFilter 
cplx ElecFilter::IntegrateAndDump ( double  freq  )  [private]
void ElecFilter::IntegrateAndDumpFilter ( cplx my_power_time,
cfftw fft 
) [private]

Added by Anshul June'03.

References cfftw::FFT(), cfftw::freq(), cfftw::give_N(), cfftw::IFFT(), IntegrateAndDump(), and cfftw::work.

Referenced by FilterElecSignal().

void ElecFilter::IntegrateAndDumpFilter_OLD ( void   )  [private]

An integrate and dump electric filter as used in Marcuse paper.

This filter replaces the signal by a piecewise constant function whose values are constant in the bit slots. The k-th bit slot is assumed to go from [k*BitWindow, (k+1)*BitWindow]. So we need the channel we are filtering to have its carrier frequency equal to the center frequency of the discretized signal. In a given bit slot the constant value is equal to the average of the current within that bit slot, which is the time integral of the photo-current over the bit slot divided by the length of the bit window. (Here we follow Marcuse JLT Vol 9 No 4 1991, equation (19).

This method also computes the array AverageCurrentinBit of length StringLength which stores the constant average currents

We need qtPoints = integer * StringLength

We assume that the width of the recangular optical filter is equal to the FreqWindow of the signal. This is OK as long as there are no non-linear effects and as long as there is only one channel and the optical filter is not too narrow. You could always write your own recangular optical filter in the class OptFilter if these assumptions are not satisfied in your application.

References AverageCurrentInBit, GetAverageCurrentInTimeRange(), qtPoints, sfftPM, StringLength, Time2Freq(), and fftPowerMatrices::tPowerSignal.

void ElecFilter::ReadElecGain ( string  InFileName  )  [private]
void ElecFilter::ReadElecPhase ( string  InFileName  )  [private]
void ElecFilter::ReadElecPhasePaola ( string  InFileName  )  [private]
void ElecFilter::ReadMeasuredFilterData ( cplx MeasuredFilterFreq2  )  [private]
void ElecFilter::ReadMeasuredFilterData ( void   )  [private]

Reads in the measured data of an electrical filter.

Called by the constructor

The input data is assumed to consist of three columns:
(1) Freq relative to central freq with same discretization as in our code.
(2) Real part of Measured Filter at freq given by col (1)
(3) Imag part of Measured Filter at freq given by col (1)

See also:
string MeasuredElecFilterFileName, WriteFreqCplxFilter(string OutFileName), ElecFilter(string InFileName, Photodetector *oPhotodetector), ElecFilter(string InFileName, Photodetector *oPhotodetector, cplx * MeasuredFilterFreq), ElecFilter(string InFileName, cfftw *fft2,fftPowerMatrices sfftPM2)

References DeltaFreq, fft, FreqWindow, cfftw::ifftshift(), jc, MeasuredElecFilterFileName, MeasuredFilterFreq, NewCplx(), and qtPoints.

Referenced by ElecFilter(), and ReadMeasuredFilterData().

void ElecFilter::Set_f_3dB_ElecFilter ( double  f_3dB_ElecFilter2  ) 
void ElecFilter::SetFreqFWHM_ElecFilter ( double  FreqFWHM_ElecFilter2  ) 
void ElecFilter::SetPhotodetector ( Photodetector oPhotodetector2  ) 
void ElecFilter::spline ( double *  x,
double *  y,
int  n,
double  yp1,
double  ypn,
double *  y2 
) [private]
double ElecFilter::splint ( double *  xa,
double *  ya,
double *  y2a,
int  n,
double  x 
) [private]

References nrerror().

Referenced by GetElecGain(), and GetPhase().

void ElecFilter::Time2Freq ( void   )  [private]

Converts the ElecFilter's sfftPM data from time to frequency.

References cfftw::FFT(), fft, fftPowerMatrices::fPowerSignal, sfftPM, and fftPowerMatrices::tPowerSignal.

Referenced by ElectricalFilterMeasured(), and IntegrateAndDumpFilter_OLD().

void ElecFilter::WriteFilterImpulseResponse ( string  FileNameImpulseResponseTime,
string  FileNameImpulseResponseFreq 
void ElecFilter::WriteFreqCplxFilter ( string  OutFileName  ) 
void ElecFilter::WriteFreqPowerFilter ( string  OutFileName  ) 
void ElecFilter::WriteFreqPowerGaussianFilter ( string  OutFileName  ) 
void ElecFilter::WriteTimePowerFilter ( string  OutFileName  ) 

Member Data Documentation

Array of length StringLength to store the Average Current in each bit. Only used with the INTEGRATE_AND_DUMP filter

Referenced by AllocateMemoryForAverageCurrentinBit(), and IntegrateAndDumpFilter_OLD().

double ElecFilter::BitLength [private]
int ElecFilter::DebugLevel [private]
double ElecFilter::DeltaFreq [private]
double ElecFilter::DeltaTime [private]

Referenced by GetElecGain(), and ReadElecGain().

double ElecFilter::ElecGainStepFreq [private]

Referenced by GetElecGain(), and ReadElecGain().

cfftw* ElecFilter::fft [private]
double ElecFilter::FreqGain3dB [private]

Referenced by GetElecGain(), and ReadElecGain().

double ElecFilter::FreqWindow [private]
double ElecFilter::GainPeak [private]

Referenced by GetElecGain(), and ReadElecGain().

Name of the file containing the data for the measured filter.

See also:

Referenced by ElecFilter(), and ReadMeasuredFilterData().

Complex array to store frequency data for the Measured Filter.

Referenced by ElecFilter(), ElectricalFilterMeasured(), GetMeasuredFilterFreq(), ReadMeasuredFilterData(), WriteFreqCplxFilter(), and WriteFreqPowerFilter().

Referenced by GetElecGain(), and ReadElecGain().

int ElecFilter::qtPoints [private]

Referenced by ElecFilter().

int ElecFilter::StringLength [private]
double ElecFilter::TimeWindow [private]

The type of Electric filter.

Possible values of this enumeration type are:

  1. NO_ELEC_FILTER = 0.
  2. GAUSSIAN = 1. Must specify width.
  3. BESSEL = 2 Must specify order and width.
  4. MEASURED = 3 Must specify file name of measured data.

Referenced by ComputeMatchAndFilter(), ElecFilter(), FilterElecSignal(), GetTypeElecFilter(), WriteFreqCplxFilter(), and WriteFreqPowerFilter().

double* ElecFilter::xElecGain [private]

Referenced by GetElecGain(), and ReadElecGain().

double* ElecFilter::xElecPhase [private]
double* ElecFilter::y2ElecGain [private]

Referenced by GetElecGain(), and ReadElecGain().

double* ElecFilter::y2ElecPhase [private]
double* ElecFilter::yElecGain [private]

Referenced by GetElecGain(), and ReadElecGain().

double* ElecFilter::yElecPhase [private]

The documentation for this class was generated from the following files: