Skip to content

Commit

Permalink
Add new property to AcousticIndicesConfig class
Browse files Browse the repository at this point in the history
Add new property so as to be able to access LDFC spectrogram config parameters
  • Loading branch information
towsey committed Mar 26, 2019
1 parent 03f7190 commit 5630edd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
20 changes: 14 additions & 6 deletions src/AnalysisPrograms/AcousticIndices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace AnalysisPrograms
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
Expand All @@ -21,7 +20,6 @@ namespace AnalysisPrograms
using System.Reflection;
using Acoustics.Shared;
using Acoustics.Shared.ConfigFile;
using Acoustics.Shared.Contracts;
using Acoustics.Shared.Csv;
using AnalysisBase;
using AnalysisBase.ResultBases;
Expand All @@ -33,7 +31,6 @@ namespace AnalysisPrograms
using AudioAnalysisTools.TileImage;
using AudioAnalysisTools.WavTools;
using log4net;
using Production;
using TowseyLibrary;
using Zio;

Expand Down Expand Up @@ -75,6 +72,19 @@ public AnalyzerConfig ParseConfig(FileInfo file)
[Serializable]
public class AcousticIndicesConfig : IndexCalculateConfig
{
private LdSpectrogramConfig ldfcsConfig = new LdSpectrogramConfig();

/// <summary>
/// Gets or sets the LDFC spectrogram configuration.
/// </summary>
public LdSpectrogramConfig LdSpectrogramConfig
{
get => this.ldfcsConfig;
protected set => this.ldfcsConfig = value;
}

public bool TileOutput { get; private set; } = false;

public void Validate(TimeSpan defaultIndexCalculationDuration)
{
SpectralIndexValues.CheckExistenceOfSpectralIndexValues(this.IndexProperties);
Expand Down Expand Up @@ -106,8 +116,6 @@ public void Validate(TimeSpan defaultIndexCalculationDuration)
+ "ICD != 60.0 so the images won'tbe created");
}
}

public bool TileOutput { get; private set; } = false;
}

public AnalysisResult2 Analyze<T>(AnalysisSettings analysisSettings, SegmentSettings<T> segmentSettings)
Expand Down Expand Up @@ -263,7 +271,7 @@ public void SummariseResults(AnalysisSettings settings, FileSegment inputFileSeg
sampleRate = acousticIndicesConfig.ResampleRate ?? sampleRate;

// Gather settings for rendering false color spectrograms
var ldSpectrogramConfig = LdSpectrogramConfig.GetDefaultConfig();
var ldSpectrogramConfig = acousticIndicesConfig.LdSpectrogramConfig;

string basename = Path.GetFileNameWithoutExtension(sourceAudio.Name);

Expand Down
7 changes: 4 additions & 3 deletions src/AnalysisPrograms/Sandpit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override Task<int> Execute(CommandLineApplication app)
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 @@ -80,7 +80,7 @@ public override Task<int> Execute(CommandLineApplication app)
//DrawLongDurationSpectrogram();
//DrawClusterSequence();
//DrawStandardSpectrograms();
Test_DrawFourSpectrograms();
//Test_DrawFourSpectrograms();

//ExtractSpectralFeatures();
//HerveGlotinMethods();
Expand Down Expand Up @@ -326,7 +326,8 @@ public static void Audio2CsvOverOneFile()

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

// Ivan Campos recordings
Expand Down

0 comments on commit 5630edd

Please sign in to comment.