Skip to content

Commit

Permalink
Four minor changes for checking purposes
Browse files Browse the repository at this point in the history
Checking the combine effect of the most recent merge.
Four small changes:
1. Adjusted max bound of Clipping Index
2. Chnaged paths in Sandpit.cs for testing
3. Added two new RGB index combinations.
4. Added (Action) cast to enable build.
  • Loading branch information
towsey committed Feb 12, 2019
1 parent f57ea90 commit 047e36c
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/AnalysisConfigFiles/IndexPropertiesConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ClippingIndex:
DefaultValue: 0.0
DoDisplay: true
NormMin: 0.0
NormMax: 1.0
NormMax: 5.0
ProjectID: Acoustic Indices
Units: "avClips/s"
IncludeInComboIndex: false
Expand Down
127 changes: 75 additions & 52 deletions src/AnalysisPrograms/Sandpit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ public class Sandpit
public const string CommandName = "Sandpit";

[Command(
CommandName,
Description = "[UNMAINTAINED] Michael's personal experimental area.",
ShowInHelpText = false)]
CommandName,
Description = "[UNMAINTAINED] Michael's personal experimental area.",
ShowInHelpText = false)]
public class Arguments : SubCommandBase
{
public override Task<int> Execute(CommandLineApplication app)
{
{
var tStart = DateTime.Now;
Log.Verbosity = 1;
Log.WriteLine("# Start Time = " + tStart.ToString(CultureInfo.InvariantCulture));

//AnalyseFrogDataSet();
Audio2CsvOverOneFile();
//Audio2CsvOverOneFile();
//Audio2CsvOverMultipleFiles();

// used to get files from availae for Black rail and Least Bittern papers.
Expand All @@ -71,15 +71,15 @@ public override Task<int> Execute(CommandLineApplication app)
//CodeToPlaceScoreTracksUnderLdfcSpectrograms();
//CodeToPlaceScoreTracksUnderSingleImage();

//ConcatenateIndexFilesAndSpectrograms();
ConcatenateGreyScaleSpectrogramImages();
ConcatenateIndexFilesAndSpectrograms();
//ConcatenateGreyScaleSpectrogramImages();
//ConcatenateMarineImages();
//ConcatenateImages();
//ConcatenateTwelveImages();
//CubeHelixDrawTestImage();
//DrawLongDurationSpectrogram();
//DrawClusterSequence();
DrawStandardSpectrograms();
//DrawStandardSpectrograms();

//ExtractSpectralFeatures();
//HerveGlotinMethods();
Expand Down Expand Up @@ -323,8 +323,8 @@ public static void Audio2CsvOverOneFile()
//string outputPath = @"G:\SensorNetworks\Output\BradLaw\Pillaga24";
//string configPath = @"C:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisConfigFiles\Towsey.Acoustic.yml";

string recordingPath = @"C:\Ecoacoustics\WavFiles\LizZnidersic\TasmanIsland2015_Unit2_Mez\SM304256_0+1_20151114_001652.wav";
string outputPath = @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\01";
string recordingPath = @"C:\Ecoacoustics\WavFiles\LizZnidersic\TasmanIsland2015_Unit2_Mez\SM304256_0+1_20151114_031652.wav";
string outputPath = @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\04";
string configPath = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\Towsey.Acoustic.yml";

// Ivan Campos recordings
Expand Down Expand Up @@ -529,7 +529,7 @@ public static void DrawStandardSpectrograms()
MelBinCount = 256,
NoiseReductionType = NoiseReductionType.Median,
NoiseReductionParameter = 0.0,
};
};

//var amplSpectrogram = new AmplitudeSpectrogram(settings, recording);
//var dbSpectrogram = new DecibelSpectrogram(settings, recording);
Expand Down Expand Up @@ -669,7 +669,7 @@ public static void DrawLongDurationSpectrogram()
}

/// <summary>
/// This action item = "concatenateIndexFiles"
/// This action item = "concatenateIndexFiles".
/// </summary>
public static void ConcatenateIndexFilesAndSpectrograms()
{
Expand All @@ -693,7 +693,7 @@ public static void ConcatenateIndexFilesAndSpectrograms()

// SET DEFAULT COLOUR MAPS
string colorMap1 = SpectrogramConstants.RGBMap_ACI_ENT_EVN;
string colorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_R3D;
string colorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_RHZ;

// there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps.
string gapRendering = "TimedGaps"; // the default
Expand Down Expand Up @@ -743,11 +743,33 @@ public static void ConcatenateIndexFilesAndSpectrograms()
// ########################## END of Yvonne's recordings of SM2 and SM4
*/

// ########################## CONCATENATION of 24-hour TEST recordings from Liz Znidersic
// top level directory
string[] dataDirs =
{
@"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez",
};
string directoryFilter = "0*"; // this is a directory filter to locate only the required files
string opFileStem = "Testing";
string opPath = @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\Concat";
var falseColourSpgConfig = $"C:\\Work\\GitHub\\audio-analysis\\src\\AnalysisConfigFiles\\SpectrogramFalseColourConfig.yml";
concatenateEverythingYouCanLayYourHandsOn = true;

// start and end dates INCLUSIVE
dtoStart = new DateTimeOffset(2016, 12, 31, 0, 0, 0, TimeSpan.Zero);
dtoEnd = new DateTimeOffset(2016, 12, 31, 0, 0, 0, TimeSpan.Zero);

// there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps.
gapRendering = "TimedGaps";

// ########################## END of 24-hour TEST recordings

/*
// ########################## CONCATENATION of MARINA SCARPELLI recordings from Brazil
// The drive: work = G; home = E
drive = "C";
// top level directory AVAILAE JOB #
// top level directory
string[] dataDirs =
{
$"{drive}:\\Ecoacoustics\\Collaborations\\MarinaScarpelli\\Indices",
Expand All @@ -756,8 +778,6 @@ public static void ConcatenateIndexFilesAndSpectrograms()
string opFileStem = "LEEC02_20161231_";
string opPath = $"{drive}:\\Ecoacoustics\\Collaborations\\MarinaScarpelli\\Concat";
var falseColourSpgConfig = $"{drive}:\\Work\\GitHub\\audio-analysis\\src\\AnalysisConfigFiles\\SpectrogramFalseColourConfig.yml";
FileInfo sunriseDatafile = null;

concatenateEverythingYouCanLayYourHandsOn = true;
// start and end dates INCLUSIVE
Expand All @@ -767,36 +787,38 @@ public static void ConcatenateIndexFilesAndSpectrograms()
// there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps.
gapRendering = "TimedGaps";
// ########################## END of Pillaga Forest recordings
// ########################## END of MARINA SCARPELLI recordings
*/

/*
// ########################## CONCATENATION of Pillaga Forest recordings from Brad Law
// The drive: work = G; home = E
drive = "G";
// ########################## CONCATENATION of Pillaga Forest recordings from Brad Law
// The drive: work = G; home = E
drive = "G";
// top level directory AVAILAE JOB #181
string[] dataDirs =
{
$"{drive}:\\Ecoacoustics\\Output\\BradLaw\\PillagaData",
};
string directoryFilter = "Pillaga*"; // this is a directory filter to locate only the required files
string opFileStem = "PillagaForest20121125";
string opPath = $"{drive}:\\Ecoacoustics\\Output\\BradLaw";
var falseColourSpgConfig =
$"{drive}:\\Ecoacoustics\\Output\\Bats\\config\\SpectrogramFalseColourConfig.yml";
FileInfo sunriseDatafile = null;
concatenateEverythingYouCanLayYourHandsOn = true;
// start and end dates INCLUSIVE
dtoStart = new DateTimeOffset(2012, 08, 08, 0, 0, 0, TimeSpan.Zero);
dtoEnd = new DateTimeOffset(2012, 08, 08, 0, 0, 0, TimeSpan.Zero);
// there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps.
gapRendering = "EchoGaps";
// ########################## END of Pillaga Forest recordings
*/

// top level directory AVAILAE JOB #181
string[] dataDirs =
{
$"{drive}:\\Ecoacoustics\\Output\\BradLaw\\PillagaData",
};
string directoryFilter = "Pillaga*"; // this is a directory filter to locate only the required files
string opFileStem = "PillagaForest20121125";
string opPath = $"{drive}:\\Ecoacoustics\\Output\\BradLaw";
var falseColourSpgConfig =
$"{drive}:\\Ecoacoustics\\Output\\Bats\\config\\SpectrogramFalseColourConfig.yml";
FileInfo sunriseDatafile = null;
concatenateEverythingYouCanLayYourHandsOn = true;
// start and end dates INCLUSIVE
dtoStart = new DateTimeOffset(2012, 08, 08, 0, 0, 0, TimeSpan.Zero);
dtoEnd = new DateTimeOffset(2012, 08, 08, 0, 0, 0, TimeSpan.Zero);
// there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps.
gapRendering = "EchoGaps";
// ########################## END of Pillaga Forest recordings
*/
/*
// ########################## CONCATENATION of Yvonne's BAT recordings
// The drive: work = G; home = E
Expand Down Expand Up @@ -1094,11 +1116,12 @@ public static void ConcatenateIndexFilesAndSpectrograms()
public static void ConcatenateGreyScaleSpectrogramImages()
{

var ipDirInfo = new DirectoryInfo(@"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\01\Towsey.Acoustic");
var opDirInfo = new DirectoryInfo(@"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\01\Towsey.Acoustic");
var opFileName = "SM304256_0+1_20151114_001652";
var ipDirInfo = new DirectoryInfo(@"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\04\Towsey.Acoustic");
var opDirInfo = new DirectoryInfo(@"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\04\Towsey.Acoustic");
var opFileName = "SM304256_0+1_20151114_031652";

//string[] keys = { "ACI", "BGN", "CVR", "ENT", "EVN", "OSC", "PMN", "R3D", "RHZ", "RNG", "RPS", "RVT", "SPT" };
// the following line gets all current spectral indices, including DIF and SUM which we will want to exclude.
var keys = SpectralIndexValues.Keys;

//Read list of images into List
Expand Down Expand Up @@ -1135,12 +1158,12 @@ public static void ConcatenateGreyScaleSpectrogramImages()
}
}

/// <summary>
/// read a set of Spectral index files and extract values from frequency band
/// This work done for Liz Znidersic paper.
/// End of the method requires access to Liz tagging info.
/// </summary>
public static void ExtractSpectralFeatures()
/// <summary>
/// read a set of Spectral index files and extract values from frequency band
/// This work done for Liz Znidersic paper.
/// End of the method requires access to Liz tagging info.
/// </summary>
public static void ExtractSpectralFeatures()
{
// parameters
string dir =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public static class SpectrogramConstants
public const string RGBMap_ACI_ENT_EVN = "ACI-ENT-EVN"; //R-G-B
public const string RGBMap_ACI_ENT_SPT = "ACI-ENT-SPT"; //R-G-B

// Prior to March 2015 POW was called AVG. It was changed because value is signal power and therefore POW is more descriptive.
// A second set of RGB mappings based on BGN and PMN.
public const string RGBMap_BGN_PMN_EVN = "BGN-PMN-EVN"; //R-G-B
public const string RGBMap_BGN_PMN_SPT = "BGN-PMN-SPT"; //R-G-B
public const string RGBMap_BGN_PMN_CLS = "BGN-PMN-CLS"; //R-G-B
public const string RGBMap_BGN_PMN_R3D = "BGN-PMN-R3D";
public const string RGBMap_BGN_PMN_RHZ = "BGN-PMN-RHZ";
public const string RGBMap_BGN_PMN_OSC = "BGN-PMN-OSC";
public const string RGBMap_BGN_PMN_CVR = "BGN-PMN-CVR"; //R-G-B

// these parameters manipulate the colour map and appearance of the false-colour LONG DURATION spectrogram
Expand Down
2 changes: 1 addition & 1 deletion tests/Acoustics.Test/InfiniteTextStreamTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void Generate()
}
}

var work = Task.Run(Generate, token);
var work = Task.Run((Action)Generate, token);

Assert.IsFalse(work.IsCompleted);
source.CancelAfter(this.timeout);
Expand Down

0 comments on commit 047e36c

Please sign in to comment.