Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
Issue #492
  • Loading branch information
towsey committed May 28, 2021
1 parent 82b6d2e commit eb7c57c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public override void Make(double[,] amplitudeM)
if (bandCount > fftBinCount)
{
throw new Exception(
"## FATAL ERROR in BaseSonogram.MakeCepstrogram():- Can't calculate cepstral coefficients. Filterbank Count > number of FFT bins. (" +
"## FATAL ERROR in BaseSonogram.MakeCepstrogram():- Cannot prepare filterbank. Filter count > number of FFT bins. (" +
bandCount + " > " + fftBinCount + ")\n\n");
}

Expand Down
7 changes: 7 additions & 0 deletions src/TowseyLibrary/DataTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,13 @@ public static void writeArray(bool[] array)
}
}

/// <summary>
/// The format string should be as follows: "0.00" for two decimal places.
/// For more detail on custom numeric format string,
/// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings.
/// </summary>
/// <param name="array">an array of double.</param>
/// <param name="format">format string.</param>
public static string WriteArrayAsCsvLine(double[] array, string format)
{
var sb = new StringBuilder(array[0].ToString(format));
Expand Down
18 changes: 18 additions & 0 deletions src/TowseyLibrary/FileTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,12 @@ public static void WriteMatrix2File(char[,] matrix, string fName)
WriteTextFile(fName, lines); //write matrix to file
} //end of WriteMatrix2File\

/// <summary>
/// The format string should be as follows: "0.00" for two decimal places,
/// where number of zeros after the point is the number of decimal places.
/// For more detail on custom numeric format string,
/// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings.
/// </summary>
public static void WriteMatrix2File_Formatted(double[,] matrix, string fName, string formatString)
{
int rowCount = matrix.GetLength(0); //height
Expand All @@ -590,6 +596,12 @@ public static void WriteMatrix2File_Formatted(double[,] matrix, string fName, st
WriteTextFile(fName, lines); //write matrix to file
} //end of WriteMatrix2File

/// <summary>
/// The format string should be as follows: "0.00" for two decimal places,
/// where number of zeros after the point is the number of decimal places.
/// For more detail on custom numeric format string,
/// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings.
/// </summary>
public static void WriteArray2File_Formatted(double[] array, string path, string formatString)
{
int length = array.Length;
Expand All @@ -604,6 +616,12 @@ public static void WriteArray2File_Formatted(double[] array, string path, string
WriteTextFile(path, lines); //write matrix to file
} //end of WriteArray2File_Formatted

/// <summary>
/// The format string should be as follows: "0.00" for two decimal places,
/// where number of zeros after the point is the number of decimal places.
/// For more detail on custom numeric format string,
/// see https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings.
/// </summary>
public static void WriteArray2File_Formatted(int[] array, string path, string formatString)
{
int length = array.Length;
Expand Down

0 comments on commit eb7c57c

Please sign in to comment.