Skip to content
Snippets Groups Projects
Commit ee4f7feb authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: noiseModel - report missing octave bands

parent 98abafcc
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,7 @@ void Foam::noiseModel::setOctaveBands ...@@ -78,6 +78,7 @@ void Foam::noiseModel::setOctaveBands
// Centre frequencies // Centre frequencies
DynamicList<scalar> fc; DynamicList<scalar> fc;
DynamicList<scalar> missedBins;
// Convert to lower band limit // Convert to lower band limit
fTest /= fRatioL2C; fTest /= fRatioL2C;
...@@ -91,9 +92,12 @@ void Foam::noiseModel::setOctaveBands ...@@ -91,9 +92,12 @@ void Foam::noiseModel::setOctaveBands
if (f[i] >= fTest) if (f[i] >= fTest)
{ {
// Advance band if appropriate // Advance band if appropriate
label stepi = 0;
while (f[i] > fTest) while (f[i] > fTest)
{ {
if (stepi) missedBins.append(fTest/fRatio*fRatioL2C);
fTest *= fRatio; fTest *= fRatio;
++stepi;
} }
fTest /= fRatio; fTest /= fRatio;
...@@ -113,6 +117,16 @@ void Foam::noiseModel::setOctaveBands ...@@ -113,6 +117,16 @@ void Foam::noiseModel::setOctaveBands
fBandIDs = bandIDs.sortedToc(); fBandIDs = bandIDs.sortedToc();
if (missedBins.size())
{
label nMiss = missedBins.size();
label nTotal = nMiss + fc.size() - 1;
WarningInFunction
<< "Empty bands found: " << nMiss << " of " << nTotal
<< " with centre frequencies " << flatOutput(missedBins)
<< endl;
}
if (fc.size()) if (fc.size())
{ {
// Remove the last centre frequency (beyond upper frequency limit) // Remove the last centre frequency (beyond upper frequency limit)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment