Skip to content

Commit

Permalink
modified PSD test
Browse files Browse the repository at this point in the history
  • Loading branch information
mkholghi committed Jul 24, 2018
1 parent 69a83c1 commit 9ed6cae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/AnalysisPrograms/MahnooshSandpit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void Execute(Arguments arguments)
//var recording2Path = Path.Combine(trainSetPath, "SM304264_0+1_20160421_054539_29-30min.wav"); // an example from the train set
//var recording2Path = Path.Combine(testSetPath, "SM304264_0+1_20160423_054539_29-30min.wav"); // an example from the test set
// check whether there is any file in the folder/subfolders
if (Directory.GetFiles(testSetPath, "*", SearchOption.AllDirectories).Length == 0) // trainSetPath
if (Directory.GetFiles(trainSetPath, "*", SearchOption.AllDirectories).Length == 0) // testSetPath
{
throw new ArgumentException("The folder of recordings is empty...");
}
Expand All @@ -279,7 +279,7 @@ public void Execute(Arguments arguments)
Dictionary<string, List<double[,]>> allFilesStdFeatureVectors = new Dictionary<string, List<double[,]>>();
Dictionary<string, List<double[,]>> allFilesSkewnessFeatureVectors = new Dictionary<string, List<double[,]>>();

foreach (string filePath in Directory.GetFiles(testSetPath, "*.wav")) // trainSetPath
foreach (string filePath in Directory.GetFiles(trainSetPath, "*.wav")) // testSetPath
{
FileInfo fileInfo = filePath.ToFileInfo();

Expand Down Expand Up @@ -757,7 +757,7 @@ public class FeatureLearningConfig : Config

public const bool DefaultDoNoiseReduction = true;

public const bool DefaultDoWhitening = true;
public const bool DefaultDoWhitening = false;

/// <summary>
/// Initializes a new instance of the <see cref="FeatureLearningConfig"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,13 @@ public void PowerSpectrumDensityTest()
var energySpectrogram = new EnergySpectrogram(sonoConfig, amplitudeSpectrogram.Data);

// square the FFT coefficients to get an energy spectrogram
//double[,] energySpectrogram = PowerSpectrumDensity.GetEnergyValues(sonogram.Data);
//double[,] energySpectrogram = PowerSpectrumDensity.GetEnergyValues(amplitudeSpectrogram.Data);

// RMS NORMALIZATION
double[,] normalizedValues = SNR.RmsNormalization(energySpectrogram.Data);
//double[,] normalizedValues = SNR.RmsNormalization(energySpectrogram);

// Median Noise Reduction
double[,] noiseReducedValues = PcaWhitening.NoiseReduction(normalizedValues);
double[,] noiseReducedValues = PcaWhitening.NoiseReduction(energySpectrogram.Data);

psd.Add(PowerSpectrumDensity.GetPowerSpectrum(noiseReducedValues));
}
Expand Down

0 comments on commit 9ed6cae

Please sign in to comment.