Skip to content

Commit bc09ebd

Browse files
committed
Attending Issue #146 Oscillations test
Create new Spectral index to detect oscillations Fix existing tests for oscillaitons spectrogram and create new test for oscillations spectral index. Still more work to be done with this issue. Partly fixes issue #146
1 parent e8f9a31 commit bc09ebd

18 files changed

+399
-423
lines changed

src/Acoustics.Shared/Csv/Csv.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// --------------------------------------------------------------------------------------------------------------------
1+
// --------------------------------------------------------------------------------------------------------------------
22
// <copyright file="Csv.cs" company="QutEcoacoustics">
33
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
44
// </copyright>
@@ -361,7 +361,7 @@ public static void WriteMatrixToCsv<T>(FileInfo destination, IEnumerable<T[]> ma
361361
}
362362
}
363363

364-
public static IEnumerable<T[]> ReadMatrixFromCsv<T>(FileInfo source)
364+
public static IEnumerable<T[]> ReadMatrixFromCsvAsEnumerable<T>(FileInfo source)
365365
{
366366
Contract.Requires(source != null);
367367

src/AnalysisPrograms/Recognizers/LitoriaBicolor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public static Tuple<BaseSonogram, double[,], double[], List<AcousticEvent>, Imag
280280
double oscilFreq;
281281
double period;
282282
double intensity;
283-
Oscillations2014.GetOscillation(differenceArray, framesPerSecond, cosines, out oscilFreq, out period, out intensity);
283+
Oscillations2014.GetOscillationUsingDct(differenceArray, framesPerSecond, cosines, out oscilFreq, out period, out intensity);
284284

285285
bool periodWithinBounds = period > lbConfig.MinPeriod && period < lbConfig.MaxPeriod;
286286

src/AnalysisPrograms/Recognizers/LitoriaRothii.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public override RecognizerResults Recognize(AudioRecording recording, Config con
160160
double oscilFreq;
161161
double period;
162162
double intensity;
163-
Oscillations2014.GetOscillation(subArray, framesPerSecond, cosines, out oscilFreq, out period, out intensity);
163+
Oscillations2014.GetOscillationUsingDct(subArray, framesPerSecond, cosines, out oscilFreq, out period, out intensity);
164164
bool periodWithinBounds = period > minPeriod && period < maxPeriod;
165165

166166
if (!periodWithinBounds)

src/AnalysisPrograms/Recognizers/LitoriaWatjulumensis.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ private static Tuple<BaseSonogram, double[,], double[], List<AcousticEvent>, Ima
289289
double oscilFreq;
290290
double period;
291291
double intensity;
292-
Oscillations2014.GetOscillation(differenceArray, framesPerSecond, cosines, out oscilFreq, out period, out intensity);
292+
Oscillations2014.GetOscillationUsingDct(differenceArray, framesPerSecond, cosines, out oscilFreq, out period, out intensity);
293293

294294
bool periodWithinBounds = period > minPeriod && period < maxPeriod;
295295

src/AnalysisPrograms/Sandpit.cs

+12-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public override Task<int> Execute(CommandLineApplication app)
7373
//CodeToPlaceScoreTracksUnderLdfcSpectrograms();
7474
//CodeToPlaceScoreTracksUnderSingleImage();
7575

76-
ConcatenateIndexFilesAndSpectrograms();
76+
//ConcatenateIndexFilesAndSpectrograms();
7777
//ConcatenateMarineImages();
7878
//ConcatenateImages();
7979
//ConcatenateTwelveImages();
@@ -103,6 +103,9 @@ public override Task<int> Execute(CommandLineApplication app)
103103
//TestTernaryPlots();
104104
//TestDirectorySearchAndFileSearch();
105105
//TestNoiseReduction();
106+
Oscillations2014.TESTMETHOD_DrawOscillationSpectrogram();
107+
//Oscillations2014.TESTMETHOD_GetSpectralIndex_Osc();
108+
//Test_DrawFourSpectrograms();
106109

107110
Console.WriteLine("# Finished Sandpit Task! Press any key to exit.");
108111
return this.Ok();
@@ -1256,9 +1259,6 @@ public static void TestsOfFrequencyScales()
12561259
// FrequencyScale.TESTMETHOD_OctaveFrequencyScale1();
12571260
// FrequencyScale.TESTMETHOD_OctaveFrequencyScale2();
12581261

1259-
//Audio2Sonogram.TESTMETHOD_DrawFourSpectrograms();
1260-
//Oscillations2014.TESTMETHOD_DrawOscillationSpectrogram();
1261-
12621262
// The following test methods test various configs of concatenation
12631263
// ConcatenateIndexFiles.TESTMETHOD_ConcatenateIndexFilesTest1();
12641264
// ConcatenateIndexFiles.TESTMETHOD_ConcatenateIndexFilesTest2();
@@ -1275,10 +1275,15 @@ public static void TestsOfFrequencyScales()
12751275
FrequencyScale.TESTMETHOD_DrawFrequencyLinesOnImage();
12761276
}
12771277

1278+
public static void Test_DrawFourSpectrograms()
1279+
{
1280+
Audio2Sonogram.TESTMETHOD_DrawFourSpectrograms();
1281+
}
1282+
12781283
/// <summary>
1279-
/// Unit test of AnalyseLongRecording() using artificial signal
1280-
/// </summary>
1281-
public static void TestAnalyseLongRecordingUsingArtificialSignal()
1284+
/// Unit test of AnalyseLongRecording() using artificial signal
1285+
/// </summary>
1286+
public static void TestAnalyseLongRecordingUsingArtificialSignal()
12821287
{
12831288
int sampleRate = 22050;
12841289
double duration = 420; // signal duration in seconds = 7 minutes

0 commit comments

Comments
 (0)