Skip to content

Commit

Permalink
Fixing tests for IndexCalculateTests.cs
Browse files Browse the repository at this point in the history
Issue #291
  • Loading branch information
towsey authored and atruskie committed Aug 17, 2020
1 parent 2638e75 commit 4dafd0c
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,27 @@ public void TestOfSummaryIndices()

var summaryIndices = results.SummaryIndexValues;

Assert.AreEqual(0.6793287, summaryIndices.AcousticComplexity, AllowedDelta);
Assert.AreEqual(0.689085, summaryIndices.AcousticComplexity, AllowedDelta);
Assert.AreEqual(0.484520, summaryIndices.Activity, AllowedDelta);
Assert.AreEqual(-30.946519, summaryIndices.AvgSignalAmplitude, AllowedDelta);
Assert.AreEqual(11.533420, summaryIndices.AvgSnrOfActiveFrames, AllowedDelta);
Assert.AreEqual(-39.740775, summaryIndices.BackgroundNoise, AllowedDelta);
Assert.AreEqual(21, summaryIndices.ClusterCount);
Assert.AreEqual(0.153191, summaryIndices.EntropyOfAverageSpectrum, AllowedDelta);
Assert.AreEqual(0.301929, summaryIndices.EntropyOfCoVSpectrum, AllowedDelta);
Assert.AreEqual(0.260999, summaryIndices.EntropyOfPeaksSpectrum, AllowedDelta);
Assert.AreEqual(0.522080, summaryIndices.EntropyOfVarianceSpectrum, AllowedDelta);
Assert.AreEqual(23, summaryIndices.ClusterCount);
Assert.AreEqual(0.153642, summaryIndices.EntropyOfAverageSpectrum, AllowedDelta);
Assert.AreEqual(0.299602, summaryIndices.EntropyOfCoVSpectrum, AllowedDelta);
Assert.AreEqual(0.264981, summaryIndices.EntropyOfPeaksSpectrum, AllowedDelta);
Assert.AreEqual(0.522530, summaryIndices.EntropyOfVarianceSpectrum, AllowedDelta);
Assert.AreEqual(2.0, summaryIndices.EventsPerSecond, AllowedDelta);
Assert.AreEqual(0.467151, summaryIndices.SpectralCentroid, AllowedDelta);
Assert.AreEqual(0.140306, summaryIndices.HighFreqCover, AllowedDelta);
Assert.AreEqual(0.137873, summaryIndices.MidFreqCover, AllowedDelta);
Assert.AreEqual(0.055341, summaryIndices.LowFreqCover, AllowedDelta);
Assert.AreEqual(0.957433, summaryIndices.Ndsi, AllowedDelta);
Assert.AreEqual(0.462917, summaryIndices.SpectralCentroid, AllowedDelta);
Assert.AreEqual(0.148697, summaryIndices.HighFreqCover, AllowedDelta);
Assert.AreEqual(0.139938, summaryIndices.MidFreqCover, AllowedDelta);
Assert.AreEqual(0.048843, summaryIndices.LowFreqCover, AllowedDelta);
Assert.AreEqual(0.957532, summaryIndices.Ndsi, AllowedDelta);
Assert.AreEqual(27.877206, summaryIndices.Snr, AllowedDelta);
Assert.AreEqual(6.240310, summaryIndices.SptDensity, AllowedDelta);
Assert.AreEqual(6.257752, summaryIndices.SptDensity, AllowedDelta);
Assert.AreEqual(0, summaryIndices.ResultStartSeconds);
Assert.AreEqual(0.162216, summaryIndices.TemporalEntropy, AllowedDelta);
Assert.AreEqual(401, summaryIndices.ThreeGramCount, AllowedDelta);
Assert.AreEqual(487, summaryIndices.ThreeGramCount, AllowedDelta);
}

/// <summary>
Expand Down Expand Up @@ -139,7 +139,7 @@ public void TestOfSpectralIndices()
// 1:ACI
var expectedSpectrumFile = PathHelper.ResolveAsset("Indices", "ACI.bin");

//Binary.Serialize(expectedSpectrumFile, spectralIndices.ACI);
// Binary.Serialize(expectedSpectrumFile, spectralIndices.ACI);
var expectedVector = Binary.Deserialize<double[]>(expectedSpectrumFile);
CollectionAssert.That.AreEqual(expectedVector, spectralIndices.ACI, AllowedDelta);

Expand Down Expand Up @@ -174,7 +174,7 @@ public void TestOfSpectralIndices()
// 6:OSC
expectedSpectrumFile = PathHelper.ResolveAsset("Indices", "OSC.bin");

//Binary.Serialize(expectedSpectrumFile, spectralIndices.OSC);
// Binary.Serialize(expectedSpectrumFile, spectralIndices.OSC);
expectedVector = Binary.Deserialize<double[]>(expectedSpectrumFile);
CollectionAssert.That.AreEqual(expectedVector, spectralIndices.OSC, AllowedDelta);

Expand Down Expand Up @@ -263,13 +263,13 @@ public void TestOfSpectralIndices_ICD20()
var resourcesDir = PathHelper.ResolveAssetPath("Indices");
var expectedSpectrumFile = PathHelper.ResolveAsset("Indices", "BGN_ICD20.bin");

//Binary.Serialize(expectedSpectrumFile, spectralIndices.BGN);
// Binary.Serialize(expectedSpectrumFile, spectralIndices.BGN);
var expectedVector = Binary.Deserialize<double[]>(expectedSpectrumFile);
CollectionAssert.That.AreEqual(expectedVector, spectralIndices.BGN, AllowedDelta);

expectedSpectrumFile = PathHelper.ResolveAsset("Indices", "CVR_ICD20.bin");

//Binary.Serialize(expectedSpectrumFile, spectralIndices.CVR);
// Binary.Serialize(expectedSpectrumFile, spectralIndices.CVR);
expectedVector = Binary.Deserialize<double[]>(expectedSpectrumFile);
CollectionAssert.That.AreEqual(expectedVector, spectralIndices.CVR, AllowedDelta);

Expand Down Expand Up @@ -333,12 +333,16 @@ public void TestOfSpectralIndices_Octave()
// TEST the BGN SPECTRAL INDEX
Assert.AreEqual(256, spectralIndices.BGN.Length);

//Binary.Serialize(expectedSpectrumFile, spectralIndices.BGN);
var expectedVector = Binary.Deserialize<double[]>(PathHelper.ResolveAsset("Indices", "BGN_OctaveScale.bin"));
var expectedSpectrumFile1 = PathHelper.ResolveAsset("Indices", "BGN_OctaveScale.bin");

// Binary.Serialize(expectedSpectrumFile1, spectralIndices.BGN);
var expectedVector = Binary.Deserialize<double[]>(expectedSpectrumFile1);
CollectionAssert.That.AreEqual(expectedVector, spectralIndices.BGN, AllowedDelta);

//Binary.Serialize(expectedSpectrumFile, spectralIndices.CVR);
expectedVector = Binary.Deserialize<double[]>(PathHelper.ResolveAsset("Indices", "CVR_OctaveScale.bin"));
var expectedSpectrumFile2 = PathHelper.ResolveAsset("Indices", "CVR_OctaveScale.bin");

// Binary.Serialize(expectedSpectrumFile2, spectralIndices.CVR);
expectedVector = Binary.Deserialize<double[]>(expectedSpectrumFile2);
CollectionAssert.That.AreEqual(expectedVector, spectralIndices.CVR, AllowedDelta);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/ACI.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/BGN.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/BGN_ICD20.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/BGN_OctaveScale.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/CVR.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/CVR_ICD20.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/ENT.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/EVN.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/OSC.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/PMN.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/RHZ.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/RNG.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/RPS.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/RVT.bin
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/Fixtures/Indices/SPT.bin
Git LFS file not shown

0 comments on commit 4dafd0c

Please sign in to comment.