Skip to content

Commit

Permalink
Mostly resharper stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
towsey committed Mar 26, 2019
1 parent 934f466 commit 3bc6a90
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 37 deletions.
11 changes: 6 additions & 5 deletions src/AnalysisBase/AnalyzerConfig.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// <copyright file="AnalyzerConfig.cs" company="QutEcoacoustics">
// <copyright file="AnalyzerConfig.cs" company="QutEcoacoustics">
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
// </copyright>

namespace AnalysisBase
{
using System.IO;
using Acoustics.Shared.ConfigFile;

public class AnalyzerConfig
Expand All @@ -16,12 +17,12 @@ public class AnalyzerConfig
public double EventThreshold { get; set; } = EventThresholdDefault;

/// <summary>
/// Gets or sets the length of audio block to process
/// Gets or sets the length of audio block to process.
/// </summary>
public double? SegmentDuration { get; set; }

/// <summary>
/// Gets or sets the amount that each audio block should overlap
/// Gets or sets the amount that each audio block should overlap.
/// </summary>
public double? SegmentOverlap { get; set; }

Expand All @@ -45,7 +46,7 @@ public class AnalyzerConfig
public SaveBehavior SaveSonogramImages { get; set; } = SaveBehavior.Never;

/// <summary>
/// Gets or sets a value indicating whether a file must have a date in the file name
/// Gets or sets a value indicating whether a file must have a date in the file name.
/// </summary>
/// <remarks>
/// if true, an unambiguous date time must be provided in the source file's name.
Expand All @@ -55,7 +56,7 @@ public class AnalyzerConfig
/// prefix_20140101T235959+1000.mp3
/// prefix_20140101T235959+Z.mp3
/// prefix_20140101-235959+1000.mp3
/// prefix_20140101-235959+Z.mp3
/// prefix_20140101-235959+Z.mp3.
/// </remarks>
public bool RequireDateInFilename { get; set; } = false;
}
Expand Down
32 changes: 15 additions & 17 deletions src/AudioAnalysisTools/Indices/IndexCalculateConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@ namespace AudioAnalysisTools.Indices
{
using System;
using Acoustics.Shared.ConfigFile;

using DSP;
using AudioAnalysisTools.DSP;
using AudioAnalysisTools.LongDurationSpectrograms;
using Equ;

using Fasterflect;

using log4net;

using Newtonsoft.Json;

using YamlDotNet.Serialization;

/// <summary>
/// CONFIG CLASS FOR the class IndexCalculate.cs
/// CONFIG CLASS FOR the class IndexCalculate.cs.
/// </summary>
public class IndexCalculateConfig : AnalyzerConfigIndexProperties, IEquatable<IndexCalculateConfig>, ICloneable
{
Expand Down Expand Up @@ -60,7 +56,7 @@ public class IndexCalculateConfig : AnalyzerConfigIndexProperties, IEquatable<In

/// <summary>
/// Initializes a new instance of the <see cref="IndexCalculateConfig"/> class.
/// CONSTRUCTOR
/// CONSTRUCTOR.
/// </summary>
public IndexCalculateConfig()
{
Expand All @@ -84,7 +80,7 @@ public IndexCalculateConfig()
/// <summary>
/// Gets or sets the Timespan (in seconds) over which summary and spectral indices are calculated
/// Default=60.0
/// Units=seconds
/// Units=seconds.
/// </summary>
[YamlIgnore]
[JsonIgnore]
Expand Down Expand Up @@ -122,34 +118,34 @@ public double IndexCalculationDuration
/// Ten seconds is considered a minimum interval to obtain a reliable estimate of BG noise.
/// The BG noise interval is not extended beyond start or end of recording segment.
/// Consequently for a 60sec Index calculation duration, the BG noise is calculated form the 60sec segment only.
/// Default=5 seconds
/// Default=5 seconds.
/// </remarks>
public double BgNoiseNeighborhood { get; set; }

/// <summary>
/// Gets or sets the FrameWidth - the number of samples to use per FFT window.
/// FrameWidth is used WITHOUT overlap to calculate the spectral indices.
/// Default value = 512.
/// Units=samples
/// Units=samples.
/// </summary>
public int FrameLength { get; set; }

/// <summary>
/// Gets or sets the LowFreqBound.
/// Default value = 1000.
/// Units=Herz
/// Units=Herz.
/// </summary>
public int LowFreqBound { get; set; }

/// <summary>
/// Gets or sets the MidFreqBound.
/// Default value = 8000.
/// Units=Herz
/// Units=Herz.
/// </summary>
public int MidFreqBound { get; set; }

/// <summary>
/// Gets or sets frequency scale is Linear or OCtave
/// Gets or sets frequency scale is Linear or Octave.
/// </summary>
public FreqScaleType FrequencyScale
{
Expand Down Expand Up @@ -185,17 +181,18 @@ public FreqScaleType FrequencyScale
/// Gets or sets the number of Mel-scale filter banks to use.
/// </summary>
/// <remarks>
/// The default, 0, implies no operation
/// The default, 0, implies no operation.
/// </remarks>
public int MelScale { get; set; }

/*
/// <summary>
/// WARNING: This method does not incorporate all the parameters in the config.yml file.
/// Only those that are likely to change.
/// If you want to change a config parameter in the yml file make sure it appears in this method.
/// </summary>
/// <param name="configuration">the Config config</param>
/// <param name="writeParameters">default = false</param>
/// <param name="configuration">the Config config.</param>
/// <param name="writeParameters">default = false.</param>
[Obsolete("Incorporation of statically typed config should obviate need for this method")]
public static IndexCalculateConfig GetConfig(Config configuration, bool writeParameters = false)
{
Expand Down Expand Up @@ -232,6 +229,7 @@ public static IndexCalculateConfig GetConfig(Config configuration, bool writePa
return config;
}
*/

public bool Equals(IndexCalculateConfig other)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LDSpectrogramConfig.cs" company="QutEcoacoustics">
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
// </copyright>
Expand All @@ -9,19 +9,18 @@ namespace AudioAnalysisTools.LongDurationSpectrograms
using System;
using System.Collections.Generic;
using System.IO;
using Acoustics.Shared;
using Acoustics.Shared.ConfigFile;
using Newtonsoft.Json;
using YamlDotNet.Serialization;

/// <summary>
/// CONFIG CLASS FOR the class LDSpectrogramRGB
/// CONFIG CLASS FOR the class LDSpectrogramRGB.
/// </summary>
public class LdSpectrogramConfig : Config
{
/// <summary>
/// Initializes a new instance of the <see cref="LdSpectrogramConfig"/> class.
/// CONSTRUCTOR
/// CONSTRUCTOR.
/// </summary>
public LdSpectrogramConfig()
{
Expand All @@ -37,12 +36,12 @@ public LdSpectrogramConfig()
/// <summary>
/// Gets or sets the type of freq scale.
/// # Eventual options will be: Linear, Mel, Linear62Octaves31Nyquist11025, Linear125Octaves30Nyquist11025, Octaves24Nyquist32000, Linear125Octaves28Nyquist32000
/// # Only "Linear", "Linear125Octaves6Tones28Nyquist11025", "Linear125Octaves7Tones28Nyquist32000" work at present
/// # Only "Linear", "Linear125Octaves6Tones28Nyquist11025", "Linear125Octaves7Tones28Nyquist32000" work at present.
/// </summary>
public string FreqScale { get; set; }

/// <summary>
/// Gets or sets parameter to manipulate the colour map and appearance of the false-colour spectrogram
/// Gets or sets parameter to manipulate the colour map and appearance of the false-colour spectrogram.
/// </summary>
public string ColorMap1 { get; set; }

Expand All @@ -54,7 +53,7 @@ public LdSpectrogramConfig()

/// <summary>
/// Gets or sets value of the colour filter.
/// Its value must be less than 1.0. Good value is 0.75
/// Its value must be less than 1.0. Good value is 0.75.
/// </summary>
public double? ColourFilter { get; set; }

Expand All @@ -63,7 +62,7 @@ public LdSpectrogramConfig()
/// The default assumes one minute spectra i.e. 60 per hour
/// But as of January 2015, this is not fixed. The user can adjust
/// the tic interval to be appropriate to the time scale of the spectrogram.
/// May 2017: XAxisTicIntervalSeconds is the new configuration option!
/// May 2017: XAxisTicIntervalSeconds is the new configuration option!.
/// </summary>
[YamlIgnore]
[JsonIgnore]
Expand All @@ -78,19 +77,19 @@ public TimeSpan XAxisTicInterval
/// The default assumes one minute spectra i.e. 60 per hour
/// But as of January 2015, this is not fixed. The user can adjust
/// the tic interval to be appropriate to the time scale of the spectrogram.
/// May 2017: Now measured in seconds and usage XAxisTicIntervalSeconds is preferred
/// May 2017: Now measured in seconds and usage XAxisTicIntervalSeconds is preferred.
/// </summary>
public double XAxisTicIntervalSeconds { get; set; }

/// <summary>
/// Gets or sets YAxisTicInterval in Hertz.
/// The vertical spacing between horizontal grid lines for the y-Axis
/// mark 1 kHz intervals
/// mark 1 kHz intervals.
/// </summary>
public int YAxisTicInterval { get; set; }

/// <summary>
/// In seconds, the horizontal spacing between vertical grid lines for the x-Axis
/// In seconds, the horizontal spacing between vertical grid lines for the x-Axis.
/// </summary>
public double CalculateYAxisTickInterval(double sampleRate, double frameWidth)
{
Expand All @@ -99,7 +98,7 @@ public double CalculateYAxisTickInterval(double sampleRate, double frameWidth)
}

/// <summary>
/// READS A YAML CONFIG FILE into a Config variable and then transfers all values into the appropriate config class
/// READS A YAML CONFIG FILE into a Config variable and then transfers all values into the appropriate config class.
/// </summary>
/// <returns>
/// The <see cref="LdSpectrogramConfig"/>.
Expand All @@ -120,7 +119,7 @@ public static LdSpectrogramConfig GetDefaultConfig()
}

/// <summary>
/// Gets a default config for long-duration false-colour spectrograms
/// Gets a default config for long-duration false-colour spectrograms.
/// </summary>
public static LdSpectrogramConfig GetDefaultConfig(string colourMap1, string colourMap2)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public class LDSpectrogramRGB
// string[] keys = { "ACI", "ENT", "EVN", "BGN", "POW", "EVN" }; // the OLD default i.e. since July 2015
// More recently (2018 onwards) other combinations have been used expecially for the blue channel index.
// public static readonly string DefaultColorMap1 = "ACI, ENT, EVN";
// public static readonly string DefaultColorMap2 = "BGN, PMN, R3D";
// public static readonly string DefaultColorMap2 = "BGN, PMN, SPT";

// the defaults
public static readonly string DefaultColorMap1 = SpectrogramConstants.RGBMap_ACI_ENT_EVN;
public static readonly string DefaultColorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_R3D;
public static readonly string DefaultColorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_SPT;

public static string[] GetArrayOfAvailableKeys()
{
Expand Down

0 comments on commit 3bc6a90

Please sign in to comment.