Skip to content

Commit

Permalink
Change method names to follow accepted convention
Browse files Browse the repository at this point in the history
Issue #370
  • Loading branch information
towsey authored and atruskie committed Oct 14, 2020
1 parent e45a575 commit 5acab67
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/AnalysisPrograms/Audio2InputForConvCNN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ public static AudioToSonogramResult GenerateSpectrogramImages(FileInfo sourceRec

////LoggedConsole.WriteLine("LCN: FramesPerSecond (Prior to LCN) = {0}", sonogram.FramesPerSecond);
////LoggedConsole.WriteLine("LCN: Neighbourhood of {0} seconds = {1} frames", neighbourhoodSeconds, neighbourhoodFrames);
sonogram.Data = NoiseRemoval_Briggs.NoiseReduction_byLCN(sonogram.Data, lowPercentile, neighbourhoodFrames, lcnContrastLevel);
sonogram.Data = NoiseRemoval_Briggs.NoiseReductionByLcn(sonogram.Data, lowPercentile, neighbourhoodFrames, lcnContrastLevel);

// draw amplitude spectrogram unannotated
FileInfo outputImage1 = new FileInfo(Path.Combine(outputDirectory.FullName, sourceName + ".amplitd.bmp"));
Expand Down
2 changes: 1 addition & 1 deletion src/AnalysisPrograms/OscillationsGeneric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static void Main(Arguments arguments)
// LocalContrastNormalisation over frequency bins is better and faster.
int neighbourhood = 15;
double contrastLevel = 0.5;
sonogram.Data = NoiseRemoval_Briggs.NoiseReduction_byLCN(sonogram.Data, neighbourhood, contrastLevel);
sonogram.Data = NoiseRemoval_Briggs.NoiseReductionByLcn(sonogram.Data, neighbourhood, contrastLevel);

// ###############################################################
// lowering the sensitivity threshold increases the number of hits.
Expand Down
2 changes: 1 addition & 1 deletion src/AnalysisPrograms/SURFAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public static AudioToSonogramResult GenerateSpectrogramImages(FileInfo sourceRec

//LoggedConsole.WriteLine("LCN: FramesPerSecond (Prior to LCN) = {0}", sonogram.FramesPerSecond);
//LoggedConsole.WriteLine("LCN: Neighbourhood of {0} seconds = {1} frames", neighbourhoodSeconds, neighbourhoodFrames);
sonogram.Data = NoiseRemoval_Briggs.NoiseReduction_byLCN(sonogram.Data, lowPercentile, neighbourhoodFrames, lcnContrastLevel);
sonogram.Data = NoiseRemoval_Briggs.NoiseReductionByLcn(sonogram.Data, lowPercentile, neighbourhoodFrames, lcnContrastLevel);

// draw amplitude spectrogram unannotated
FileInfo outputImage1 = new FileInfo(Path.Combine(opDir.FullName, sourceName + ".amplitd.png"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public static Image<Rgb24> GetLcnSpectrogram(
//spectrogram.Data =
// NoiseRemoval_Briggs.NoiseReduction_byLowestPercentileSubtraction(spectrogram.Data, lowPercentile);
spectrogram.Data =
NoiseRemoval_Briggs.NoiseReduction_byLCN(spectrogram.Data, neighbourhoodFrames, lcnContrastLevel);
NoiseRemoval_Briggs.NoiseReductionByLcn(spectrogram.Data, neighbourhoodFrames, lcnContrastLevel);

//spectrogram.Data =
// NoiseRemoval_Briggs.NoiseReduction_byLCNDivision(spectrogram.Data, lowPercent: 20, neighbourhoodFrames, lcnContrastLevel);
Expand Down
14 changes: 7 additions & 7 deletions src/AudioAnalysisTools/DSP/NoiseRemoval_Briggs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class NoiseRemoval_Briggs
/// Same method as above except take square root of the cell energy divided by the noise.
/// Taking the square root has the effect of reducing image contrast.
/// </summary>
public static double[,] NoiseReduction_byDivisionAndSqrRoot(double[,] matrix, int percentileThreshold)
public static double[,] NoiseReductionByDivisionAndSqrRoot(double[,] matrix, int percentileThreshold)
{
double[] profile = NoiseProfile.GetNoiseProfile_fromLowestPercentileFrames(matrix, percentileThreshold);
profile = DataTools.filterMovingAverage(profile, 3);
Expand Down Expand Up @@ -63,7 +63,7 @@ public static class NoiseRemoval_Briggs
/// <param name="matrix">the passed amplitude or energy spectrogram.</param>
/// <param name="percentileThreshold">Must be an integer percent.</param>
/// <returns>Spectrogram data matrix with noise subtracted.</returns>
public static double[,] NoiseReduction_byLowestPercentileSubtraction(double[,] matrix, int percentileThreshold)
public static double[,] NoiseReductionByLowestPercentileSubtraction(double[,] matrix, int percentileThreshold)
{
double[] profile = NoiseProfile.GetNoiseProfile_fromLowestPercentileFrames(matrix, percentileThreshold);
profile = DataTools.filterMovingAverage(profile, 3);
Expand Down Expand Up @@ -99,7 +99,7 @@ public static class NoiseRemoval_Briggs
/// A low contrastLevel = 0.1 give more grey image.
/// A high contrastLevel = 1.0 give mostly white high contrast image.
/// </summary>
public static double[,] NoiseReduction_byLCN(double[,] matrix, int lowPercent, int neighbourhood, double contrastLevel)
public static double[,] NoiseReductionByLcn(double[,] matrix, int lowPercent, int neighbourhood, double contrastLevel)
{
double[] noiseProfile = NoiseProfile.GetNoiseProfile_BinWiseFromLowestPercentileCells(matrix, lowPercent);
noiseProfile = DataTools.filterMovingAverage(noiseProfile, 5);
Expand Down Expand Up @@ -139,7 +139,7 @@ public static class NoiseRemoval_Briggs
/// </summary>
/// <param name="neighbourhood">suitable vaues are odd numbers 9 - 59.</param>
/// <param name="contrastLevel">Suitable values are 0.1 to 1.0.</param>
public static double[,] NoiseReduction_byLCN(double[,] matrix, int neighbourhood, double contrastLevel)
public static double[,] NoiseReductionByLcn(double[,] matrix, int neighbourhood, double contrastLevel)
{
int rowCount = matrix.GetLength(0);
int colCount = matrix.GetLength(1);
Expand Down Expand Up @@ -253,7 +253,7 @@ public static double[] CalculateLocalVariance2(double[,] matrix, int colId, int

public static double[,] BriggsNoiseFilterAndGetMask(double[,] matrix, int percentileThreshold, double binaryThreshold)
{
double[,] m = NoiseReduction_byDivision(matrix, percentileThreshold);
double[,] m = NoiseReductionByDivision(matrix, percentileThreshold);

// smooth and truncate
m = ImageTools.WienerFilter(m, 7); //Briggs uses 17
Expand All @@ -280,7 +280,7 @@ public static double[] CalculateLocalVariance2(double[,] matrix, int colId, int
/// Then divide cell energy by the profile value.
/// This method was adapted from a paper by Briggs.
/// </summary>
public static double[,] NoiseReduction_byDivision(double[,] matrix, int percentileThreshold)
public static double[,] NoiseReductionByDivision(double[,] matrix, int percentileThreshold)
{
double[] profile = NoiseProfile.GetNoiseProfile_fromLowestPercentileFrames(matrix, percentileThreshold);
profile = DataTools.filterMovingAverage(profile, 3);
Expand Down Expand Up @@ -321,7 +321,7 @@ public static Image BriggsNoiseFilterAndGetSonograms(
int nyquist,
int herzInterval)
{
double[,] m = NoiseReduction_byDivisionAndSqrRoot(matrix, percentileThreshold);
double[,] m = NoiseReductionByDivisionAndSqrRoot(matrix, percentileThreshold);

var images = new List<Image<Rgb24>>();

Expand Down
4 changes: 2 additions & 2 deletions src/AudioAnalysisTools/DSP/SNR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,8 @@ public static Tuple<double[,], double[]> NoiseReduce(double[,] m, NoiseReduction
break;
case NoiseReductionType.BriggsPercentile:
// Briggs filters twice
m = NoiseRemoval_Briggs.NoiseReduction_byDivisionAndSqrRoot(m, (int)parameter);
m = NoiseRemoval_Briggs.NoiseReduction_byDivisionAndSqrRoot(m, (int)parameter);
m = NoiseRemoval_Briggs.NoiseReductionByDivisionAndSqrRoot(m, (int)parameter);
m = NoiseRemoval_Briggs.NoiseReductionByDivisionAndSqrRoot(m, (int)parameter);
break;
case NoiseReductionType.Binary:
{
Expand Down

0 comments on commit 5acab67

Please sign in to comment.