Skip to content

Commit

Permalink
Remove translation dictionary
Browse files Browse the repository at this point in the history
No longer needed.
Also do some resharper stuff
  • Loading branch information
towsey authored and atruskie committed Mar 25, 2019
1 parent 369d3a3 commit b9fe5db
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/AnalysisPrograms/Sandpit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ public static void Audio2CsvOverOneFile()
//string configPath = @"C:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisConfigFiles\Towsey.Acoustic.yml";

// Test on STANDARD 24-HOUR RECORDING
string recordingPath = @"C:\Ecoacoustics\WavFiles\LizZnidersic\TasmanIsland2015_Unit2_Mez\SM304256_0+1_20151114_061652.wav";
string outputPath = @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\07";
string recordingPath = @"C:\Ecoacoustics\WavFiles\LizZnidersic\TasmanIsland2015_Unit2_Mez\SM304256_0+1_20151114_071652.wav";
string outputPath = @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\08";
string configPath = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\Towsey.Acoustic.yml";

// Ivan Campos recordings
Expand Down
48 changes: 15 additions & 33 deletions src/AudioAnalysisTools/Indices/IndexDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public static class IndexDisplay
private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

/// <summary>
/// Uses a dictionary of index properties to draw an image of summary index tracks
/// Uses a dictionary of index properties to draw an image of summary index tracks.
/// </summary>
/// <param name="csvFile"> file containing the summary indices </param>
/// <param name="indexPropertiesConfig"> indexPropertiesConfig </param>
/// <param name="title"> image title </param>
/// <param name="csvFile"> file containing the summary indices.</param>
/// <param name="indexPropertiesConfig"> indexPropertiesConfig.</param>
/// <param name="title">image title.</param>
/// <param name="indexCalculationDuration"> The index Calculation Duration. </param>
/// <param name="recordingStartDate"> The recording Start Date. </param>
public static Bitmap DrawImageOfSummaryIndexTracks(
Expand All @@ -52,7 +52,7 @@ public static Bitmap DrawImageOfSummaryIndexTracks(
}

/// <summary>
/// Reads csv file containing summary indices and converts them to a tracks image
/// Reads csv file containing summary indices and converts them to a tracks image.
/// </summary>
public static Bitmap DrawImageOfSummaryIndices(
Dictionary<string, IndexProperties> listOfIndexProperties,
Expand Down Expand Up @@ -88,9 +88,6 @@ public static Bitmap DrawImageOfSummaryIndices(
List<GapsAndJoins> errors = null,
bool verbose = false)
{
// to translate past keys into current keys
Dictionary<string, string> translationDictionary = InitialiseIndexProperties.GetKeyTranslationDictionary();

const int trackHeight = DefaultTrackHeight;
int scaleLength = 0;
var bitmapList = new List<Tuple<IndexProperties, Image>>(dictionaryOfSummaryIndices.Keys.Count);
Expand All @@ -102,25 +99,12 @@ public static Bitmap DrawImageOfSummaryIndices(
string correctKey = key;
if (!listOfIndexProperties.ContainsKey(key))
{
if (translationDictionary.ContainsKey(key))
{
correctKey = translationDictionary[key];
LoggedConsole.WriteWarnLine(
"The csv header is an unknown index <{0}>. Translated to <{1}>",
key,
correctKey);
}
else
if (verbose)
{
if (verbose)
{
Logger.Warn(
"A index properties configuration could not be found for {0} (not even in the translation directory). Property is ignored and not rendered"
.Format2(key));
}

continue;
Logger.Warn("{0} index configuration could not be found. Index is ignored and not rendered.".Format2(key));
}

continue;
}

IndexProperties ip = listOfIndexProperties[correctKey];
Expand Down Expand Up @@ -178,9 +162,9 @@ public static Bitmap DrawImageOfSummaryIndices(
}

/// <summary>
/// Reads csv file containing summary indices and converts them to a tracks image
/// Reads csv file containing summary indices and converts them to a tracks image.
/// </summary>
/// <returns>an image of two clipping tracks</returns>
/// <returns>an image of two clipping tracks.</returns>
public static Bitmap DrawHighAmplitudeClippingTrack(FileInfo csvFile)
{
if (!csvFile.Exists)
Expand All @@ -197,9 +181,9 @@ public static Bitmap DrawHighAmplitudeClippingTrack(FileInfo csvFile)
}

/// <summary>
/// Reads csv file containing summary indices and converts them to a tracks image
/// Reads csv file containing summary indices and converts them to a tracks image.
/// </summary>
/// <returns>a bitmap image</returns>
/// <returns>a bitmap image.</returns>
public static Bitmap DrawHighAmplitudeClippingTrack(double[] array1, double[] array2)
{
double[] values1 = DataTools.NormaliseInZeroOne(array1, 0, 1.0);
Expand All @@ -209,10 +193,8 @@ public static Bitmap DrawHighAmplitudeClippingTrack(double[] array1, double[] ar
int trackWidth = dataLength;
int trackHeight = DefaultTrackHeight;

//Color[] grayScale = ImageTools.GrayScale();

Bitmap bmp = new Bitmap(trackWidth, trackHeight);
Graphics g = Graphics.FromImage(bmp);
var bmp = new Bitmap(trackWidth, trackHeight);
var g = Graphics.FromImage(bmp);

//g.Clear(grayScale[240]);
g.Clear(Color.LightGray);
Expand Down
2 changes: 2 additions & 0 deletions src/AudioAnalysisTools/Indices/InitialiseIndexProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static Dictionary<string, IndexProperties> GetDictionaryOfSummaryIndexPro
return dict;
}

/*
public static Dictionary<string, string> GetKeyTranslationDictionary()
{
var dict = new Dictionary<string, string>
Expand Down Expand Up @@ -153,5 +154,6 @@ public static Dictionary<string, string> GetKeyTranslationDictionary()
return dict;
}
*/
}
}

0 comments on commit b9fe5db

Please sign in to comment.