Skip to content

Commit 8e11548

Browse files
committed
refactor some code
refactored some methods and drew more EASY images. Corrected values in IndexPropertiesConfig which were changed by mistake last week. Checked previous bug in date-time ordering of files but was not able to replicate it. Problem must be fixed! Original hash: eb466fa
1 parent 370bade commit 8e11548

6 files changed

Lines changed: 30 additions & 51 deletions

File tree

AudioAnalysis/AnalysisConfigFiles/IndexPropertiesConfig.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ BackgroundNoise:
109109
DoDisplay: true
110110
# SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL + 10
111111
NormMin: -50.0
112-
NormMax: -15.0
112+
NormMax: -10.0
113113
ProjectID: Acoustic Indices
114114
Units: "dB"
115115
IncludeInComboIndex: false
@@ -133,7 +133,7 @@ AvgSnrOfActiveFrames:
133133
DefaultValue: 0.0
134134
DoDisplay: true
135135
NormMin: 0.0
136-
NormMax: 25.0
136+
NormMax: 30.0
137137
ProjectID: Acoustic Indices
138138
Units: "dB"
139139
IncludeInComboIndex: false
@@ -216,8 +216,8 @@ AcousticComplexity:
216216
DataType: double
217217
DefaultValue: 0.0
218218
DoDisplay: true
219-
NormMin: 0.01
220-
NormMax: 0.1
219+
NormMin: 0.4
220+
NormMax: 0.7
221221
ProjectID: Acoustic Indices
222222
Units: ""
223223
IncludeInComboIndex: true
@@ -229,7 +229,7 @@ TemporalEntropy:
229229
DefaultValue: 0.0
230230
DoDisplay: true
231231
NormMin: 0.0
232-
NormMax: 0.01
232+
NormMax: 0.5
233233
ProjectID: Acoustic Indices
234234
Units: ""
235235
IncludeInComboIndex: true
@@ -349,7 +349,7 @@ SptDensity:
349349
DefaultValue: 0.0
350350
DoDisplay: false
351351
NormMin: 0.0
352-
NormMax: 3.0
352+
NormMax: 2.0
353353
ProjectID: Acoustic Indices
354354
Units: ""
355355
IncludeInComboIndex: false

AudioAnalysis/AnalysisConfigFiles/IndexPropertiesConfigForEasyImages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ AcousticComplexity:
119119
DefaultValue: 0.0
120120
DoDisplay: true
121121
NormMin: 0.4
122-
NormMax: 0.7
122+
NormMax: 0.65
123123
ProjectID: Acoustic Indices
124124
Units: ""
125125
IncludeInComboIndex: true
@@ -130,8 +130,8 @@ TemporalEntropy:
130130
DataType: double
131131
DefaultValue: 0.0
132132
DoDisplay: true
133-
NormMin: 0.0
134-
NormMax: 0.5
133+
NormMin: 0.1
134+
NormMax: 0.4
135135
ProjectID: Acoustic Indices
136136
Units: ""
137137
IncludeInComboIndex: true

AudioAnalysis/AnalysisPrograms/ConcatenateIndexFiles.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public static Arguments Dev()
114114

115115

116116
// The recording siteName is used as filter pattern to select directories. It is also used for naming the output files
117-
//string directoryFilter = "Woondum3";
118-
string directoryFilter = "GympieNP"; // this is a directory filter to locate only the required files
117+
string directoryFilter = "Woondum3";
118+
//string directoryFilter = "GympieNP"; // this is a directory filter to locate only the required files
119119
string opFileStem = directoryFilter;
120120
string opPath = @"Y:\Results\YvonneResults\Cooloola_ConcatenatedResults";
121121

@@ -339,7 +339,7 @@ public static void Execute(Arguments arguments)
339339
}
340340

341341

342-
//TODO TODO TODO ######################## NEED TO DEBUG THE FOLLOWING OPTION
342+
//TODO TODO TODO ######################## NEED TO DEBUG THE FOLLOWING OPTION - use case of EDDIE GAME
343343
if (arguments.ConcatenateEverythingYouCanLayYourHandsOn)
344344
{
345345
LoggedConsole.WriteErrorLine("\n\nWARNING from method ConcatenateIndexFiles.Execute():");

AudioAnalysis/AnalysisPrograms/DrawEasyImage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public static Arguments Dev()
101101

102102
// ########################## CSV FILES CONTAINING SUMMARY INDICES IN 24 hour BLOCKS
103103
// top level directory
104-
//string opFileStem = "GympieNP-2015";
105-
//DirectoryInfo[] dataDirs = { new DirectoryInfo(@"Y:\Results\YvonneResults\Cooloola_ConcatenatedResults\GympieNP"), };
104+
string opFileStem = "GympieNP-2015";
105+
DirectoryInfo[] dataDirs = { new DirectoryInfo(@"Y:\Results\YvonneResults\Cooloola_ConcatenatedResults\GympieNP"), };
106106

107-
string opFileStem = "Woondum3-2015";
108-
DirectoryInfo[] dataDirs = { new DirectoryInfo(@"Y:\Results\YvonneResults\Cooloola_ConcatenatedResults\Woondum3"), };
107+
//string opFileStem = "Woondum3-2015";
108+
//DirectoryInfo[] dataDirs = { new DirectoryInfo(@"Y:\Results\YvonneResults\Cooloola_ConcatenatedResults\Woondum3"), };
109109

110110

111111
// The filter pattern finds summary index files

AudioAnalysis/AudioAnalysisTools/Indices/IndexMatrices.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -523,33 +523,6 @@ public static FileInfo[] GetFilesInDirectories(DirectoryInfo[] directories, stri
523523
return M;
524524
}
525525

526-
//public static double[,] ReadAndConcatenateSpectrogramCSVFiles(FileInfo[] paths)
527-
//{
528-
// string warning = null;
529-
530-
// var list = new List<double[,]>();
531-
532-
// // get the path containing keys[i]
533-
// foreach (FileInfo file in paths)
534-
// {
535-
// if (file.Exists)
536-
// {
537-
// int freqBinCount;
538-
// double[,] matrix = IndexMatrices.ReadSpectrogram(file, out freqBinCount);
539-
// list.Add(matrix);
540-
// }
541-
// }
542-
543-
// var M = MatrixTools.ConcatenateMatrixRows(list);
544-
545-
546-
// if (warning != null)
547-
// {
548-
// LoggedConsole.WriteLine(warning);
549-
// }
550-
551-
// return M;
552-
//}
553526

554527
public static double[,] RepairMatrixRowCount(double[,] M, int requiredRowCount)
555528
{

AudioAnalysis/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ namespace AudioAnalysisTools.LongDurationSpectrograms
1616

1717

1818
/// <summary>
19-
/// This class contains two methods: (1) StitchPartialSpectrograms() and (2) ConcatenateSpectralIndexFiles()
19+
/// This class used to contain only two methods: (1) StitchPartialSpectrograms() and (2) ConcatenateSpectralIndexFiles()
20+
/// Now it contains several versions to concatenate Index files. HTis is because there are now several use cases.
2021
///
22+
///
23+
/// Here are the original two methods:
2124
/// (1) StitchPartialSpectrograms()
2225
/// This method stitches together images and/or indices derived from a sequence of short recordings with gaps between them.
2326
/// It was written to deal with a set of recordings with protocol of Gianna Pavan (10 minutes every 30 minutes).
@@ -77,7 +80,7 @@ public static DirectoryInfo[] GetSubDirectoriesForSiteData(DirectoryInfo[] topLe
7780
}
7881

7982
/// <summary>
80-
/// Use this concatenation method when you only want to concatenate the files for a fixed single day.
83+
/// ONLY Use this concatenation method when you want to concatenate the files for a fixed single day.
8184
/// The files to be concatenated must be somewhere in the subdirectory structure of the passed list of data directories
8285
/// </summary>
8386
/// <param name="directories"></param>
@@ -90,17 +93,18 @@ public static Dictionary<string, double[,]> ConcatenateSpectralIndexFilesForOneD
9093
DateTimeOffset dto)
9194
{
9295
// 1. PATTERN SEARCH FOR CORRECT CSV FILES
93-
// Assumes that the required files are subdirectories of given site.
94-
// Read them into a dictionary
96+
// Assume that the required files are in subdirectories of given site. Read them into a dictionary
9597
string colorMap1 = SpectrogramConstants.RGBMap_ACI_ENT_EVN;
9698
string colorMap2 = SpectrogramConstants.RGBMap_BGN_POW_EVN;
9799
string[] keys = LdSpectrogramConfig.GetKeys(colorMap1, colorMap2);
98-
string filePrefix = null;
99-
// Concatenate the csv files
100-
var dictionary = LDSpectrogramStitching.ConcatenateSpectralIndexFiles(directories.ToArray(), filePrefix, dto, keys);
101100

102-
// 2. SAVE SPECTRAL INDEX DATA as CSV file TO OUTPUT DIRECTORY
101+
string analysisType = "Towsey.Acoustic";
103102
string dateString = String.Format("{0}{1:D2}{2:D2}", dto.Year, dto.Month, dto.Day);
103+
104+
string fileStemPattern = "*" + dateString + "*__" + analysisType;
105+
var dictionary = IndexMatrices.GetSpectralIndexFilesAndConcatenate(directories.ToArray(), fileStemPattern, keys);
106+
107+
// 2. SAVE SPECTRAL INDEX DATA as CSV file TO OUTPUT DIRECTORY
104108
string opFileStem = String.Format("{0}_{1}", filestem, dateString);
105109
TwoDimensionalArray orient = TwoDimensionalArray.ColumnMajor;
106110
foreach (var key in keys)
@@ -115,6 +119,8 @@ public static Dictionary<string, double[,]> ConcatenateSpectralIndexFilesForOneD
115119

116120

117121
/// <summary>
122+
/// Do not delete this method yet. Although it is not referenced, it may be when I come to debug the eddie Game use case.
123+
///
118124
/// Assumes that the required spectral index files can be found using search patterns that utilise
119125
/// the filePrefix, the passed dateTimeOffset, the analysis type and the passed keys.
120126
/// </summary>

0 commit comments

Comments
 (0)