Skip to content

Commit

Permalink
Update unit tests for compatilibity with new array formats.
Browse files Browse the repository at this point in the history
  • Loading branch information
pslocum committed May 7, 2024
1 parent ee9d18d commit 1ee6098
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Source/Applications/Testing/testLMCPlaneWaveFIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class testLMCPlaneWaveFIR
LWARN(testlog,"TFReceiverHandler was not configured correctly.");
return false;
}
if ( !fTFReceiverHandler->ReadHFSSFile() )
if ( !fTFReceiverHandler->ReadHFSSFile(1,0,1,1) )
{
LWARN(testlog,"TF file was not read correctly.");
return false;
Expand Down Expand Up @@ -111,7 +111,7 @@ class testLMCPlaneWaveFIR
std::deque<double> SignalToDeque(Signal* aSignal)
{
std::deque<double> incidentSignal;
for (unsigned i=0; i<fTFReceiverHandler->GetFilterSize(); i++)
for (unsigned i=0; i<fTFReceiverHandler->GetFilterSizeArray(1,0,1,1); i++)
{
incidentSignal.push_back(aSignal->LongSignalTimeComplex()[i][0]);
}
Expand Down Expand Up @@ -155,8 +155,8 @@ TEST_CASE( "LMCPlaneWaveFIR with default parameter values (pass)", "[single-file

/* initialize time series */
Signal* aSignal = new Signal();
int N0 = aTestLMCPlaneWaveFIR.fTFReceiverHandler->GetFilterSize();
aTestLMCPlaneWaveFIR.fFilterRate = (1./aTestLMCPlaneWaveFIR.fTFReceiverHandler->GetFilterResolution());
int N0 = aTestLMCPlaneWaveFIR.fTFReceiverHandler->GetFilterSizeArray(1,0,1,1);
aTestLMCPlaneWaveFIR.fFilterRate = (1./aTestLMCPlaneWaveFIR.fTFReceiverHandler->GetFilterResolutionArray(1,0,1,1));
aSignal->Initialize( N0 , 1 );

double firGainMax = 0.;
Expand All @@ -172,7 +172,7 @@ TEST_CASE( "LMCPlaneWaveFIR with default parameter values (pass)", "[single-file
/* populate time series and convolve it with the FIR filter */
double timeStamp = i/aTestLMCPlaneWaveFIR.fAcquisitionRate;
aTestLMCPlaneWaveFIR.PopulateSignal(aSignal, N0, timeStamp);
double convolution = aTestLMCPlaneWaveFIR.fTFReceiverHandler->ConvolveWithFIRFilter(aTestLMCPlaneWaveFIR.SignalToDeque(aSignal));
double convolution = aTestLMCPlaneWaveFIR.fTFReceiverHandler->ConvolveWithFIRFilterArray(1,0,1,1,aTestLMCPlaneWaveFIR.SignalToDeque(aSignal));
if (fabs(convolution) > convolutionMag)
{
convolutionMag = convolution;
Expand Down
2 changes: 1 addition & 1 deletion Source/Generators/LMCCavitySignalGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ namespace locust
double cavityFrequency = fAnalyticResponseFunction->GetCavityFrequency(bTE,l,m,n);
double qExpected = fAnalyticResponseFunction->GetCavityQ(bTE,l,m,n);
aCavityUtility.SetOutputFile(fUnitTestRootFile);
if (!aCavityUtility.CheckCavityQ(bTE, l, m, n, fInterface->fField->GetNModes(), timeResolution, thresholdFactor, cavityFrequency, qExpected ))
if (!aCavityUtility.CheckCavityQ(bTE, l, m, n, timeResolution, thresholdFactor, cavityFrequency, qExpected ))
{
LERROR(lmclog,"The cavity Q does not look quite right. Please tune the configuration "
"with the unit test as in bin/testLMCCavity [-h]");
Expand Down
4 changes: 2 additions & 2 deletions Source/Utilities/LMCCavityUtility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ namespace locust
}


bool CavityUtility::CheckCavityQ(int bTE, int l, int m, int n, int nModes, double dhoTimeResolution, double dhoThresholdFactor, double dhoCavityFrequency, double dhoCavityQ)
bool CavityUtility::CheckCavityQ(int bTE, int l, int m, int n, double dhoTimeResolution, double dhoThresholdFactor, double dhoCavityFrequency, double dhoCavityQ)
{
AddParam( "dho-time-resolution", dhoTimeResolution );
AddParam( "dho-threshold-factor", dhoThresholdFactor );
AddParam( "dho-cavity-frequency", dhoCavityFrequency );
AddParam( "dho-cavity-Q", dhoCavityQ );
AddParam( "n-modes", nModes );
// AddParam( "n-modes", nModes );
if (!Configure(bTE,l,m,n))
{
LERROR(testlog,"Cavity was not configured correctly.");
Expand Down
2 changes: 1 addition & 1 deletion Source/Utilities/LMCCavityUtility.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace locust
virtual ~CavityUtility();

bool Configure(int bTE, int l, int m, int n);
bool CheckCavityQ(int bTE, int l, int m, int n, int nModes, double dhoTimeResolution, double dhoThresholdFactor, double dhoCavityFrequency, double dhoCavityQ);
bool CheckCavityQ(int bTE, int l, int m, int n, double dhoTimeResolution, double dhoThresholdFactor, double dhoCavityFrequency, double dhoCavityQ);
void SetExpandFactor(double aFactor);
void SetOutputFile(bool aFlag);
void AddParam(std::string aString, double aValue);
Expand Down

0 comments on commit 1ee6098

Please sign in to comment.