diff --git a/src/Acoustics.Shared/Extensions/ZioExtensions.cs b/src/Acoustics.Shared/Extensions/ZioExtensions.cs index cdb5cebdb..b2d834311 100644 --- a/src/Acoustics.Shared/Extensions/ZioExtensions.cs +++ b/src/Acoustics.Shared/Extensions/ZioExtensions.cs @@ -1,4 +1,4 @@ -// +// // 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). // @@ -64,6 +64,16 @@ public static FileInfo ToFileInfo(this FileEntry file) return new FileInfo(file.Path.ToOsPath()); } + public static DirectoryInfo ToDirectoryInfo(this DirectoryEntry directory) + { + Contract.Requires(directory != null); + Contract.Requires( + directory.FileSystem is PhysicalFileSystem, + $"To convert the path {directory} back to a physical filesystem, it must be from a physical file system"); + + return new DirectoryInfo(directory.Path.ToOsPath()); + } + public static DirectoryEntry Combine(this DirectoryEntry directoryInfo, params string[] str) { Contract.Requires(directoryInfo != null); diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfig.HiRes.yml b/src/AnalysisConfigFiles/IndexPropertiesConfig.HiRes.yml index a7def3395..32f89ab8d 100644 --- a/src/AnalysisConfigFiles/IndexPropertiesConfig.HiRes.yml +++ b/src/AnalysisConfigFiles/IndexPropertiesConfig.HiRes.yml @@ -33,7 +33,6 @@ StartOffsetMinute: NormMax: 200.0 ProjectID: Acoustic Indices Units: "min" - IncludeInComboIndex: false StartOffsetSecond: Name: Segment start second Comment: "Total seconds from start of recording to start of this segment." @@ -44,8 +43,6 @@ StartOffsetSecond: NormMax: 200.0 ProjectID: Acoustic Indices Units: "sec" - IncludeInComboIndex: false - ComboWeight: 0.0 SegmentDuration: Name: Time duration of audio segment Comment: "Exact time span (total minutes) of this audio segment - typically 1.0 minutes." @@ -56,8 +53,6 @@ SegmentDuration: NormMax: 1.0 ProjectID: Acoustic Indices Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 HighAmplitudeIndex: Name: High Amplitude Index Comment: "Av number of samples/sec where abs. amplitude is within 10*epislon of the max signal value." @@ -68,8 +63,6 @@ HighAmplitudeIndex: NormMax: 1.0 ProjectID: Acoustic Indices Units: "av/s" - IncludeInComboIndex: false - ComboWeight: 0.0 ClippingIndex: Name: Clipping Index Comment: "Av number of clipped samples/sec i.e. where the abs. amplitude of two conscutive samples is within 4*epislon of the max signal value." @@ -80,8 +73,6 @@ ClippingIndex: NormMax: 1.0 ProjectID: Acoustic Indices Units: "avClips/s" - IncludeInComboIndex: false - ComboWeight: 0.0 AvgSignalAmplitude: Name: av Signal Ampl Comment: "Av amplitude of the signal envelope in dB." @@ -94,8 +85,6 @@ AvgSignalAmplitude: NormMax: -10.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 BackgroundNoise: Name: Background Noise Comment: "Av amplitude of the noise removed from the audio segment using the method of Lamel et al." @@ -107,8 +96,6 @@ BackgroundNoise: NormMax: -10.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 Snr: Name: Maximum SNR Comment: "Max amplitude of signal envelope after noise removal." @@ -119,8 +106,6 @@ Snr: NormMax: 50.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 AvgSnrOfActiveFrames: Name: av SNR (Active frames) Comment: "Av amplitude of active frames in signal envelope after noise removal. Active frames are those with amplitude > threshold 3 dB." @@ -131,8 +116,6 @@ AvgSnrOfActiveFrames: NormMax: 30.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 Activity: Name: Activity Comment: "% of active frames i.e. where SNR exceeds threshold = 3 dB." @@ -143,8 +126,6 @@ Activity: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EventsPerSecond: Name: Events per sec Comment: "Av number of events per second. An event is any consecutive sequence of active frames having duration > threshold = 100 ms." @@ -155,8 +136,6 @@ EventsPerSecond: NormMax: 5.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 AvgEventDuration: Name: Av Event Duration Comment: "Av duration in ms of the events in an audio segment." @@ -167,8 +146,6 @@ AvgEventDuration: NormMax: 1000 ProjectID: Acoustic Indices Units: "ms" - IncludeInComboIndex: false - ComboWeight: 0.0 HighFreqCover: Name: hf Cover Comment: "% hf Cover 4000 Hz to 8800 Hz" @@ -179,8 +156,6 @@ HighFreqCover: NormMax: 0.5 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 MidFreqCover: Name: mf Cover Comment: "% mf Cover. 500 Hz to 4000 Hz" @@ -191,8 +166,6 @@ MidFreqCover: NormMax: 0.50 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 LowFreqCover: Name: lf Cover Comment: "% lf Cover. 0 - 500 Hz" @@ -203,8 +176,6 @@ LowFreqCover: NormMax: 0.50 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 AcousticComplexity: Name: ACI Comment: "ACI" @@ -215,8 +186,6 @@ AcousticComplexity: NormMax: 0.7 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: true - ComboWeight: 0.2 TemporalEntropy: Name: 1-H[t] Comment: "1-Ht is a measure of concentration of acoustic energy instead of energy dispersal." @@ -227,8 +196,6 @@ TemporalEntropy: NormMax: 0.5 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 SqrtTempEntropy: Name: Sqrt(1-H[t]) Comment: "Sqrt(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = sqrt(0.5)" @@ -239,8 +206,6 @@ SqrtTempEntropy: NormMax: 0.7 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 LogTempEntropy: Name: Log(1-H[t]) Comment: "Log(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = log(1 + 0.5)" @@ -251,8 +216,6 @@ LogTempEntropy: NormMax: 0.176 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfAverageSpectrum: Name: 1-H[avg spectrum] Comment: "1-H[spectral avg] is a measure of concentration of acoustic energy in the average spectrum over one minute." @@ -263,8 +226,6 @@ EntropyOfAverageSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfVarianceSpectrum: Name: 1-H[var spectrum] Comment: "1-H[spectral var] is a measure of concentration of acoustic energy in the variance spectrum over one minute." @@ -275,8 +236,6 @@ EntropyOfVarianceSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfPeaksSpectrum: Name: 1-H[peak freq spectrum] Comment: "1-H[peak freq] is a measure of concentration of peak frequencies over one minute." @@ -287,8 +246,6 @@ EntropyOfPeaksSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfCoVSpectrum: Name: 1-H[CoV spectrum] Comment: "1-H[CoV sp] is a measure of concentration of energy in the Coeff of Variance Spectrum." @@ -299,8 +256,6 @@ EntropyOfCoVSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 #ClusterCount: # Name: Cluster Count # Comment: "Number of spectrum clusters in one minute audio segment as determined by a clustering algorithm." @@ -311,8 +266,6 @@ EntropyOfCoVSpectrum: # NormMax: 50 # ProjectID: Acoustic Indices # Units: "" -# IncludeInComboIndex: true -# ComboWeight: 0.3 #AvgClusterDuration: # Name: av Cluster Duration # Comment: "Average duration in ms of the spectrum cluster sequences." @@ -323,8 +276,6 @@ EntropyOfCoVSpectrum: # NormMax: 250 # ProjectID: Acoustic Indices # Units: "ms" -# IncludeInComboIndex: false -# ComboWeight: 0.0 #ThreeGramCount: # Name: 3-gram Count # Comment: "Number of different tri-gram cluster sequences." @@ -335,8 +286,6 @@ EntropyOfCoVSpectrum: # NormMax: 1000 # ProjectID: Acoustic Indices # Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 SptDensity: Name: SPT density Comment: "Average number of spectral peaks tracks traversing a frame." @@ -347,8 +296,6 @@ SptDensity: NormMax: 2.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 #SptPerSecond: # Name: av Tracks/Sec # Comment: "Average number of spectral tracks per second." @@ -359,44 +306,6 @@ SptDensity: # NormMax: 50 # ProjectID: Acoustic Indices # Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#AvgSptDuration: -# Name: av Track Duration -# Comment: "Average duration of a spectral track." -# DataType: TimeSpan -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0.25 -# NormMax: 2.0 -# ProjectID: Acoustic Indices -# Units: "s" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -RainIndex: - Name: Rain Index - Comment: "OBSOLETE! DEPRACATED! Rain score calculated every 10 sec and 6 values averaged over the minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -CicadaIndex: - Name: Cicada Index - Comment: "OBSOLETE! DEPRACATED! Cicada score calculated every 10 sec and 6 values averaged over the minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 NDSI: Name: NDSI Comment: "Normalised Difference Soundscape Index) calculated from PSD - originated from Stuart Gage." @@ -455,10 +364,10 @@ FileName: DoDisplay: false ProjectID: Acoustic Indices Units: "" -# ADD THE SUMMARY INDICES ABOVE HERE +# ADD NEW SUMMARY INDICES ABOVE HERE # ==================================================================================================================================== # ==================================================================================================================================== -# ADD THE SPECTRAL INDICES BELOW HERE +# ADD NEW SPECTRAL INDICES BELOW HERE # IMPORTANT: SPECTRAL INDCIES MUST BE OF TYPE Double[] # When CalculateNormMin: and CalculateNormMax: are set true, the normalisation bounds @@ -475,8 +384,7 @@ ACI: DoDisplay: true NormMin: 0.4 NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" BGN: @@ -489,8 +397,7 @@ BGN: # Usual values are min=-120, max=-40. However need to adjust down about -20dB for more sensitive microphones NormMin: -140.0 NormMax: -60.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "dB" CVR: ## Not needed for high resolution indices @@ -502,20 +409,18 @@ CVR: ## Not needed for high resolution indices DoDisplay: true NormMin: 0.0 NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" DIF: Name: spectralDIF - Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This spgram not displayed. It is used as intermediate for subsequent calculation of ACI." + Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This is NOT an acoustic index. It is used as intermediate for subsequent calculation of ACI." DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" ENT: @@ -526,8 +431,7 @@ ENT: DoDisplay: true NormMin: 0.0 NormMax: 0.6 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" EVN: @@ -538,8 +442,7 @@ EVN: DoDisplay: true NormMin: 2.0 NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "events/s" OSC: @@ -550,20 +453,18 @@ OSC: DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" SUM: Name: spectralSUM - Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This spgram not displayed. It is used for intermediate calculations only." + Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This is NOT an acoustic index. It is used for intermediate calculations only." DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" PMN: @@ -574,8 +475,7 @@ PMN: DoDisplay: true NormMin: 0.0 NormMax: 5.5 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "dB" RHZ: @@ -586,8 +486,7 @@ RHZ: DoDisplay: true NormMin: 2.0 NormMax: 8.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "tracks/s" RVT: @@ -598,8 +497,7 @@ RVT: DoDisplay: true NormMin: 2.0 NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "tracks/s" RPS: @@ -610,8 +508,7 @@ RPS: DoDisplay: true NormMin: 2.0 NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "tracks/s" RNG: @@ -622,8 +519,7 @@ RNG: DoDisplay: true NormMin: 2.0 NormMax: 5.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "tracks/s" R3D: @@ -634,8 +530,7 @@ R3D: DoDisplay: true NormMin: 0.15 NormMax: 1.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "tracks/s" SPT: @@ -646,7 +541,6 @@ SPT: DoDisplay: true NormMin: 2.0 NormMax: 6.0 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "tracks/s" \ No newline at end of file diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfig.Zooming.yml b/src/AnalysisConfigFiles/IndexPropertiesConfig.Zooming.yml index 4b6ccc680..d86671f4b 100644 --- a/src/AnalysisConfigFiles/IndexPropertiesConfig.Zooming.yml +++ b/src/AnalysisConfigFiles/IndexPropertiesConfig.Zooming.yml @@ -13,8 +13,6 @@ RankOrder: # AKA IndexCount NormMax: 100.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 StartOffset: Name: Segment start time Comment: "Exact time span (total minutes) from start of recording to start of this segment." @@ -25,8 +23,6 @@ StartOffset: NormMax: 200.0 ProjectID: Acoustic Indices Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 StartOffsetMinute: Name: Segment start minute Comment: "Total minutes from start of recording to start of this segment." @@ -37,8 +33,6 @@ StartOffsetMinute: NormMax: 200.0 ProjectID: Acoustic Indices Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 StartOffsetSecond: Name: Segment start second Comment: "Total seconds from start of recording to start of this segment." @@ -49,8 +43,6 @@ StartOffsetSecond: NormMax: 200.0 ProjectID: Acoustic Indices Units: "sec" - IncludeInComboIndex: false - ComboWeight: 0.0 SegmentDuration: Name: Time duration of audio segment Comment: "Exact time span (total minutes) of this audio segment - typically 1.0 minutes." @@ -61,8 +53,6 @@ SegmentDuration: NormMax: 1.0 ProjectID: Acoustic Indices Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 HighAmplitudeIndex: Name: High Amplitude Index Comment: "Av number of samples/sec where abs. amplitude is within 10*epislon of the max signal value." @@ -73,8 +63,6 @@ HighAmplitudeIndex: NormMax: 1.0 ProjectID: Acoustic Indices Units: "av/s" - IncludeInComboIndex: false - ComboWeight: 0.0 ZeroSignal: Name: Zero Signal Index Comment: "Indicates if signal segment is flat or zero." @@ -85,8 +73,6 @@ ZeroSignal: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 ClippingIndex: Name: Clipping Index Comment: "Av number of clipped samples/sec i.e. where the abs. amplitude of two conscutive samples is within 4*epislon of the max signal value." @@ -97,8 +83,6 @@ ClippingIndex: NormMax: 1.0 ProjectID: Acoustic Indices Units: "avClips/s" - IncludeInComboIndex: false - ComboWeight: 0.0 AvgSignalAmplitude: Name: av Signal Ampl Comment: "Av amplitude of the signal envelope in dB." @@ -111,8 +95,6 @@ AvgSignalAmplitude: NormMax: -10.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 BackgroundNoise: Name: Background Noise Comment: "Av amplitude of the noise removed from the audio segment using the method of Lamel et al." @@ -124,8 +106,6 @@ BackgroundNoise: NormMax: -10.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 Snr: Name: Maximum SNR Comment: "Max amplitude of signal envelope after noise removal." @@ -136,8 +116,6 @@ Snr: NormMax: 50.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 AvgSnrOfActiveFrames: Name: av SNR (Active frames) Comment: "Av amplitude of active frames in signal envelope after noise removal. Active frames are those with amplitude > threshold 3 dB." @@ -148,8 +126,6 @@ AvgSnrOfActiveFrames: NormMax: 30.0 ProjectID: Acoustic Indices Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 Activity: Name: Activity Comment: "% of active frames i.e. where SNR exceeds threshold = 3 dB." @@ -160,8 +136,6 @@ Activity: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EventsPerSecond: Name: Events per sec Comment: "Av number of events per second. An event is any consecutive sequence of active frames having duration > threshold = 100 ms." @@ -172,8 +146,6 @@ EventsPerSecond: NormMax: 5.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 AvgEventDuration: Name: Av Event Duration Comment: "Av duration in ms of the events in an audio segment." @@ -184,8 +156,6 @@ AvgEventDuration: NormMax: 1000 ProjectID: Acoustic Indices Units: "ms" - IncludeInComboIndex: false - ComboWeight: 0.0 HighFreqCover: Name: hf Cover Comment: "% hf Cover 4000 Hz to 8800 Hz" @@ -196,8 +166,6 @@ HighFreqCover: NormMax: 0.5 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 MidFreqCover: Name: mf Cover Comment: "% mf Cover. 500 Hz to 4000 Hz" @@ -208,8 +176,6 @@ MidFreqCover: NormMax: 0.50 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 LowFreqCover: Name: lf Cover Comment: "% lf Cover. 0 - 500 Hz" @@ -220,8 +186,6 @@ LowFreqCover: NormMax: 0.50 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 AcousticComplexity: Name: ACI Comment: "ACI" @@ -232,8 +196,6 @@ AcousticComplexity: NormMax: 0.7 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: true - ComboWeight: 0.2 TemporalEntropy: Name: 1-H[t] Comment: "1-Ht is a measure of concentration of acoustic energy instead of energy dispersal." @@ -244,8 +206,6 @@ TemporalEntropy: NormMax: 0.5 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 SqrtTempEntropy: Name: Sqrt(1-H[t]) Comment: "Sqrt(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = sqrt(0.5)" @@ -256,8 +216,6 @@ SqrtTempEntropy: NormMax: 0.7 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 LogTempEntropy: Name: Log(1-H[t]) Comment: "Log(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = log(1 + 0.5)" @@ -268,8 +226,6 @@ LogTempEntropy: NormMax: 0.176 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfAverageSpectrum: Name: 1-H[avg spectrum] Comment: "1-H[spectral avg] is a measure of concentration of acoustic energy in the average spectrum over one minute." @@ -280,8 +236,6 @@ EntropyOfAverageSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfVarianceSpectrum: Name: 1-H[var spectrum] Comment: "1-H[spectral var] is a measure of concentration of acoustic energy in the variance spectrum over one minute." @@ -292,8 +246,6 @@ EntropyOfVarianceSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfPeaksSpectrum: Name: 1-H[peak freq spectrum] Comment: "1-H[peak freq] is a measure of concentration of peak frequencies over one minute." @@ -304,8 +256,6 @@ EntropyOfPeaksSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 EntropyOfCoVSpectrum: Name: 1-H[CoV spectrum] Comment: "1-H[CoV sp] is a measure of concentration of energy in the Coeff of Variance Spectrum." @@ -316,8 +266,6 @@ EntropyOfCoVSpectrum: NormMax: 1.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 ClusterCount: Name: Cluster Count Comment: "Number of spectral clusters in one minute audio segment as determined by a clustering algorithm." @@ -328,8 +276,6 @@ ClusterCount: NormMax: 50 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 #AvgClusterDuration: # Name: av Cluster Duration # Comment: "Average duration in ms of the spectrum cluster sequences." @@ -340,8 +286,6 @@ ClusterCount: # NormMax: 250 # ProjectID: Acoustic Indices # Units: "ms" -# IncludeInComboIndex: false -# ComboWeight: 0.0 ThreeGramCount: Name: 3-gram Count Comment: "Number of different tri-gram spectral cluster sequences." @@ -352,8 +296,6 @@ ThreeGramCount: NormMax: 1500 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 SptDensity: Name: SPT density Comment: "Average number of spectral peaks tracks traversing a frame." @@ -364,8 +306,6 @@ SptDensity: NormMax: 10.0 ProjectID: Acoustic Indices Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 #SptPerSecond: # Name: av Tracks/Sec # Comment: "Average number of spectral tracks per second." @@ -376,44 +316,6 @@ SptDensity: # NormMax: 50 # ProjectID: Acoustic Indices # Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#AvgSptDuration: -# Name: av Track Duration -# Comment: "Average duration of a spectral track." -# DataType: TimeSpan -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0.25 -# NormMax: 2.0 -# ProjectID: Acoustic Indices -# Units: "s" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#RainIndex: -# Name: Rain Index -# Comment: "OBSOLETE! DEPRACATED! Rain score calculated every 10 sec and 6 values averaged over the minute." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: false -# NormMin: 0 -# NormMax: 1.0 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#CicadaIndex: -# Name: Cicada Index -# Comment: "OBSOLETE! DEPRACATED! Cicada score calculated every 10 sec and 6 values averaged over the minute." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: false -# NormMin: 0 -# NormMax: 1.0 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 NDSI: Name: NDSI Comment: "Normalised Difference Soundscape Index) calculated from PSD - originated from Stuart Gage." @@ -562,10 +464,10 @@ FileName: DoDisplay: false ProjectID: Acoustic Indices Units: "" -# ADD THE SUMMARY INDICES ABOVE HERE +# ADD NEW SUMMARY INDICES ABOVE HERE # ==================================================================================================================================== # ==================================================================================================================================== -# ADD THE SPECTRAL INDICES BELOW HERE +# ADD NEW SPECTRAL INDICES BELOW HERE # IMPORTANT: SPECTRAL INDCIES MUST BE OF TYPE Double[] ACI: @@ -576,8 +478,7 @@ ACI: DoDisplay: true NormMin: 0.4 NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: true + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" BGN: @@ -587,37 +488,33 @@ BGN: DefaultValue: -100.0 DoDisplay: true # min = SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL - 20 = -80-20 = -100, - # Usual value is -30. However -20 adds more contrast into BGN spectrogram + # Usual max value is -30. NormMin: -100.0 NormMax: -30.0 - CalculateNormMin: true - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "dB" CVR: Name: spectralCVR Comment: "Freq bin COVER: Spectrum of the fraction of active elements in each freq bin where amplitude > threshold = 3 dB." - # IMPORTANT - sometimes this is expressed as a percentage rather than fraction. NEED TO CHECK!! + # IMPORTANT - This should be expressed as a fraction, not a percentage DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 - NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: false + NormMax: 0.2 + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" -# ComboWeight: 0.0 DIF: Name: spectralDIF - Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This spgram not displayed. It is used as intermediate for subsequent calculation of ACI." + Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This is NOT an acoustic index. It is used as intermediate for subsequent calculation of ACI." DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" ENT: @@ -628,8 +525,7 @@ ENT: DoDisplay: true NormMin: 0.0 NormMax: 0.6 - CalculateNormMin: true - CalculateNormMax: false + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" EVN: @@ -640,8 +536,7 @@ EVN: DoDisplay: true NormMin: 0.0 NormMax: 2.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "events/s" OSC: @@ -651,21 +546,19 @@ OSC: DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true + NormMax: 5.0 + CalculateNormBounds: true ProjectID: Acoustic Indices Units: "" SUM: Name: spectralSUM - Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This spgram not displayed. It is used for intermediate calculations only." + Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This is NOT an acoustic index. It is used for intermediate calculations only." DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" PMN: @@ -675,9 +568,8 @@ PMN: DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 - NormMax: 5.5 - CalculateNormMin: true - CalculateNormMax: false + NormMax: 15.0 + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "dB" RHZ: @@ -688,8 +580,7 @@ RHZ: DoDisplay: true NormMin: 0.1 NormMax: 1.5 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" RVT: @@ -700,8 +591,7 @@ RVT: DoDisplay: true NormMin: 0.1 NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" RPS: @@ -712,8 +602,7 @@ RPS: DoDisplay: true NormMin: 0.0 NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" RNG: @@ -724,8 +613,7 @@ RNG: DoDisplay: true NormMin: 0.0 NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" R3D: @@ -736,8 +624,7 @@ R3D: DoDisplay: true NormMin: 0.15 NormMax: 1.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" SPT: @@ -748,7 +635,6 @@ SPT: DoDisplay: true NormMin: 0.05 NormMax: 0.5 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" \ No newline at end of file diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfig.yml b/src/AnalysisConfigFiles/IndexPropertiesConfig.yml index efad48c76..f3b6c7d70 100644 --- a/src/AnalysisConfigFiles/IndexPropertiesConfig.yml +++ b/src/AnalysisConfigFiles/IndexPropertiesConfig.yml @@ -146,6 +146,16 @@ EventsPerSecond: NormMax: 5.0 ProjectID: Acoustic Indices Units: "" +AvgEventDuration: + Name: Av Event Duration + Comment: "Av duration in ms of the events in an audio segment." + DataType: TimeSpan + DefaultValue: 0.0 + DoDisplay: true + NormMin: 0.0 + NormMax: 1000 + ProjectID: Acoustic Indices + Units: "ms" #EventsTotal: # Name: Event Count # Comment: "The total count of acoustic events per minute of recording." @@ -216,6 +226,16 @@ TemporalEntropy: NormMax: 0.5 ProjectID: Acoustic Indices Units: "" +SqrtTempEntropy: + Name: Sqrt(1-H[t]) + Comment: "Sqrt(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = sqrt(0.5)" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: 0.0 + NormMax: 0.7 + ProjectID: Acoustic Indices + Units: "" LogTempEntropy: Name: Log(1-H[t]) Comment: "Log(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = log(1 + 0.5)" @@ -296,36 +316,176 @@ SptDensity: NormMax: 10.0 ProjectID: Acoustic Indices Units: "" -Ndsi: - Name: NDSI - Comment: "Normalised Difference Soundscape Index) calculated from PSD - originated from Stuart Gage." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -#NDSI-LM: -# Name: NDSI-LM -# Comment: "Normalised Difference Soundscape Index) ratio of Mid/Low freq bands." +#SptPerSecond: +# Name: av Tracks/Sec +# Comment: "Average number of spectral tracks per second." # DataType: double # DefaultValue: 0.0 -# DoDisplay: false -# NormMin: -1.0 -# NormMax: 1.0 +# DoDisplay: true +# NormMin: 0 +# NormMax: 50 # ProjectID: Acoustic Indices # Units: "" -#NDSI-MH: -# Name: NDSI-MH -# Comment: "Normalised Difference Soundscape Index) ratio of High/Mid freq bands." +#AvgSptDuration: +# Name: av Track Duration +# Comment: "Average duration of a spectral track." +# DataType: TimeSpan +# DefaultValue: 0.0 +# DoDisplay: true +# NormMin: 0.25 +# NormMax: 2.0 +# ProjectID: Acoustic Indices +# Units: "s" +#CicadaIndex: +# Name: Cicada Index +# Comment: "OBSOLETE! DEPRACATED! Cicada score calculated every 10 sec and 6 values averaged over the minute." # DataType: double # DefaultValue: 0.0 # DoDisplay: false -# NormMin: -1.0 +# NormMin: 0 # NormMax: 1.0 -# ProjectID: Acoustic Indices +# ProjectID: Acoustic Indices # Units: "" +NDSI: + Name: NDSI + Comment: "Normalised Difference Soundscape Index) calculated from PSD - originated from Stuart Gage." + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -1.0 + NormMax: 1.0 + ProjectID: Acoustic Indices + Units: "" +NDSI-LM: + Name: NDSI-LM + Comment: "Normalised Difference Soundscape Index) ratio of Mid/Low freq bands." + DataType: double + DefaultValue: 0.0 + DoDisplay: false + NormMin: -1.0 + NormMax: 1.0 + ProjectID: Acoustic Indices + Units: "" +NDSI-MH: + Name: NDSI-MH + Comment: "Normalised Difference Soundscape Index) ratio of High/Mid freq bands." + DataType: double + DefaultValue: 0.0 + DoDisplay: false + NormMin: -1.0 + NormMax: 1.0 + ProjectID: Acoustic Indices + Units: "" +EventsTotal: + Name: Event Count + Comment: "The total count of acoustic events per minute of recording." + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: 0 + NormMax: 15.0 + ProjectID: Acoustic Indices + Units: "" +EventsTotalThresholded: + Name: Event Count + Comment: "Count of acoustic events (wide range)" + DataType: double + DefaultValue: 0.0 + DoDisplay: false + NormMin: 5 + NormMax: 25 + ProjectID: Acoustic Indices + Units: "" +ZeroCrossingFractionLeft: + Name: Zero Crossing Fraction Left + Comment: "" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: 0.0 + NormMax: 1.0 + ProjectID: Channel Integrity + Units: "" +ZeroCrossingFractionRight: + Name: Zero Crossing Fraction Right + Comment: "" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: 0.0 + NormMax: 1.0 + ProjectID: Channel Integrity + Units: "" +ChannelSimilarity: + Name: Channel Similarity + Comment: "similarityIndex = (min*min)/(max*max), where min=min of two channels and max = max of the two. Summed over all freq bins" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: 0.0 + NormMax: 1.0 + ProjectID: Channel Integrity + Units: "" +ChannelDiffDecibels: + Name: Channel Difference in decibels + Comment: "decibelIndex = dBmax-dBmin, where dBmin=min of two channels and dBmax = max of the two. Summed over all freq bins" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -8.0 + NormMax: 8.0 + ProjectID: Channel Integrity + Units: "decibels" +AverageDecibelBias: + Name: Average Channel Bias in decibels + Comment: "avDecibelBias += (dbLeft-dbRight). Summed over all freq bins" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -8.0 + NormMax: 8.0 + ProjectID: Channel Integrity + Units: "decibels" +MedianDecibelBias: + Name: Median Channel Bias in decibels + Comment: "medianDecibelBias += (medianOfLeftSpectrum-medianOfRightSpectrum). Summed over all freq bins" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -0.2 + NormMax: 0.2 + ProjectID: Channel Integrity + Units: "decibels" +LowFreqDecibelBias: + Name: Low Freq Channel dB Bias + Comment: "lowFreqDbBias += (dbLeft-dbRight). Summed over low freq bins, 0-2kHz" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -10.0 + NormMax: 10.0 + ProjectID: Channel Integrity + Units: "decibels" +MidFreqDecibelBias: + Name: Mid-Freq Channel dB Bias + Comment: "midFreqDbBias += (dbLeft-dbRight). Summed over mid freq bins, 2-7kHz" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -10.0 + NormMax: 10.0 + ProjectID: Channel Integrity + Units: "decibels" +HighFreqDecibelBias: + Name: High Freq Channel dB Bias + Comment: "highFreqDbBias += (dbLeft-dbRight). Summed over high freq bins, 7khz-nyquist" + DataType: double + DefaultValue: 0.0 + DoDisplay: true + NormMin: -5.0 + NormMax: 5.0 + ProjectID: Channel Integrity + Units: "decibels" FileName: Name: File Name Comment: "FILLER TO STOP WARNING MESSAGE! File Name" @@ -334,10 +494,10 @@ FileName: DoDisplay: false ProjectID: Acoustic Indices Units: "" -# ADD THE SUMMARY INDICES ABOVE HERE +# ADD NEW SUMMARY INDICES ABOVE HERE # ==================================================================================================================================== # ==================================================================================================================================== -# ADD THE SPECTRAL INDICES BELOW HERE +# ADD NEW SPECTRAL INDICES BELOW HERE # IMPORTANT: SPECTRAL INDCIES MUST BE OF TYPE Double[] ACI: @@ -348,8 +508,7 @@ ACI: DoDisplay: true NormMin: 0.4 NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" BGN: @@ -359,11 +518,10 @@ BGN: DefaultValue: -100.0 DoDisplay: true # min = SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL - 20 = -80-20 = -100, - # Usual value is -30. However -20 adds more contrast into BGN spectrogram + # Usual max value is around -30 to -40. NormMin: -100.0 NormMax: -30.0 - CalculateNormMin: true - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "dB" CVR: @@ -374,22 +532,19 @@ CVR: DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 - NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: false + NormMax: 0.2 + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" -# ComboWeight: 0.0 DIF: Name: spectralDIF - Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This spgram not displayed. It is used as intermediate for subsequent calculation of ACI." + Comment: "Summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This IS NOT an acoustic index. . It is used as intermediate for subsequent calculation of ACI." DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" ENT: @@ -400,8 +555,7 @@ ENT: DoDisplay: true NormMin: 0.0 NormMax: 0.6 - CalculateNormMin: true - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" EVN: @@ -412,8 +566,7 @@ EVN: DoDisplay: true NormMin: 0.0 NormMax: 2.0 - CalculateNormMin: true - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "events/s" OSC: @@ -422,22 +575,25 @@ OSC: DataType: double[] DefaultValue: 0.0 DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true + NormMin: 0.1 + NormMax: 5.0 + CalculateNormBounds: true + # Merge conflict values from https://github.com/QutEcoacoustics/audio-analysis/pull/233 + #NormMin: 0.0 + #NormMax: 10.0 + #CalculateNormMin: true + #CalculateNormMax: true ProjectID: Acoustic Indices Units: "" SUM: Name: spectralSUM - Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This spgram not displayed. It is used for intermediate calculations only." + Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This IS NOT an acoustic index. It is used for intermediate calculations only." DataType: double[] DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "" PMN: @@ -447,9 +603,8 @@ PMN: DefaultValue: 0.0 DoDisplay: true NormMin: 0.0 - NormMax: 5.5 - CalculateNormMin: true - CalculateNormMax: false + NormMax: 15.0 + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "dB" RHZ: @@ -459,9 +614,12 @@ RHZ: DefaultValue: 0.0 DoDisplay: true NormMin: 0.1 - NormMax: 1.5 - CalculateNormMin: false - CalculateNormMax: false + NormMax: 1.0 + CalculateNormBounds: false + # Merge conflict values from https://github.com/QutEcoacoustics/audio-analysis/pull/233 + #NormMax: 1.5 + #CalculateNormMin: false + #alculateNormMax: false ProjectID: Acoustic Indices Units: "tracks/s" RVT: @@ -472,8 +630,10 @@ RVT: DoDisplay: true NormMin: 0.1 NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: true + # Merge conflict values from https://github.com/QutEcoacoustics/audio-analysis/pull/233 + #CalculateNormMin: false + #CalculateNormMax: false ProjectID: Acoustic Indices Units: "tracks/s" RPS: @@ -484,8 +644,10 @@ RPS: DoDisplay: true NormMin: 0.0 NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: true + # Merge conflict values from https://github.com/QutEcoacoustics/audio-analysis/pull/233 + #CalculateNormMin: false + #CalculateNormMax: false ProjectID: Acoustic Indices Units: "tracks/s" RNG: @@ -496,8 +658,10 @@ RNG: DoDisplay: true NormMin: 0.0 NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: true + # Merge conflict values from https://github.com/QutEcoacoustics/audio-analysis/pull/233 + #CalculateNormMin: false + #CalculateNormMax: false ProjectID: Acoustic Indices Units: "tracks/s" R3D: @@ -508,8 +672,10 @@ R3D: DoDisplay: true NormMin: 0.15 NormMax: 1.0 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: true + # Merge conflict values from https://github.com/QutEcoacoustics/audio-analysis/pull/233 + #CalculateNormMin: false + #CalculateNormMax: false ProjectID: Acoustic Indices Units: "tracks/s" SPT: @@ -520,7 +686,6 @@ SPT: DoDisplay: true NormMin: 0.05 NormMax: 0.5 - CalculateNormMin: false - CalculateNormMax: false + CalculateNormBounds: false ProjectID: Acoustic Indices Units: "tracks/s" \ No newline at end of file diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfigForEasyImages.yml b/src/AnalysisConfigFiles/IndexPropertiesConfigForEasyImages.yml deleted file mode 100644 index e55b3d593..000000000 --- a/src/AnalysisConfigFiles/IndexPropertiesConfigForEasyImages.yml +++ /dev/null @@ -1,244 +0,0 @@ ---- -# WARNING!!! The keys used below MUST BE EXACTLY the SAME as those declared in the class InitialiseIndexProperties (starting at line 30). - -# the root object name maps to the Key property on the IndexProperties class - -BackgroundNoise: - Name: Background Noise - Comment: "Av amplitude of the noise removed from the audio segment using the method of Lamel et al." - DataType: double - DefaultValue: -80 - DoDisplay: true - # SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL + 10 - NormMin: -50.0 - NormMax: -15.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -Snr: - Name: Maximum SNR - Comment: "Max amplitude of signal envelope after noise removal." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 35.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgSnrOfActiveFrames: - Name: av SNR (Active frames) - Comment: "Av amplitude of active frames in signal envelope after noise removal. Active frames are those with amplitude > threshold 3 dB." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 12.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -Activity: - Name: Activity - Comment: "% of active frames i.e. where SNR exceeds threshold = 3 dB." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EventsPerSecond: - Name: Events per sec - Comment: "Av number of events per second. An event is any consecutive sequence of active frames having duration > threshold = 100 ms." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 3.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgEventDuration: - Name: Av Event Duration - Comment: "Av duration in ms of the events in an audio segment." - DataType: TimeSpan - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1000 - ProjectID: Acoustic Indices - Units: "ms" - IncludeInComboIndex: false - ComboWeight: 0.0 -HighFreqCover: - Name: hf Cover - Comment: "% hf Cover 4000 Hz to 8800 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.2 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -MidFreqCover: - Name: mf Cover - Comment: "% mf Cover. 500 Hz to 4000 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.1 - NormMax: 0.3 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -LowFreqCover: - Name: lf Cover - Comment: "% lf Cover. 0 - 500 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.1 - NormMax: 0.3 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -AcousticComplexity: - Name: ACI - Comment: "ACI" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.4 - NormMax: 0.65 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.2 -TemporalEntropy: - Name: 1-H[t] - Comment: "1-Ht is a measure of concentration of acoustic energy instead of energy dispersal." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.1 - NormMax: 0.4 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 -SqrtTempEntropy: - Name: Sqrt(1-H[t]) - Comment: "Sqrt(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = sqrt(0.5)" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.7 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -LogTempEntropy: - Name: Log(1-H[t]) - Comment: "Log(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = log(1 + 0.5)" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.176 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfAverageSpectrum: - Name: 1-H[avg spectrum] - Comment: "1-H[spectral avg] is a measure of concentration of acoustic energy in the average spectrum over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfVarianceSpectrum: - Name: 1-H[var spectrum] - Comment: "1-H[spectral var] is a measure of concentration of acoustic energy in the variance spectrum over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfPeaksSpectrum: - Name: 1-H[peak freq spectrum] - Comment: "1-H[peak freq] is a measure of concentration of peak frequencies over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfCoVSpectrum: - Name: 1-H[CoV spectrum] - Comment: "1-H[CoV sp] is a measure of concentration of energy in the Coeff of Variance Spectrum." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.5 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -SptDensity: - Name: SPT density - Comment: "Average number of spectral peaks tracks traversing a frame." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 2.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -#SptPerSecond: -# Name: av Tracks/Sec -# Comment: "Average number of spectral tracks per second." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 50 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -EventsTotal: - Name: Event Count - Comment: "The total count of acoustic events per minute of recording." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 15.0 - ProjectID: Acoustic Indices - Units: "" diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfigForFrogs.yml b/src/AnalysisConfigFiles/IndexPropertiesConfigForFrogs.yml deleted file mode 100644 index a5e733d0b..000000000 --- a/src/AnalysisConfigFiles/IndexPropertiesConfigForFrogs.yml +++ /dev/null @@ -1,135 +0,0 @@ ---- - # ==================================================================================================================================== - # ==================================================================================================================================== - # ADD THE SPECTRAL INDICES BELOW HERE: IMPORTANT: SPECTRAL INDCIES MUST BE OF TYPE Double[] -- - Key: ACI - Name: spectralACI - Comment: "Spectrum of ACI values, one value for each frequency bin." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.4 - NormMax: 0.7 - ProjectID: Acoustic Indices - Units: "" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: PMN - Name: spectralPMN - Comment: "Spectrum of average dB amplitude in each frequency bin after noise removal." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 70.0 - ProjectID: Acoustic Indices - Units: "dB" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: BGN - Name: spectralBGN - Comment: "Spectrum of dB value of the background 'noise' removed each frequency bin." - DataType: double[] - DefaultValue: -100.0 - DoDisplay: true - # min = SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL - 20 = -80-20 = -100, //-20 adds more contrast into BGN spectrogram - NormMin: -100.0 - NormMax: -20.0 - ProjectID: Acoustic Indices - Units: "dB" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: CVR - Name: spectralCVR - Comment: "Freq bin COVER: Spectrum of the % of active elements in each freq bin - i.e. amplitude > threshold = 3 dB." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 50.0 - ProjectID: Acoustic Indices - Units: "%" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: EVN - Name: spectralEVN - Comment: "Spectrum of acoustic events per second (as defined above) in each frequency band." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 2.0 - ProjectID: Acoustic Indices - Units: "events/s" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: ENT - Name: spectralENT - Comment: "1 - Temporal Entropy. Default value = 0.0 because index = 1-Ht = a measure of concentration of acoustic energy instead of energy dispersal." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.6 - ProjectID: Acoustic Indices - Units: "" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: TRK - Name: spectralTRK - Comment: " The hits of the tracks of the specific frequency band " - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 15505.0 - ProjectID: Frog Indices - Units: "" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: OSC - Name: spectralOSC - Comment: " The oscillation structure of the specific frequency band " - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 18000.0 - ProjectID: Frog Indices - Units: "" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: HAR - Name: spectralHAR - Comment: " The Harmonic structure of the specific frequency band " - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Frog Indices - Units: "" - includeInComboIndex: false - comboWeight: 0.0 -- - Key: ENG - Name: spectralENG - Comment: " The energy based on the tracks of the specific frequency band " - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 430000.0 - ProjectID: Frog Indices - Units: "" - includeInComboIndex: false - comboWeight: 0.0 \ No newline at end of file diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfigForZooming.yml b/src/AnalysisConfigFiles/IndexPropertiesConfigForZooming.yml deleted file mode 100644 index b45caceba..000000000 --- a/src/AnalysisConfigFiles/IndexPropertiesConfigForZooming.yml +++ /dev/null @@ -1,766 +0,0 @@ ---- -# WARNING!!! The keys used below MUST BE EXACTLY the SAME as those declared in the class InitialiseIndexProperties (starting at line 30). - -# the root object name maps to the Key property on the IndexProperties class - -RankOrder: # AKA IndexCount - Name: Rank order of audio segment - Comment: "Rank of minute segment in temporal order from start of recording." - DataType: int - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 100.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -StartOffset: - Name: Segment start time - Comment: "Exact time span (total minutes) from start of recording to start of this segment." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 200.0 - ProjectID: Acoustic Indices - Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 -StartOffsetMinute: - Name: Segment start minute - Comment: "Total minutes from start of recording to start of this segment." - DataType: int - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 200.0 - ProjectID: Acoustic Indices - Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 -StartOffsetSecond: - Name: Segment start second - Comment: "Total seconds from start of recording to start of this segment." - DataType: int - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 200.0 - ProjectID: Acoustic Indices - Units: "sec" - IncludeInComboIndex: false - ComboWeight: 0.0 -SegmentDuration: - Name: Time duration of audio segment - Comment: "Exact time span (total minutes) of this audio segment - typically 1.0 minutes." - DataType: TimeSpan - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 -HighAmplitudeIndex: - Name: High Amplitude Index - Comment: "Av number of samples/sec where abs. amplitude is within 10*epislon of the max signal value." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "av/s" - IncludeInComboIndex: false - ComboWeight: 0.0 -ZeroSignal: - Name: Zero Signal Index - Comment: "Indicates if signal segment is flat or zero." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -ClippingIndex: - Name: Clipping Index - Comment: "Av number of clipped samples/sec i.e. where the abs. amplitude of two conscutive samples is within 4*epislon of the max signal value." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "avClips/s" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgSignalAmplitude: - Name: av Signal Ampl - Comment: "Av amplitude of the signal envelope in dB." - DataType: double - DefaultValue: -80 - DoDisplay: true - # SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL = -80 dB - # -50 dB is typical level for environmental BGN - NormMin: -50.0 - NormMax: -10.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -BackgroundNoise: - Name: Background Noise - Comment: "Av amplitude of the noise removed from the audio segment using the method of Lamel et al." - DataType: double - DefaultValue: -80 - DoDisplay: true - # SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL + 10 - NormMin: -50.0 - NormMax: -10.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -Snr: - Name: Maximum SNR - Comment: "Max amplitude of signal envelope after noise removal." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 50.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgSnrOfActiveFrames: - Name: av SNR (Active frames) - Comment: "Av amplitude of active frames in signal envelope after noise removal. Active frames are those with amplitude > threshold 3 dB." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 30.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -Activity: - Name: Activity - Comment: "% of active frames i.e. where SNR exceeds threshold = 3 dB." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EventsPerSecond: - Name: Events per sec - Comment: "Av number of events per second. An event is any consecutive sequence of active frames having duration > threshold = 100 ms." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 5.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgEventDuration: - Name: Av Event Duration - Comment: "Av duration in ms of the events in an audio segment." - DataType: TimeSpan - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1000 - ProjectID: Acoustic Indices - Units: "ms" - IncludeInComboIndex: false - ComboWeight: 0.0 -HighFreqCover: - Name: hf Cover - Comment: "% hf Cover 4000 Hz to 8800 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 0.5 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -MidFreqCover: - Name: mf Cover - Comment: "% mf Cover. 500 Hz to 4000 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.50 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -LowFreqCover: - Name: lf Cover - Comment: "% lf Cover. 0 - 500 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.50 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -AcousticComplexity: - Name: ACI - Comment: "ACI" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.4 - NormMax: 0.7 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.2 -TemporalEntropy: - Name: 1-H[t] - Comment: "1-Ht is a measure of concentration of acoustic energy instead of energy dispersal." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.5 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 -SqrtTempEntropy: - Name: Sqrt(1-H[t]) - Comment: "Sqrt(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = sqrt(0.5)" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.7 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -LogTempEntropy: - Name: Log(1-H[t]) - Comment: "Log(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = log(1 + 0.5)" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.176 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfAverageSpectrum: - Name: 1-H[avg spectrum] - Comment: "1-H[spectral avg] is a measure of concentration of acoustic energy in the average spectrum over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfVarianceSpectrum: - Name: 1-H[var spectrum] - Comment: "1-H[spectral var] is a measure of concentration of acoustic energy in the variance spectrum over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfPeaksSpectrum: - Name: 1-H[peak freq spectrum] - Comment: "1-H[peak freq] is a measure of concentration of peak frequencies over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfCoVSpectrum: - Name: 1-H[CoV spectrum] - Comment: "1-H[CoV sp] is a measure of concentration of energy in the Coeff of Variance Spectrum." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -ClusterCount: - Name: Cluster Count - Comment: "Number of spectral clusters in one minute audio segment as determined by a clustering algorithm." - DataType: int - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 50 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 -#AvgClusterDuration: -# Name: av Cluster Duration -# Comment: "Average duration in ms of the spectrum cluster sequences." -# DataType: TimeSpan -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 250 -# ProjectID: Acoustic Indices -# Units: "ms" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -ThreeGramCount: - Name: 3-gram Count - Comment: "Number of different tri-gram spectral cluster sequences." - DataType: int - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 1500 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -SptDensity: - Name: SPT density - Comment: "Average number of spectral peaks tracks traversing a frame." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -#SptPerSecond: -# Name: av Tracks/Sec -# Comment: "Average number of spectral tracks per second." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 50 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#AvgSptDuration: -# Name: av Track Duration -# Comment: "Average duration of a spectral track." -# DataType: TimeSpan -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0.25 -# NormMax: 2.0 -# ProjectID: Acoustic Indices -# Units: "s" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#RainIndex: -# Name: Rain Index -# Comment: "OBSOLETE! DEPRACATED! Rain score calculated every 10 sec and 6 values averaged over the minute." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: false -# NormMin: 0 -# NormMax: 1.0 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#CicadaIndex: -# Name: Cicada Index -# Comment: "OBSOLETE! DEPRACATED! Cicada score calculated every 10 sec and 6 values averaged over the minute." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: false -# NormMin: 0 -# NormMax: 1.0 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -NDSI: - Name: NDSI - Comment: "Normalised Difference Soundscape Index) calculated from PSD - originated from Stuart Gage." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -NDSI-LM: - Name: NDSI-LM - Comment: "Normalised Difference Soundscape Index) ratio of Mid/Low freq bands." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -NDSI-MH: - Name: NDSI-MH - Comment: "Normalised Difference Soundscape Index) ratio of High/Mid freq bands." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -EventsTotal: - Name: Event Count - Comment: "The total count of acoustic events per minute of recording." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 15.0 - ProjectID: Acoustic Indices - Units: "" -EventsTotalThresholded: - Name: Event Count - Comment: "Count of acoustic events (wide range)" - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 5 - NormMax: 25 - ProjectID: Acoustic Indices - Units: "" -ZeroCrossingFractionLeft: - Name: Zero Crossing Fraction Left - Comment: "" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Channel Integrity - Units: "" -ZeroCrossingFractionRight: - Name: Zero Crossing Fraction Right - Comment: "" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Channel Integrity - Units: "" -ChannelSimilarity: - Name: Channel Similarity - Comment: "similarityIndex = (min*min)/(max*max), where min=min of two channels and max = max of the two. Summed over all freq bins" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Channel Integrity - Units: "" -ChannelDiffDecibels: - Name: Channel Difference in decibels - Comment: "decibelIndex = dBmax-dBmin, where dBmin=min of two channels and dBmax = max of the two. Summed over all freq bins" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -8.0 - NormMax: 8.0 - ProjectID: Channel Integrity - Units: "decibels" -AverageDecibelBias: - Name: Average Channel Bias in decibels - Comment: "avDecibelBias += (dbLeft-dbRight). Summed over all freq bins" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -8.0 - NormMax: 8.0 - ProjectID: Channel Integrity - Units: "decibels" -MedianDecibelBias: - Name: Median Channel Bias in decibels - Comment: "medianDecibelBias += (medianOfLeftSpectrum-medianOfRightSpectrum). Summed over all freq bins" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -0.2 - NormMax: 0.2 - ProjectID: Channel Integrity - Units: "decibels" -LowFreqDecibelBias: - Name: Low Freq Channel dB Bias - Comment: "lowFreqDbBias += (dbLeft-dbRight). Summed over low freq bins, 0-2kHz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -10.0 - NormMax: 10.0 - ProjectID: Channel Integrity - Units: "decibels" -MidFreqDecibelBias: - Name: Mid-Freq Channel dB Bias - Comment: "midFreqDbBias += (dbLeft-dbRight). Summed over mid freq bins, 2-7kHz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -10.0 - NormMax: 10.0 - ProjectID: Channel Integrity - Units: "decibels" -HighFreqDecibelBias: - Name: High Freq Channel dB Bias - Comment: "highFreqDbBias += (dbLeft-dbRight). Summed over high freq bins, 7khz-nyquist" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -5.0 - NormMax: 5.0 - ProjectID: Channel Integrity - Units: "decibels" -FileName: - Name: File Name - Comment: "FILLER TO STOP WARNING MESSAGE! File Name" - DataType: int - DefaultValue: 0.0 - DoDisplay: false - ProjectID: Acoustic Indices - Units: "" -# ADD THE SUMMARY INDICES ABOVE HERE -# ==================================================================================================================================== -# ==================================================================================================================================== -# ADD THE SPECTRAL INDICES BELOW HERE - -# IMPORTANT: SPECTRAL INDCIES MUST BE OF TYPE Double[] -ACI: - Name: spectralACI - Comment: "Spectrum of ACI values, one value for each frequency bin." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.4 - NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: true - ProjectID: Acoustic Indices - Units: "" -BGN: - Name: spectralBGN - Comment: "Spectrum of dB value of the background 'noise' removed each frequency bin." - DataType: double[] - DefaultValue: -100.0 - DoDisplay: true - # min = SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL - 20 = -80-20 = -100, - # Usual value is -30. However -20 adds more contrast into BGN spectrogram - NormMin: -100.0 - NormMax: -30.0 - CalculateNormMin: true - CalculateNormMax: true - ProjectID: Acoustic Indices - Units: "dB" -CLS: - Name: spectralCLS - Comment: "Cluster count: number of distinct spectral clusters in each freq bin of the mid-band." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 4.0 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -CVR: - Name: spectralCVR - Comment: "Freq bin COVER: Spectrum of the fraction of active elements in each freq bin where amplitude > threshold = 3 dB." - # IMPORTANT - sometimes this is expressed as a percentage rather than fraction. NEED TO CHECK!! - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -# ComboWeight: 0.0 -DIF: - Name: spectralDIF - Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This spgram not displayed. It is used as intermediate for subsequent calculation of ACI." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -ENT: - Name: spectralENT - Comment: "1 - Temporal Entropy. Default value = 0.0 because index = 1-Ht = a measure of concentration of acoustic energy instead of energy dispersal." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.6 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -EVN: - Name: spectralEVN - Comment: "Spectrum of acoustic events per second (as defined above) in each frequency band." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 2.0 - NormMax: 6.0 - CalculateNormMin: false - CalculateNormMax: true - ProjectID: Acoustic Indices - Units: "events/s" -OSC: - Name: spectralOSC - Comment: "Spectrum of Oscillation amplitudes derived from the ampl spgram." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true - ProjectID: Acoustic Indices - Units: "" -SUM: - Name: spectralSUM - Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This spgram not displayed. It is used for intermediate calculations only." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -PMN: - Name: spectralPMN - Comment: "Spectrum of average dB power in each frequency bin after noise removal." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 5.5 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "dB" -RHZ: - Name: spectralRHZ - Comment: "Spectrum of average number of horizontal spectral ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.1 - NormMax: 1.5 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RVT: - Name: spectralRVT - Comment: "Spectrum of average number of vertical spectral ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.1 - NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RPS: - Name: spectralRPS - Comment: "Spectrum of average number of positive slope ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RNG: - Name: spectralRNG - Comment: "Spectrum of average number of negative slope ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.4 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -R3D: - Name: spectralR3D - Comment: "Spectrum of max value of horizontal, positive and negative slope ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.15 - NormMax: 1.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -SPT: - Name: spectralSPT - Comment: "Spectrum of average number of spectral Peak Tracks per second within each freq bin." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.05 - NormMax: 0.5 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" \ No newline at end of file diff --git a/src/AnalysisConfigFiles/IndexPropertiesConfigHiResGianniPavan.yml b/src/AnalysisConfigFiles/IndexPropertiesConfigHiResGianniPavan.yml deleted file mode 100644 index 8012396d8..000000000 --- a/src/AnalysisConfigFiles/IndexPropertiesConfigHiResGianniPavan.yml +++ /dev/null @@ -1,640 +0,0 @@ ---- -# WARNING!!! The keys used below MUST BE EXACTLY the SAME as those declared in the class InitialiseIndexProperties (starting at line 30). - -# the root object name maps to the Key property on the IndexProperties class - -RankOrder: # AKA IndexCount - Name: Rank order of audio segment - Comment: "Rank of minute segment in temporal order from start of recording." - DataType: int - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 100.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -StartOffset: - Name: Segment start time - Comment: "Exact time span (total minutes) from start of recording to start of this segment." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 200.0 - ProjectID: Acoustic Indices - Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 -StartOffsetMinute: - Name: Segment start minute - Comment: "Total minutes from start of recording to start of this segment." - DataType: int - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 200.0 - ProjectID: Acoustic Indices - Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 -StartOffsetSecond: - Name: Segment start second - Comment: "Total seconds from start of recording to start of this segment." - DataType: int - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 200.0 - ProjectID: Acoustic Indices - Units: "sec" - IncludeInComboIndex: false - ComboWeight: 0.0 -SegmentDuration: - Name: Time duration of audio segment - Comment: "Exact time span (total minutes) of this audio segment - typically 1.0 minutes." - DataType: TimeSpan - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "min" - IncludeInComboIndex: false - ComboWeight: 0.0 -HighAmplitudeIndex: - Name: High Amplitude Index - Comment: "Av number of samples/sec where abs. amplitude is within 10*epislon of the max signal value." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "av/s" - IncludeInComboIndex: false - ComboWeight: 0.0 -ClippingIndex: - Name: Clipping Index - Comment: "Av number of clipped samples/sec i.e. where the abs. amplitude of two conscutive samples is within 4*epislon of the max signal value." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "avClips/s" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgSignalAmplitude: - Name: av Signal Ampl - Comment: "Av amplitude of the signal envelope in dB." - DataType: double - DefaultValue: -80 - DoDisplay: true - # SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL = -80 dB - # -50 dB is typical level for environmental BGN - NormMin: -50.0 - NormMax: -10.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -BackgroundNoise: - Name: Background Noise - Comment: "Av amplitude of the noise removed from the audio segment using the method of Lamel et al." - DataType: double - DefaultValue: -80 - DoDisplay: true - # SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL + 10 - NormMin: -50.0 - NormMax: -10.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -Snr: - Name: Maximum SNR - Comment: "Max amplitude of signal envelope after noise removal." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 50.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgSnrOfActiveFrames: - Name: av SNR (Active frames) - Comment: "Av amplitude of active frames in signal envelope after noise removal. Active frames are those with amplitude > threshold 3 dB." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 30.0 - ProjectID: Acoustic Indices - Units: "dB" - IncludeInComboIndex: false - ComboWeight: 0.0 -Activity: - Name: Activity - Comment: "% of active frames i.e. where SNR exceeds threshold = 3 dB." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EventsPerSecond: - Name: Events per sec - Comment: "Av number of events per second. An event is any consecutive sequence of active frames having duration > threshold = 100 ms." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 5.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -AvgEventDuration: - Name: Av Event Duration - Comment: "Av duration in ms of the events in an audio segment." - DataType: TimeSpan - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1000 - ProjectID: Acoustic Indices - Units: "ms" - IncludeInComboIndex: false - ComboWeight: 0.0 -HighFreqCover: - Name: hf Cover - Comment: "% hf Cover 4000 Hz to 8800 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 0.5 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -MidFreqCover: - Name: mf Cover - Comment: "% mf Cover. 500 Hz to 4000 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.50 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -LowFreqCover: - Name: lf Cover - Comment: "% lf Cover. 0 - 500 Hz" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.50 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -AcousticComplexity: - Name: ACI - Comment: "ACI" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.4 - NormMax: 0.7 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.2 -TemporalEntropy: - Name: 1-H[t] - Comment: "1-Ht is a measure of concentration of acoustic energy instead of energy dispersal." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.5 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: true - ComboWeight: 0.3 -SqrtTempEntropy: - Name: Sqrt(1-H[t]) - Comment: "Sqrt(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = sqrt(0.5)" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.7 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -LogTempEntropy: - Name: Log(1-H[t]) - Comment: "Log(1-Ht) is an attempt to obtain more even distribution of Ht values. NormMax = log(1 + 0.5)" - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.176 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfAverageSpectrum: - Name: 1-H[avg spectrum] - Comment: "1-H[spectral avg] is a measure of concentration of acoustic energy in the average spectrum over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfVarianceSpectrum: - Name: 1-H[var spectrum] - Comment: "1-H[spectral var] is a measure of concentration of acoustic energy in the variance spectrum over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfPeaksSpectrum: - Name: 1-H[peak freq spectrum] - Comment: "1-H[peak freq] is a measure of concentration of peak frequencies over one minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -EntropyOfCoVSpectrum: - Name: 1-H[CoV spectrum] - Comment: "1-H[CoV sp] is a measure of concentration of energy in the Coeff of Variance Spectrum." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -#ClusterCount: -# Name: Cluster Count -# Comment: "Number of spectrum clusters in one minute audio segment as determined by a clustering algorithm." -# DataType: int -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 50 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: true -# ComboWeight: 0.3 -#AvgClusterDuration: -# Name: av Cluster Duration -# Comment: "Average duration in ms of the spectrum cluster sequences." -# DataType: TimeSpan -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 250 -# ProjectID: Acoustic Indices -# Units: "ms" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#ThreeGramCount: -# Name: 3-gram Count -# Comment: "Number of different tri-gram cluster sequences." -# DataType: int -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 1000 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -SptDensity: - Name: SPT density - Comment: "Average number of spectral peaks tracks traversing a frame." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0.0 - NormMax: 2.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -#SptPerSecond: -# Name: av Tracks/Sec -# Comment: "Average number of spectral tracks per second." -# DataType: double -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0 -# NormMax: 50 -# ProjectID: Acoustic Indices -# Units: "" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -#AvgSptDuration: -# Name: av Track Duration -# Comment: "Average duration of a spectral track." -# DataType: TimeSpan -# DefaultValue: 0.0 -# DoDisplay: true -# NormMin: 0.25 -# NormMax: 2.0 -# ProjectID: Acoustic Indices -# Units: "s" -# IncludeInComboIndex: false -# ComboWeight: 0.0 -RainIndex: - Name: Rain Index - Comment: "OBSOLETE! DEPRACATED! Rain score calculated every 10 sec and 6 values averaged over the minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -CicadaIndex: - Name: Cicada Index - Comment: "OBSOLETE! DEPRACATED! Cicada score calculated every 10 sec and 6 values averaged over the minute." - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" - IncludeInComboIndex: false - ComboWeight: 0.0 -NDSI: - Name: NDSI - Comment: "Normalised Difference Soundscape Index) calculated from PSD - originated from Stuart Gage." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -NDSI-LM: - Name: NDSI-LM - Comment: "Normalised Difference Soundscape Index) ratio of Mid/Low freq bands." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -NDSI-MH: - Name: NDSI-MH - Comment: "Normalised Difference Soundscape Index) ratio of High/Mid freq bands." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: -1.0 - NormMax: 1.0 - ProjectID: Acoustic Indices - Units: "" -EventsTotal: - Name: Event Count - Comment: "The total count of acoustic events per minute of recording." - DataType: double - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0 - NormMax: 15.0 - ProjectID: Acoustic Indices - Units: "" -EventsTotalThresholded: - Name: Event Count - Comment: "Count of acoustic events (wide range)" - DataType: double - DefaultValue: 0.0 - DoDisplay: false - NormMin: 5 - NormMax: 25 - ProjectID: Acoustic Indices - Units: "" -FileName: - Name: File Name - Comment: "FILLER TO STOP WARNING MESSAGE! File Name" - DataType: int - DefaultValue: 0.0 - DoDisplay: false - ProjectID: Acoustic Indices - Units: "" -# ADD THE SUMMARY INDICES ABOVE HERE -# ==================================================================================================================================== -# ==================================================================================================================================== -# ADD THE SPECTRAL INDICES BELOW HERE - -# IMPORTANT: SPECTRAL INDCIES MUST BE OF TYPE Double[] -ACI: - Name: spectralACI - Comment: "Spectrum of ACI values, one value for each frequency bin." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.4 - NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -BGN: - Name: spectralBGN - Comment: "Spectrum of dB value of the background 'noise' removed each frequency bin." - DataType: double[] - DefaultValue: -100.0 - DoDisplay: true - # min = SNR.MINIMUM_dB_BOUND_FOR_ZERO_SIGNAL - 20 = -80-20 = -100, - # -20 adds more contrast into BGN spectrogram - NormMin: -100.0 - NormMax: -30.0 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "dB" -CVR: - Name: spectralCVR - Comment: "Freq bin COVER: Spectrum of the fraction of active elements in each freq bin where amplitude > threshold = 3 dB." - # IMPORTANT - sometimes this is expressed as a percentage rather than fraction. NEED TO CHECK!! - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.7 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -# ComboWeight: 0.0 -DIF: - Name: spectralDIF - Comment: "Spectrum of summed DIFFERENCES between consecutive FFT coeff's in the ampl spgram. This spgram not displayed. It is used as intermediate for subsequent calculation of ACI." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -ENT: - Name: spectralENT - Comment: "1 - Temporal Entropy. Default value = 0.0 because index = 1-Ht = a measure of concentration of acoustic energy instead of energy dispersal." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 0.6 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -EVN: - Name: spectralEVN - Comment: "Spectrum of acoustic events per second (as defined above) in each frequency band." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 2.0 - NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "events/s" -OSC: - Name: spectralOSC - Comment: "Spectrum of Oscillation amplitudes derived from the ampl spgram." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: true - CalculateNormMax: true - ProjectID: Acoustic Indices - Units: "" -SUM: - Name: spectralSUM - Comment: "Spectrum of summed FFT coefficients derived from the ampl spgram. This spgram not displayed. It is used for intermediate calculations only." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 10.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "" -PMN: - Name: spectralPMN - Comment: "Spectrum of average dB power in each frequency bin after noise removal." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 15.0 - CalculateNormMin: true - CalculateNormMax: true - ProjectID: Acoustic Indices - Units: "dB" -SPT: - Name: spectralSPT - Comment: "Spectrum of average number of spectral Peak Tracks per second within each freq bin." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 5.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RHZ: - Name: spectralRHZ - Comment: "Spectrum of average number of horizontal spectral ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 4.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RVT: - Name: spectralRVT - Comment: "Spectrum of average number of vertical spectral ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 8.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RPS: - Name: spectralRPS - Comment: "Spectrum of average number of positive slope ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 4.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" -RNG: - Name: spectralRNG - Comment: "Spectrum of average number of negative slope ridges per sec." - DataType: double[] - DefaultValue: 0.0 - DoDisplay: true - NormMin: 0.0 - NormMax: 4.0 - CalculateNormMin: false - CalculateNormMax: false - ProjectID: Acoustic Indices - Units: "tracks/s" \ No newline at end of file diff --git a/src/AnalysisConfigFiles/Towsey.Acoustic.Zooming.yml b/src/AnalysisConfigFiles/Towsey.Acoustic.Zooming.yml index 068d148f5..27ab1a3c8 100644 --- a/src/AnalysisConfigFiles/Towsey.Acoustic.Zooming.yml +++ b/src/AnalysisConfigFiles/Towsey.Acoustic.Zooming.yml @@ -8,7 +8,7 @@ # # -AnalysisName: Towsey.Acoustic +#AnalysisName: Towsey.Acoustic #SegmentDuration: units=seconds; SegmentDuration: 60 #SegmentOverlap: units=seconds; @@ -65,10 +65,10 @@ TileOutput: false # if true, an exception will be thrown if no such date is found # if false, and a valid date is still found in file name, it will still be parsed # supports formats like: -# prefix_20140101T235959+1000.mp3 -# prefix_20140101T235959+Z.mp3 -# prefix_20140101-235959+1000.mp3 -# prefix_20140101-235959+Z.mp3 +# prefix_20140101T235959+1000.wav +# prefix_20140101T235959Z.wav +# prefix_20140101-235959+1000.wav +# prefix_20140101_235959Z.wav RequireDateInFilename: true IndexPropertiesConfig: './IndexPropertiesConfig.Zooming.yml' diff --git a/src/AnalysisPrograms/ConcatenateIndexFiles.cs b/src/AnalysisPrograms/ConcatenateIndexFiles.cs index 95ec79356..9391406dc 100644 --- a/src/AnalysisPrograms/ConcatenateIndexFiles.cs +++ b/src/AnalysisPrograms/ConcatenateIndexFiles.cs @@ -202,7 +202,9 @@ public static void Execute(Arguments arguments) // 1. PATTERN SEARCH FOR CORRECT SUBDIRECTORIES // Assumes that the required subdirectories have the given FILTER/SiteName somewhere in their path. - var subDirectories = LdSpectrogramStitching.GetSubDirectoriesForSiteData(inputDirs, arguments.DirectoryFilter); + var searchOption = SearchOption.AllDirectories; + //var searchOption = SearchOption.TopDirectoryOnly; + var subDirectories = LdSpectrogramStitching.GetSubDirectoriesForSiteData(inputDirs, arguments.DirectoryFilter, searchOption); if (subDirectories.Length == 0) { LoggedConsole.WriteErrorLine("\n\n#Error from method ConcatenateIndexFiles.Execute():"); diff --git a/src/AnalysisPrograms/Draw/Zooming/DrawZoomingSpectrograms.cs b/src/AnalysisPrograms/Draw/Zooming/DrawZoomingSpectrograms.cs index c1a56daea..beaa7cf98 100644 --- a/src/AnalysisPrograms/Draw/Zooming/DrawZoomingSpectrograms.cs +++ b/src/AnalysisPrograms/Draw/Zooming/DrawZoomingSpectrograms.cs @@ -1,4 +1,4 @@ -// -------------------------------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // // 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). // @@ -58,7 +58,10 @@ public static void Execute(Arguments arguments) LoggedConsole.WriteLine("# File name of recording : " + common.OriginalBasename); - // create file systems for reading input and writing output + // create file systems for reading input and writing output. It gets + //arguments.SourceDirectory.ToDirectoryInfo(), + //arguments.Output.ToDirectoryInfo(), + var io = FileSystemProvider.GetInputOutputFileSystems( arguments.SourceDirectory, FileSystemProvider.MakePath(arguments.Output, common.OriginalBasename, arguments.OutputFormat, "Tiles")) @@ -78,14 +81,14 @@ public static void Execute(Arguments arguments) throw new ArgumentException("FocusMinute is null, cannot proceed"); } - const int ImageWidth = 1500; ZoomFocusedSpectrograms.DrawStackOfZoomedSpectrograms( arguments.SourceDirectory.ToDirectoryInfo(), arguments.Output.ToDirectoryInfo(), + io, common, + AcousticIndices.TowseyAcoustic, focalTime, - ImageWidth, - AcousticIndices.TowseyAcoustic); + imageWidth: 1500); break; case Arguments.ZoomActionType.Tile: // Create the super tiles for a full set of recordings diff --git a/src/AnalysisPrograms/HerveGlotinCollaboration.cs b/src/AnalysisPrograms/HerveGlotinCollaboration.cs index 50165365f..eb973a951 100644 --- a/src/AnalysisPrograms/HerveGlotinCollaboration.cs +++ b/src/AnalysisPrograms/HerveGlotinCollaboration.cs @@ -9,6 +9,7 @@ namespace AnalysisPrograms using System.Drawing; using System.IO; using System.Linq; + using AnalysisPrograms.Production; using AudioAnalysisTools; using AudioAnalysisTools.LongDurationSpectrograms; using AudioAnalysisTools.LongDurationSpectrograms.Zooming; @@ -172,6 +173,10 @@ public static void HiRes1() LoggedConsole.WriteLine("# Output Directory : " + zoomingArguments.Output); var common = new ZoomParameters(zoomingArguments.SourceDirectory.ToDirectoryEntry(), zoomingArguments.SpectrogramZoomingConfig.ToFileEntry(), false); + var io = FileSystemProvider.GetInputOutputFileSystems( + zoomingArguments.SourceDirectory, + FileSystemProvider.MakePath(zoomingArguments.Output, common.OriginalBasename, zoomingArguments.OutputFormat, "Tiles")) + .EnsureInputIsDirectory(); // Create directory if not exists if (!Directory.Exists(zoomingArguments.Output)) @@ -182,10 +187,11 @@ public static void HiRes1() ZoomFocusedSpectrograms.DrawStackOfZoomedSpectrograms( zoomingArguments.SourceDirectory.ToDirectoryInfo(), zoomingArguments.Output.ToDirectoryInfo(), + io, common, + AcousticIndices.TowseyAcoustic, TimeSpan.FromMinutes(focalMinute), - imageWidth, - AcousticIndices.TowseyAcoustic); + imageWidth); // DRAW THE VARIOUS IMAGES string fileStem = fileName; diff --git a/src/AnalysisPrograms/Sandpit.cs b/src/AnalysisPrograms/Sandpit.cs index 499646cf7..3df8a93d5 100644 --- a/src/AnalysisPrograms/Sandpit.cs +++ b/src/AnalysisPrograms/Sandpit.cs @@ -13,10 +13,12 @@ namespace AnalysisPrograms using System.Linq; using System.Text; using System.Threading.Tasks; + using Accord.Statistics.Kernels; using Acoustics.Shared; using Acoustics.Shared.Csv; using Acoustics.Tools.Wav; using AnalyseLongRecordings; + using AnalysisPrograms.Draw.Zooming; using AudioAnalysisTools; using AudioAnalysisTools.DSP; using AudioAnalysisTools.Indices; @@ -26,6 +28,7 @@ namespace AnalysisPrograms using McMaster.Extensions.CommandLineUtils; using Production.Arguments; using TowseyLibrary; + using Log = TowseyLibrary.Log; /// /// Activity Code for this class:= sandpit @@ -36,13 +39,16 @@ namespace AnalysisPrograms /// audio2sonogram - Calls AnalysisPrograms.Audio2Sonogram.Main(): Produces a sonogram from an audio file - EITHER custom OR via SOX.Generates multiple spectrogram images and oscilllations info /// indicescsv2image - Calls DrawSummaryIndexTracks.Main(): Input csv file of summary indices. Outputs a tracks image. /// colourspectrogram - Calls DrawLongDurationSpectrograms.Execute(): Produces LD spectrograms from matrices of indices. - /// zoomingspectrograms - Calls DrawZoomingSpectrograms.Execute(): Produces LD spectrograms on different time scales. + /// drawzoomingspectrograms - Calls DrawZoomingSpectrograms.Execute(): Produces LD spectrograms on different time scales. /// differencespectrogram - Calls DifferenceSpectrogram.Execute(): Produces Long duration difference spectrograms /// /// audiofilecheck - Writes information about audio files to a csv file. /// snr - Calls SnrAnalysis.Execute(): Calculates signal to noise ratio. /// audiocutter - Cuts audio into segments of desired length and format /// createfoursonograms. + /// + /// NOTE: In March 2019, several config files were removed because no longer used or relevant. + /// Therefore many of the config paths below will no longer be valid. /// // TODO: [OPENSOURCE] empty out this file public class Sandpit @@ -80,8 +86,11 @@ public override Task Execute(CommandLineApplication app) //DrawLongDurationSpectrogram(); //DrawClusterSequence(); //DrawStandardSpectrograms(); + //DrawZoomingSpectrogramPyramid(); + //Test_DrawFourSpectrograms(); + //ExtractSpectralFeatures(); //HerveGlotinMethods(); //KarlHeinzFrommolt(); @@ -94,6 +103,8 @@ public override Task Execute(CommandLineApplication app) //TestEigenValues(); //TestChannelIntegrity(); //TestDct(); + //Statistics.TestGetNthPercentileBin(); + //TEST_FilterMovingAverage(); //TestImageProcessing(); //TestMatrix3dClass(); @@ -105,9 +116,11 @@ public override Task Execute(CommandLineApplication app) //TestTernaryPlots(); //TestDirectorySearchAndFileSearch(); //TestNoiseReduction(); - ReadSpectralIndicesFromTwoFalseColourSpectrogramRibbons(); + //ReadSpectralIndicesFromTwoFalseColourSpectrogramRibbons(); //Oscillations2014.TESTMETHOD_DrawOscillationSpectrogram(); //Oscillations2014.TESTMETHOD_GetSpectralIndex_Osc(); + //Test_DrawFourSpectrograms(); + //TestLinearFunction(); Console.WriteLine("# Finished Sandpit Task! Press any key to exit."); return this.Ok(); @@ -332,12 +345,20 @@ 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_191652+1000.wav"; + //string outputPath = @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez\22"; + //string outputPath = @"C:\Ecoacoustics\Output\Test\TestMezOneHourHiRes\20"; + //string configPath = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\Towsey.Acoustic.yml"; + //string configPath = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\Towsey.Acoustic.Zooming.yml"; + // 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\Delete"; //string configPath = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\Towsey.Acoustic.yml"; + // Ivan Campos recordings //string recordingPath = @"G:\SensorNetworks\WavFiles\Ivancampos\INCIPO01_20161031_024006_898.wav"; //string outputPath = @"G:\SensorNetworks\Output\IvanCampos\17"; @@ -626,6 +647,8 @@ public static void DrawLongDurationSpectrogram() //string opdir = @"C:\SensorNetworks\Output\QueenMaryUL\concatenated"; // false-colour spectrograms + //string ipdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\Farmstay_ECLIPSE3_20121114_060001TEST\Indices\Towsey.Acoustic"; + //string opdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\Farmstay_ECLIPSE3_20121114_060001TEST\Spectrograms"; //string ipFileName = "Farmstay_ECLIPSE3_20121114_060001TEST"; //exclude the analysis type from file name i.e. "Towsey.Acoustic.Indices" //string ipdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\SpectrogramZoom\Towsey.Acoustic.60sppx.EclipseFarmstay"; //string opdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\SpectrogramZoom\Towsey.Acoustic"; @@ -633,14 +656,6 @@ public static void DrawLongDurationSpectrogram() //string ipdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\SpectrogramZoom\Towsey.Acoustic.60sppx.EclipseFarmstay"; //string opdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\SpectrogramZoom\Towsey.Acoustic"; - //string ipdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\Farmstay_ECLIPSE3_20121114_060001TEST\Indices\Towsey.Acoustic"; - //string opdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\Farmstay_ECLIPSE3_20121114_060001TEST\Spectrograms"; - - // zoomable spectrograms - //string ipFileName = "TEST_TUITCE_20091215_220004"; //exclude the analysis type from file name i.e. "Towsey.Acoustic.Indices" - //string ipdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\SpectrogramZoom\Towsey.Acoustic"; - //string opdir = @"C:\SensorNetworks\Output\FalseColourSpectrograms\SpectrogramZoom\Towsey.Acoustic"; - //2010 Oct 13th //var ipdir = @"C:\SensorNetworks\Output\TsheringDema\Towsey.Acoustic_OLD4"; //var opdir = @"C:\SensorNetworks\Output\TsheringDema\Towsey.Acoustic"; @@ -688,6 +703,37 @@ public static void DrawLongDurationSpectrogram() DrawLongDurationSpectrograms.Execute(args); } + /// + /// This action item = "DrawZoomingSpectrograms". + /// AnalysisPrograms.Draw.Zooming.DrawZoomingSpectrograms + /// AnalysisPrograms.Draw.Zooming.Arguments + /// Note: the path to the IndexPropertiesConfig is included in the SpectrogramZoomingConfig File. + /// It should be @"C:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisConfigFiles\IndexPropertiesConfig.yml". + /// + public static void DrawZoomingSpectrogramPyramid() + { + //string ipFileName = "TEST_TUITCE_20091215_220004"; //exclude the analysis type from file name i.e. "Towsey.Acoustic.Indices" + //string ipdir = @"C:\Ecoacoustics\Output\FalseColourSpectrograms\SpectrogramFocalZoom\Towsey.Acoustic.200ms.EclipseFarmstayOLD"; + //MAP "\\Sef-bigdata-10\d$\tasmania_mez\output_zooming_indices2019\Towsey.Acoustic" to Q drive + //string ipdir = @"Q:\TasmaniaMez"; + string ipdir = @"C:\Ecoacoustics\Output\Test\TestMezOneHourHiRes\20\Towsey.Acoustic"; + string opdir = @"C:\Ecoacoustics\Output\FalseColourSpectrograms\SpectrogramFocalZoom\TasmaniaMezTest"; + + // The default zooming LDFC spectrogram config file + //var spectrogramConfigFile = @"C:\Work\GitHub\audio-analysis\src\AnalysisConfigFiles\SpectrogramZoomingConfig.yml"; + var zoomingConfigFile = @"C:\Ecoacoustics\Output\FalseColourSpectrograms\SpectrogramFocalZoom\SpectrogramZoomingConfig.yml"; + + var args = new DrawZoomingSpectrograms.Arguments + { + SourceDirectory = ipdir, + Output = opdir, + SpectrogramZoomingConfig = zoomingConfigFile, + ZoomAction = DrawZoomingSpectrograms.Arguments.ZoomActionType.Focused, + FocusMinute = 30, + }; + DrawZoomingSpectrograms.Execute(args); + } + /// /// This action item = "concatenateIndexFiles". /// @@ -713,7 +759,9 @@ public static void ConcatenateIndexFilesAndSpectrograms() // SET DEFAULT COLOUR MAPS string colorMap1 = SpectrogramConstants.RGBMap_ACI_ENT_EVN; - string colorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_OSC; + string colorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_CVR; + //string colorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_OSC; + // there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps. string gapRendering = "TimedGaps"; // the default @@ -820,9 +868,9 @@ public static void ConcatenateIndexFilesAndSpectrograms() @"C:\Ecoacoustics\Output\Test\Test24HourRecording\TasmanIslandMez", }; - string directoryFilter = "0*"; // this is a directory filter to locate only the required files + string directoryFilter = "Mez*"; // this is a directory filter to locate only the required files string opFileStem = "TasmanIslandMez"; - string opPath = @"C:\Ecoacoustics\Output\Test\DebugIssue170"; + string opPath = @"C:\Ecoacoustics\Output\Test\DebugIssue186"; // there are three options for rendering of gaps/missing data: NoGaps, TimedGaps and EchoGaps. gapRendering = "TimedGaps"; @@ -2934,5 +2982,56 @@ public static void ExtractFeatureVectorOfIndices(DirectoryInfo sourceDir, string } } } // end CodeToExtractFeatureVectorOfIndices() + + /// + /// Test of linear function. + /// Used to test blending in ZoomCommon line 131. + /// + public static void TestLinearFunction() + { + // set up piecewise linear function to determine colour weights + //int imageScaleInMsPerPixel = 257; + int imageScaleInMsPerPixel = 16000; + //int imageScaleInMsPerPixel = 32760; + double blendWeight1; + + /* + //Linear SCALE + int upperResolution = 30000; + int lowerResolution = 200; + if (imageScaleInMsPerPixel >= upperResolution) + { + blendWeight1 = 1.0; + } + else if (imageScaleInMsPerPixel <= lowerResolution) + { + blendWeight1 = 0.0; + } + else + { + blendWeight1 = (imageScaleInMsPerPixel - lowerResolution) / (double)upperResolution; + } + */ + + //LOG SCALE + var logResolution = Math.Log(imageScaleInMsPerPixel, 2); + double upperResolution = Math.Log(32768, 2); + double lowerResolution = Math.Log(256, 2); + double range = upperResolution - lowerResolution; + if (logResolution >= upperResolution) + { + blendWeight1 = 1.0; + } + else if (logResolution <= lowerResolution) + { + blendWeight1 = 0.0; + } + else + { + blendWeight1 = (logResolution - lowerResolution) / range; + } + + double blendWeight2 = 1 - blendWeight1; + } } } diff --git a/src/AudioAnalysisTools/AcousticComplexityIndex.cs b/src/AudioAnalysisTools/AcousticComplexityIndex.cs index 06bfbcbec..d45e55b1a 100644 --- a/src/AudioAnalysisTools/AcousticComplexityIndex.cs +++ b/src/AudioAnalysisTools/AcousticComplexityIndex.cs @@ -1,33 +1,32 @@ -// -// 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). +// +// 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 Bio-acoustics Research Group). // namespace AudioAnalysisTools { using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; public static class AcousticComplexityIndex { /// /// Returns an array of ACOUSTIC COMPLEXITY INDICES - /// This implements the index of N. Pieretti, A. Farina, D. Morri + /// This implements the index of N. Pieretti, A. Farina, D. Morri. /// in "A new methodology to infer the singing activity of an avian community: The Acoustic Complexity Index (ACI)" - /// in Ecological Indicators 11 (2011) pp868–873 + /// in Ecological Indicators 11 (2011) pp868–873. /// - /// this is an amplitude spectrum. - /// - public static double[] CalculateACI(double[,] spectrogram) + /// this is an AMPLITUDE spectrum. All its values are positive. + /// array of ACI values. + public static double[] CalculateAci(double[,] spectrogram) { int frameCount = spectrogram.GetLength(0); int freqBinCount = spectrogram.GetLength(1); double[] aciArray = new double[freqBinCount]; // array of acoustic complexity indices, one for each freq bin - for (int j = 0; j < freqBinCount; j++) // for all frequency bins + + // for all frequency bins + for (int j = 0; j < freqBinCount; j++) { - var deltaI = 0.0; // to accumlate sum of differences - var sumI = 0.0; + var deltaI = 0.0; // to accumulate sum of differences + var sumI = 0.0; // to accumulate sum for (int r = 0; r < frameCount - 1; r++) { sumI += spectrogram[r, j]; @@ -36,14 +35,19 @@ public static double[] CalculateACI(double[,] spectrogram) if (sumI > 0.0) { - aciArray[j] = deltaI / sumI; //store normalised ACI value + aciArray[j] = deltaI / sumI; //store normalised ACI value } } - //DataTools.writeBarGraph(aciArray); + // LDFC spectrograms that include the ACI index show a red line in top most freq bin. + // For some reason, the ACI values in the topmost freq bin sit around 0.8 which is double the value one would expect. + // Divide this value by 2 in order to bring it down to expected level. + // This is a hack! The issue needs further investigation - one day! Possibly due to problem in the passed amplitude spectrogram. + aciArray[freqBinCount - 1] /= 2; + //DataTools.writeBarGraph(aciArray); return aciArray; - } // AcousticComplexityIndex() + } /// /// Returns an array of DIFFERENCE values used in top line of calculation of ACOUSTIC COMPLEXITY INDICES @@ -53,20 +57,22 @@ public static double[] CalculateACI(double[,] spectrogram) /// but the sum of DIFFERENCES will be over one less value. /// WHen ACI is calculated over a long interval i.e. one minute this is not a problem. When calculated over 0.2s, need to compensate. /// To get an almost correct approx to the ACI value calculated over a long interval, we add the average DIF to the total DIFF. - /// So the number of difference values equals the number of freq bin values, when it cons to calculate ACI = DIFF / SUM - /// This problem arises because of the very short sement duration e.g. 0.2 s segment = 8-9 frames. + /// So the number of difference values equals the number of freq bin values, when it comes to calculate ACI = DIFF / SUM + /// This problem arises because of the very short segment duration e.g. 0.2 s segment = 8-9 frames. /// /// this is an amplitude spectrum. - /// + /// an array of DIFFERENCE values. public static double[] SumOfAmplitudeDifferences(double[,] spectrogram) { int frameCount = spectrogram.GetLength(0); int deltaCount = frameCount - 1; int freqBinCount = spectrogram.GetLength(1); double[] differenceArray = new double[freqBinCount]; // array of difference values, one for each freq bin - for (int j = 0; j < freqBinCount; j++) // for all frequency bins + + // for all frequency bins + for (int j = 0; j < freqBinCount; j++) { - double deltaI = 0.0; // to accumlate sum of differences + double deltaI = 0.0; // to accumulate sum of differences for (int r = 0; r < frameCount - 1; r++) { deltaI += Math.Abs(spectrogram[r, j] - spectrogram[r + 1, j]); @@ -76,6 +82,6 @@ public static double[] SumOfAmplitudeDifferences(double[,] spectrogram) } return differenceArray; - } // SumDifferences() + } } } diff --git a/src/AudioAnalysisTools/Indices/IndexCalculate.cs b/src/AudioAnalysisTools/Indices/IndexCalculate.cs index 7b330de07..f92456508 100644 --- a/src/AudioAnalysisTools/Indices/IndexCalculate.cs +++ b/src/AudioAnalysisTools/Indices/IndexCalculate.cs @@ -337,7 +337,7 @@ public static IndexCalculateResult Analysis( // ii: CALCULATE THE ACOUSTIC COMPLEXITY INDEX spectralIndices.DIF = AcousticComplexityIndex.SumOfAmplitudeDifferences(amplitudeSpectrogram); - double[] aciSpectrum = AcousticComplexityIndex.CalculateACI(amplitudeSpectrogram); + double[] aciSpectrum = AcousticComplexityIndex.CalculateAci(amplitudeSpectrogram); spectralIndices.ACI = aciSpectrum; // remove low freq band of ACI spectrum and store average ACI value diff --git a/src/AudioAnalysisTools/Indices/IndexDistributions.cs b/src/AudioAnalysisTools/Indices/IndexDistributions.cs index 2b1509700..a89bdc41b 100644 --- a/src/AudioAnalysisTools/Indices/IndexDistributions.cs +++ b/src/AudioAnalysisTools/Indices/IndexDistributions.cs @@ -50,26 +50,12 @@ public class SpectralStats public int Count { get; set; } - public double GetValueOfNthPercentile(int percentile) + public void GetValueOfNthPercentile(int percentile, out int binId, out double value) { - int length = this.Distribution.Length; - double threshold = percentile / 100D; - double[] probs = DataTools.NormaliseArea(this.Distribution); - double[] cumProb = DataTools.ConvertProbabilityDistribution2CummulativeProbabilites(probs); - int percentileBin = 0; - for (int i = 0; i < length - 1; i++) - { - if (cumProb[i] >= threshold) - { - percentileBin = i; - break; - } - } - - this.UpperPercentileBin = percentileBin; - double binWidth = (this.Maximum - this.Minimum) / length; - double value = this.Minimum + (binWidth * percentileBin); - return value; + binId = Statistics.GetNthPercentileBin(this.Distribution, percentile); + this.UpperPercentileBin = binId; + double binWidth = (this.Maximum - this.Minimum) / this.Distribution.Length; + value = this.Minimum + (binWidth * binId); } } @@ -111,8 +97,18 @@ public static Dictionary WriteSpectralIndexDistributionSt { double[] array = DataTools.Matrix2Array(spectrogramMatrices[key]); SpectralStats stats = GetModeAndOneTailedStandardDeviation(array, width, UpperPercentileDefault); + stats.GetValueOfNthPercentile(UpperPercentileDefault, out int binId, out double value); + stats.UpperPercentileBin = binId; indexDistributionStatistics.Add(key, stats); // add index statistics - double value = stats.GetValueOfNthPercentile(UpperPercentileDefault); + + // CVR (cover) and EVN (events/sec) have discrete, sparse distributions when calculating for zoomed tiles, + // and most values are in the zero bin. + // Therefore they return value = 0.0; This is a bug! + // To avoid this problem, set value = maximum when percentileBin = 0 + if (binId == 0) + { + value = stats.Maximum; + } imageList.Add( GraphsAndCharts.DrawHistogram( @@ -133,10 +129,10 @@ public static Dictionary WriteSpectralIndexDistributionSt } } - FileInfo statsFile = new FileInfo(GetSpectralStatsPath(outputDirectory, fileStem)); + var statsFile = new FileInfo(GetSpectralStatsPath(outputDirectory, fileStem)); Json.Serialise(statsFile, indexDistributionStatistics); - Image image3 = ImageTools.CombineImagesVertically(imageList.ToArray()); + var image3 = ImageTools.CombineImagesVertically(imageList.ToArray()); string imagePath = GetSpectralImagePath(outputDirectory, fileStem); image3.Save(imagePath); @@ -184,8 +180,18 @@ public static Dictionary WriteSummaryIndexDistributionSta { double[] array = summaryIndices[key]; SpectralStats stats = GetModeAndOneTailedStandardDeviation(array, width, UpperPercentileDefault); + stats.GetValueOfNthPercentile(UpperPercentileDefault, out int binId, out double value); + stats.UpperPercentileBin = binId; indexDistributionStatistics.Add(key, stats); // add index statistics - double value = stats.GetValueOfNthPercentile(UpperPercentileDefault); + + // CVR (cover) and EVN (events/sec) have discrete, sparse distributions when calculating for zoomed tiles, + // and most values are in the zero bin. + // Therefore they return value = 0.0; This is a bug! + // To avoid this problem, set value = maximum when percentileBin = 0 + if (binId == 0) + { + value = stats.Maximum; + } imageList.Add( GraphsAndCharts.DrawHistogram( diff --git a/src/AudioAnalysisTools/Indices/IndexProperties.cs b/src/AudioAnalysisTools/Indices/IndexProperties.cs index 7724724b9..525869dce 100644 --- a/src/AudioAnalysisTools/Indices/IndexProperties.cs +++ b/src/AudioAnalysisTools/Indices/IndexProperties.cs @@ -120,11 +120,8 @@ public IndexProperties() this.DoDisplay = true; this.NormMin = 0.0; this.NormMax = 1.0; - this.CalculateNormMin = false; - this.CalculateNormMax = false; + this.CalculateNormBounds = false; this.Units = string.Empty; - this.IncludeInComboIndex = false; - this.ComboWeight = 0.0; } // ignored because we don't want to dump this info in ConfigFile log @@ -147,7 +144,7 @@ public string DataType [YamlIgnore] [JsonIgnore] - //TODO: this information should really be encoded rather than inferred + // TODO: this information should really be encoded rather than inferred public bool IsSpectralIndex => this.DataType == "double[]"; public double DefaultValue @@ -181,21 +178,14 @@ public double DefaultValue public double NormMin { get; set; } - public bool CalculateNormMin { get; set; } - public double NormMax { get; set; } - public bool CalculateNormMax { get; set; } + public bool CalculateNormBounds { get; set; } // ignored because we don't want to dump this info in ConfigFile log [JsonIgnore] public string Units { get; set; } - // use these when calculated combination index. - public bool IncludeInComboIndex { get; set; } - - public double ComboWeight { get; set; } - public double NormaliseValue(double value) => DataTools.NormaliseInZeroOne(value, this.NormMin, this.NormMax); /// diff --git a/src/AudioAnalysisTools/Indices/RainIndices.cs b/src/AudioAnalysisTools/Indices/RainIndices.cs index b1927fe29..e2a6bc455 100644 --- a/src/AudioAnalysisTools/Indices/RainIndices.cs +++ b/src/AudioAnalysisTools/Indices/RainIndices.cs @@ -183,7 +183,7 @@ public static RainStruct Get10SecondIndices(double[] signal, double[,] spectrogr } // iv: CALCULATE Acoustic Complexity Index on the AMPLITUDE SPECTRUM - var aciArray = AcousticComplexityIndex.CalculateACI(midbandSpectrogram); + var aciArray = AcousticComplexityIndex.CalculateAci(midbandSpectrogram); rainIndices.ACI = aciArray.Average(); //v: remove background noise from the spectrogram diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs index ba576b454..4fd957a5c 100644 --- a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs +++ b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs @@ -103,7 +103,7 @@ public static string[] GetArrayOfAvailableKeys() /// /// Initializes a new instance of the class. - /// No Arguments CONSTRUCTOR + /// No Arguments CONSTRUCTOR. /// public LDSpectrogramRGB() { @@ -118,7 +118,7 @@ public LDSpectrogramRGB() /// /// Initializes a new instance of the class. - /// CONSTRUCTOR + /// CONSTRUCTOR. /// public LDSpectrogramRGB(TimeSpan xScale, int sampleRate, string colourMap) { @@ -145,10 +145,10 @@ public LDSpectrogramRGB(TimeSpan xScale, int sampleRate, string colourMap) /// /// Initializes a new instance of the class. /// CONSTRUCTOR - /// WARNING: Ths will create a linear herz scale spectrogram + /// WARNING: Ths will create a linear herz scale spectrogram. /// - /// minute of day at which the spectrogram starts - /// time scale : pixels per hour + /// minute of day at which the spectrogram starts. + /// time scale : pixels per hour. /// recording sample rate which also determines scale of Y-axis. /// frame size - which also determines scale of Y-axis. /// acoustic indices used to assign the three colour mapping. @@ -227,7 +227,7 @@ public LDSpectrogramRGB(LdSpectrogramConfig config, IndexGenerationData indexGen /// /// Gets or sets the date and time at which the current LDspectrogram starts - /// This can be used to correctly + /// This can be used to correctly. /// public DateTimeOffset RecordingStartDate { get; set; } @@ -243,7 +243,7 @@ public LDSpectrogramRGB(LdSpectrogramConfig config, IndexGenerationData indexGen public TimeSpan StartOffset { get; set; } /// - /// Gets or sets the temporal duration of one subsegment interval for which indices are calculated + /// Gets or sets the temporal duration of one subsegment interval for which indices are calculated. /// public TimeSpan IndexCalculationDuration { get; set; } @@ -264,7 +264,10 @@ public LDSpectrogramRGB(LdSpectrogramConfig config, IndexGenerationData indexGen /// public FrequencyScale FreqScale { get; set; } - public int YInterval // mark 1 kHz intervals + /// + /// Gets the 1 kHz intervals. + /// + public int GetYinterval { get { @@ -281,7 +284,7 @@ public int YInterval // mark 1 kHz intervals public string ColorMap { get; set; } /// - /// Gets or sets pOSITIVE or NEGATIVE + /// Gets or sets pOSITIVE or NEGATIVE. /// public string ColorMode { get; set; } @@ -300,7 +303,7 @@ public int YInterval // mark 1 kHz intervals /// /// Gets or sets a file from which can be obtained information about sunrise and sunset times for the recording site. /// The csv file needs to be in the correct format and typically should contain 365 lines. - /// Have not attempted to deal with leap years! + /// Have not attempted to deal with leap years!. /// [Obsolete] public FileInfo SunriseDataFile { get; set; } @@ -340,8 +343,7 @@ public bool ReadCsvFiles(DirectoryInfo ipdir, string fileName, string[] keys) var file = new FileInfo(path); if (File.Exists(path)) { - int freqBinCount; - double[,] matrix = IndexMatrices.ReadSpectrogram(file, out freqBinCount); + double[,] matrix = IndexMatrices.ReadSpectrogram(file, out var freqBinCount); matrix = MatrixTools.MatrixRotate90Anticlockwise(matrix); this.SpectrogramMatrices.Add(this.SpectrogramKeys[i], matrix); this.FrameWidth = freqBinCount * 2; @@ -421,7 +423,7 @@ public void LoadSpectrogramDictionary(Dictionary dictionary) } /// - /// Call this method to access a spectrogram matrix + /// Call this method to access a spectrogram matrix. /// public double[,] GetMatrix(string key) { @@ -469,8 +471,9 @@ public void LoadSpectrogramDictionary(Dictionary dictionary) { // get the stats for this key var stats = this.IndexStats[key]; - if (indexProperties.CalculateNormMin) + if (indexProperties.CalculateNormBounds) { + // FIRST CALCULATE THE MIN BOUND // By default the minimum bound is set slightly below the modal value of the index. minBound = stats.Mode - (stats.StandardDeviation * 0.1); @@ -492,11 +495,9 @@ public void LoadSpectrogramDictionary(Dictionary dictionary) { minBound = indexProperties.NormMin; } - } - if (indexProperties.CalculateNormMax) - { - maxBound = stats.GetValueOfNthPercentile(IndexDistributions.UpperPercentileDefault); + // NOW CALCULATE THE MAX BOUND + stats.GetValueOfNthPercentile(IndexDistributions.UpperPercentileDefault, out int binId, out maxBound); // correct for case where max bound = zero. This can happen where ICD is very short i.e. 0.1s. if (maxBound < 0.0001) @@ -525,7 +526,7 @@ public void LoadSpectrogramDictionary(Dictionary dictionary) } /// - /// draws only those spectrograms in the passed array of keys + /// draws only those spectrograms in the passed array of keys. /// public void DrawGreyScaleSpectrograms(DirectoryInfo opdir, string opFileName, string[] keys) { @@ -580,7 +581,7 @@ public void DrawGreyScaleSpectrograms(DirectoryInfo opdir, string opFileName, st } /// - /// Assume calling method has done all the reality checks + /// Assume calling method has done all the reality checks. public Image DrawGreyscaleSpectrogramOfIndex(string key) { var matrix = this.GetNormalisedSpectrogramMatrix(key); @@ -799,15 +800,11 @@ public static Image FrameLDSpectrogram(Image bmp1, Image titleBar, LDSpectrogram int trackHeight = 18; Bitmap timeBmp1 = ImageTrack.DrawTimeRelativeTrack(fullDuration, bmp1.Width, trackHeight); Bitmap timeBmp2 = (Bitmap)timeBmp1.Clone(); - Bitmap suntrack = null; - DateTimeOffset? dateTimeOffset = cs.RecordingStartDate; if (dateTimeOffset.HasValue) { // draw extra time scale with absolute start time. AND THEN Do SOMETHING WITH IT. timeBmp2 = ImageTrack.DrawTimeTrack(fullDuration, cs.RecordingStartDate, bmp1.Width, trackHeight); - - //suntrack = SunAndMoon.AddSunTrackToImage(bmp1.Width, dateTimeOffset, cs.SunriseDataFile); } if (cs.FreqScale == null) @@ -822,11 +819,6 @@ public static Image FrameLDSpectrogram(Image bmp1, Image titleBar, LDSpectrogram // draw the composite bitmap var imageList = new List { titleBar, timeBmp1, bmp1, timeBmp2 }; - //if (suntrack != null) - //{ - // imageList.Add(suntrack); - //} - var compositeBmp = (Bitmap)ImageTools.CombineImagesVertically(imageList); return compositeBmp; } @@ -903,7 +895,6 @@ public static Image DrawRgbColourMatrix(double[,] redM, double[,] grnM, double[, { int rows = redM.GetLength(0); //number of rows int cols = redM.GetLength(1); //number - var bmp = new Bitmap(cols, rows, PixelFormat.Format24bppRgb); //const int maxRgbValue = 255; @@ -957,7 +948,7 @@ public static Image DrawRgbColourMatrix(double[,] redM, double[,] grnM, double[, /// /// A technique to derive a spectrogram from four different indices - /// same as above method but multiply index value by the amplitude value instead of squaring the value + /// same as above method but multiply index value by the amplitude value instead of squaring the value. /// public static Image DrawFourColourSpectrogram(double[,] redM, double[,] grnM, double[,] bluM, double[,] greM, bool doReverseColour) { @@ -1039,41 +1030,41 @@ public static Image DrawColourScale(int maxScaleLength, int ht) Color c = Color.FromArgb(250, 15, 250); gr2.Clear(c); int x = 0; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); c = Color.FromArgb(250, 15, 15); gr2.Clear(c); x += offset; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); //yellow c = Color.FromArgb(250, 250, 15); gr2.Clear(c); x += offset; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); //green c = Color.FromArgb(15, 250, 15); gr2.Clear(c); x += offset; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); // pale blue c = Color.FromArgb(15, 250, 250); gr2.Clear(c); x += offset; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); // blue c = Color.FromArgb(15, 15, 250); gr2.Clear(c); x += offset; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); // purple c = Color.FromArgb(250, 15, 250); gr2.Clear(c); x += offset; - gr.DrawImage(colorBmp, x, 0); //dra + gr.DrawImage(colorBmp, x, 0); return colorScale; } @@ -1082,16 +1073,16 @@ public static Image DrawColourScale(int maxScaleLength, int ht) /// IT CAN BE COPIED AND APPROPRIATELY MODIFIED BY ANY USER FOR THEIR OWN PURPOSE. /// WARNING: Make sure the parameters in the CONFIG file are consistent with the CSV files. /// - /// inputDirectory - /// outputDirectory - /// config for drawing FCSs + /// inputDirectory. + /// outputDirectory. + /// config for drawing FCSs. /// The indices Config Path. - /// indexGenerationData - /// stem name of the original recording - /// will usually be "Towsey.Acoustic" - /// Optional spectra to pass in. If specified the spectra will not be loaded from disk! - /// an array of summary index results - /// Info about the distributions of the spectral statistics + /// indexGenerationData. + /// stem name of the original recording. + /// will usually be "Towsey.Acoustic". + /// Optional spectra to pass in. If specified the spectra will not be loaded from disk. + /// an array of summary index results. + /// Info about the distributions of the spectral statistics. /// Optionally specify details about the site where the audio was recorded. /// This is only available for locations near Brisbane, Austalia. /// Note that these segment errors were derived from previous analysis of the summary indices. @@ -1134,7 +1125,6 @@ public static Tuple[] DrawSpectrogramsFromSpectralIndices( cs1.SiteName = siteDescription?.SiteName; cs1.Latitude = siteDescription?.Latitude; cs1.Longitude = siteDescription?.Longitude; - //cs1.SunriseDataFile = sunriseDataFile; cs1.ErroneousSegments = segmentErrors; // calculate start time by combining DatetimeOffset with minute offset. diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs index fe9e3a690..31edb59b2 100644 --- a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs +++ b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs @@ -56,13 +56,12 @@ public static class LdSpectrogramStitching public const string SummaryIndicesStr = "SummaryIndices"; public const string SpectralIndicesStr = "SpectralIndices"; - public static DirectoryInfo[] GetSubDirectoriesForSiteData(IEnumerable topLevelDataDirectories, string site) + public static DirectoryInfo[] GetSubDirectoriesForSiteData(IEnumerable topLevelDataDirectories, string site, SearchOption searchOption) { //string dateString = String.Format("{0}{1:D2}{2:D2}", dto.Year, dto.Month, dto.Day); string searchPattern = "*" + site + "*"; - return topLevelDataDirectories - .SelectMany(dir => dir.GetDirectories(searchPattern, SearchOption.AllDirectories)) + .SelectMany(dir => dir.GetDirectories(searchPattern, searchOption)) .ToArray(); } diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommon.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommon.cs index aff2ed4a0..80527c5c8 100644 --- a/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommon.cs +++ b/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommon.cs @@ -6,14 +6,55 @@ namespace AudioAnalysisTools.LongDurationSpectrograms.Zooming { using System; using System.Collections.Generic; - using System.Diagnostics; using System.Drawing; + using System.Linq; + using Acoustics.Shared; using Acoustics.Shared.Contracts; using Indices; using TowseyLibrary; public static class ZoomCommon { + public static (Dictionary, Dictionary) LoadSpectra( + AnalysisIoInputDirectory io, + string analysisTag, + string fileStem, + LdSpectrogramConfig config, + Dictionary indexProperties) + { + var keys = config.GetKeys().Distinct(); + + // add two necessary keys for zooming + keys = keys.ToList().Append("SUM"); + keys = keys.ToList().Append("DIF"); + + //add following matrix for possible subsequent BNG combination matrix. + string comboIndexID = "RHZ"; + keys = keys.ToList().Append(comboIndexID); + + var relevantIndexProperties = keys.ToDictionary(x => x, x => indexProperties[x]); + + Dictionary spectra = IndexMatrices.ReadSpectralIndices( + io.InputBase, + fileStem, + analysisTag, + keys.ToArray()); + + /* + // THE FOLLOWING IDEA TO MAKE A COMBINED MATRIX OF BGN and RHZ was rejected. + // Anthony was concerned that the BGN matrix alone was not conveying much information at high resolutions. + // The idea was to combine another matrix with the BGN matrix. + // I tried three combinations, BGN-RHZ, BGN-OSC and BGN-SPT. None of them appeard to provide additional useful information at high resolution. + // The problem is that at high resolution, i.e. approaching 0.1s for an analysis unit, there are not many orthogonal features in a single frequency bin. + // Make a BNG COMBINATION Spectral matrix. + //var comboMatrix = MatrixTools.MaxOfTwoMatrices(spectra["BNG"], spectra["RHZ"]); + var comboMatrix = MatrixTools.AddMatricesWeightedSum(spectra["BGN"], 1.0, spectra[comboIndexID], 10.0); + spectra["BGN"] = comboMatrix; + */ + + return (spectra, relevantIndexProperties); + } + public static Image DrawIndexSpectrogramCommon( LdSpectrogramConfig config, IndexGenerationData indexGenerationData, @@ -98,37 +139,50 @@ public static Image DrawIndexSpectrogramCommon( cs1.SetSpectralIndexProperties(indexProperties); // set the relevant dictionary of index properties cs1.LoadSpectrogramDictionary(spectralSelection); - var imageScaleInMsPerPixel = imageScale.TotalMilliseconds; - double blendWeight1 = 0.0; - double blendWeight2 = 1.0; - - if (imageScaleInMsPerPixel > 15_000) + // set up piecewise linear function to determine colour weights + var logResolution = Math.Log(imageScale.TotalMilliseconds, 2); + double upperResolution = Math.Log(32768, 2); + double lowerResolution = Math.Log(256, 2); + double range = upperResolution - lowerResolution; + double blendWeight1; + if (logResolution >= upperResolution) { blendWeight1 = 1.0; - blendWeight2 = 0.0; } - else if (imageScaleInMsPerPixel > 10_000) + else if (logResolution <= lowerResolution) { - blendWeight1 = 0.9; - blendWeight2 = 0.1; + blendWeight1 = 0.0; } - else if (imageScaleInMsPerPixel > 5000) - { - blendWeight1 = 0.7; - blendWeight2 = 0.3; - } - else if (imageScaleInMsPerPixel > 1000) - { - blendWeight1 = 0.2; - blendWeight2 = 0.8; - } - else if (imageScaleInMsPerPixel > 500) + else { - // > 0.5 seconds - blendWeight1 = 0.1; - blendWeight2 = 0.9; + blendWeight1 = (logResolution - lowerResolution) / range; } + double blendWeight2 = 1 - blendWeight1; + + //else if (imageScaleInMsPerPixel > 2000) + //{ + // blendWeight1 = 0.7; + // blendWeight2 = 0.3; + //} + //else if (imageScaleInMsPerPixel > 1000) + //{ + // blendWeight1 = 0.3; + // blendWeight2 = 0.7; + //} + //else if (imageScaleInMsPerPixel > 500) + //{ + // // > 0.5 seconds + // blendWeight1 = 0.2; + // blendWeight2 = 0.8; + //} + //else if (imageScaleInMsPerPixel > 300) + //{ + // // > 0.5 seconds + // blendWeight1 = 0.1; + // blendWeight2 = 0.9; + //} + var ldfcSpectrogram = cs1.DrawBlendedFalseColourSpectrogram(colorMap1, colorMap2, blendWeight1, blendWeight2); if (ldfcSpectrogram == null) { diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomFocusedSpectrograms.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomFocusedSpectrograms.cs index 4dc51492a..4b7d3660b 100644 --- a/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomFocusedSpectrograms.cs +++ b/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomFocusedSpectrograms.cs @@ -35,31 +35,38 @@ namespace AudioAnalysisTools.LongDurationSpectrograms using StandardSpectrograms; using TowseyLibrary; using Zooming; + using Zio; + using Zio.FileSystems; public static class ZoomFocusedSpectrograms { - public static void DrawStackOfZoomedSpectrograms(DirectoryInfo inputDirectory, DirectoryInfo outputDirectory, ZoomParameters common, TimeSpan focalTime, int imageWidth, string analysisType) + public static void DrawStackOfZoomedSpectrograms( + DirectoryInfo inputDirectory, + DirectoryInfo outputDirectory, + AnalysisIoInputDirectory io, + ZoomParameters common, + string analysisTag, + TimeSpan focalTime, + int imageWidth) { var zoomConfig = common.SpectrogramZoomingConfig; LdSpectrogramConfig ldsConfig = common.SpectrogramZoomingConfig.LdSpectrogramConfig; - var distributions = common.IndexDistributions; - var indexGeneration = common.IndexGenerationData; - + //var distributions = common.IndexDistributions; string fileStem = common.OriginalBasename; - + var indexGeneration = common.IndexGenerationData; TimeSpan dataScale = indexGeneration.IndexCalculationDuration; // ####################### DERIVE ZOOMED OUT SPECTROGRAMS FROM SPECTRAL INDICES - - string[] keys = { "ACI", "BGN", "CVR", "DIF", "ENT", "EVN", "PMN", "PMN", "RHZ", "RVT", "RPS", "RNG", "SUM", "SPT" }; - var indexProperties = InitialiseIndexProperties.FilterIndexPropertiesForSpectralOnly(zoomConfig.IndexProperties); - Dictionary spectra = IndexMatrices.ReadSpectralIndices(inputDirectory, fileStem, analysisType, keys); + //var indexGenerationData = common.IndexGenerationData; + var indexProperties = zoomConfig.IndexProperties; + var (spectra, filteredIndexProperties) = ZoomCommon.LoadSpectra(io, analysisTag, fileStem, zoomConfig.LdSpectrogramConfig, indexProperties); Stopwatch sw = Stopwatch.StartNew(); - // standard scales in seconds per pixel. - double[] imageScales = { 60, 24, 12, 6, 2, 1, 0.6, 0.2 }; + // Set the default time-scales in seconds per pixel. + // These were changed on 3rd April 2019 to better match those in the current zooming config file. + double[] imageScales = { 60, 30, 15, 7.5, 3.2, 1.6, 0.8, 0.4, 0.2 }; if (zoomConfig.SpectralIndexScale != null) { imageScales = zoomConfig.SpectralIndexScale; @@ -71,7 +78,7 @@ public static void DrawStackOfZoomedSpectrograms(DirectoryInfo inputDirectory, D for (int i = 0; i < scaleCount; i++) { var imageScale = TimeSpan.FromSeconds(imageScales[i]); - var image = DrawIndexSpectrogramAtScale(ldsConfig, indexGeneration, indexProperties, focalTime, dataScale, imageScale, imageWidth, spectra, fileStem); + var image = DrawIndexSpectrogramAtScale(ldsConfig, indexGeneration, filteredIndexProperties, focalTime, dataScale, imageScale, imageWidth, spectra, fileStem); if (image != null) { imageList.Add(image); @@ -83,7 +90,11 @@ public static void DrawStackOfZoomedSpectrograms(DirectoryInfo inputDirectory, D sw.Stop(); LoggedConsole.WriteLine("Finished spectrograms derived from spectral indices. Elapsed time = " + sw.Elapsed.TotalSeconds + " seconds"); + // NOTE: The following code is deprecated. It was originally developed to provide some intermediate steps between the hi-resolution false-colour spectrograms + // and the standard grey scale spectrograms. // ####################### DERIVE ZOOMED IN SPECTROGRAMS FROM STANDARD SPECTRAL FRAMES + + /* int[] compressionFactor = { 8, 4, 2, 1 }; int compressionCount = compressionFactor.Length; sw = Stopwatch.StartNew(); @@ -136,6 +147,7 @@ public static void DrawStackOfZoomedSpectrograms(DirectoryInfo inputDirectory, D sw.Stop(); LoggedConsole.WriteLine("Finished spectrograms derived from standard frames. Elapsed time = " + sw.Elapsed.TotalSeconds + " seconds"); + */ // combine the images into a stack Image combinedImage = ImageTools.CombineImagesVertically(imageList); diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomTiledSpectrograms.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomTiledSpectrograms.cs index 9643cb8ab..de0eda358 100644 --- a/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomTiledSpectrograms.cs +++ b/src/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomTiledSpectrograms.cs @@ -89,8 +89,7 @@ public static void DrawTiles( yUnitScale: 1.0, unitHeight: namingPattern.TileHeight); - // TODO: this loads all spectra, even ones we don't need... - var (spectra, filteredIndexProperties) = LoadSpectra(io, analysisTag, fileStem, indexProperties); + var (spectra, filteredIndexProperties) = ZoomCommon.LoadSpectra(io, analysisTag, fileStem, zoomConfig.LdSpectrogramConfig, indexProperties); // false color index tiles GenerateIndexSpectrogramTiles( @@ -329,24 +328,6 @@ private static (TilingProfile Profile, TimeSpan padding) GetTilingProfile( return (namingPattern, padding); } - private static (Dictionary, Dictionary) LoadSpectra( - AnalysisIoInputDirectory io, - string analysisTag, - string fileStem, - Dictionary indexProperties) - { - indexProperties = InitialiseIndexProperties.FilterIndexPropertiesForSpectralOnly(indexProperties); - string[] keys = indexProperties.Keys.ToArray(); - - Dictionary spectra = IndexMatrices.ReadSpectralIndices( - io.InputBase, - fileStem, - analysisTag, - keys); - - return (spectra, indexProperties); - } - public static DateTimeOffset GetPreviousTileBoundary(int tileWidth, double scale, DateTimeOffset recordingStartDate) { // if recording does not start on an absolutely aligned tile boundary, then we align it. diff --git a/src/TowseyLibrary/DataTools.cs b/src/TowseyLibrary/DataTools.cs index 15916097e..cd02003d7 100644 --- a/src/TowseyLibrary/DataTools.cs +++ b/src/TowseyLibrary/DataTools.cs @@ -3287,10 +3287,11 @@ public static double[] NormaliseInZeroOne(double[] v, double normMin, double nor /// /// normalizes the passed array between 0,1. - /// Ensures all values are positive + /// Ensures all values are positive. + /// WARNING: Where the min = max (e.g. a uniform distribution), + /// this method will return an array of NaN. + /// The calling method needs to check for this. /// - /// - /// public static double[] normalise(int[] v) { // find min an max @@ -3454,23 +3455,31 @@ public static void Normalise(double[] v, double threshold, out double[] output, /// /// Normalizes an array so that the sum of its values (area under curve) = 1.0 - /// Use to express data as probability funciton. + /// Use to express data as probability function. + /// WARNING: This method will NOT work where have a uniform distribution of negative values. /// - /// - /// public static double[] NormaliseArea(int[] array) { + int length = array.Length; double[] v = normalise(array); // ensures all values in 0,1 - double sum = 0; - for (int i = 0; i < v.Length; i++) + double sum = v.Sum(); + double[] ret = new double[length]; + + // Check for case of uniform distribution or where normalise(array) has returned NaN values. + if (double.IsNaN(sum)) { - sum += v[i]; + var arraySum = array.Sum(); + for (int i = 0; i < length; i++) + { + ret[i] = array[i] / (double)arraySum; + } } - - double[] ret = new double[v.Length]; - for (int i = 0; i < v.Length; i++) + else { - ret[i] = v[i] / sum; + for (int i = 0; i < length; i++) + { + ret[i] = v[i] / sum; + } } return ret; @@ -3479,22 +3488,19 @@ public static double[] NormaliseArea(int[] array) /// /// Normalizes an array so that the sum of its values (area under curve) = 1.0 /// Use to express data as probability function. - /// NB: ONLY USE THIS METHOD IF ARRAY CONTAINS NEGATIVE VALUES + /// WARNING: ONLY USE THIS METHOD IF ARRAY CONTAINS NEGATIVE VALUES /// First of all normalises array into [0,1] - /// This is rather dodgy! + /// WARNING: This method will NOT work where have a uniform distribution of negative values. /// - /// - /// public static double[] NormaliseArea(double[] data) { - double[] v = normalise(data); // ensures all values in 0,1 + double[] v = normalise(data); // ensures all values in 0, 1 double sum = 0.0; for (int i = 0; i < v.Length; i++) { sum += v[i]; } - // Console.WriteLine("Area={0:f4}",sum); if (sum == 0.0) { return data; @@ -3513,8 +3519,6 @@ public static double[] NormaliseArea(double[] data) /// normalises an array of doubles to probabilities that sum to one. /// assumes that values in the data vector are >= zero. /// - /// - /// public static double[] Normalise2Probabilites(double[] data) { int length = data.Length; diff --git a/src/TowseyLibrary/MatrixTools.cs b/src/TowseyLibrary/MatrixTools.cs index 27cccdd75..7acea6dc3 100644 --- a/src/TowseyLibrary/MatrixTools.cs +++ b/src/TowseyLibrary/MatrixTools.cs @@ -976,8 +976,8 @@ public static void WriteMatrix(int[,] matrix) public static void WriteMatrix2File(double[,] matrix, string fPath) { - int rowCount = matrix.GetLength(0); //height - int colCount = matrix.GetLength(1); //width + int rowCount = matrix.GetLength(0); // height + int colCount = matrix.GetLength(1); // width for (int i = 0; i < rowCount; i++) { for (int j = 0; j < colCount; j++) @@ -994,91 +994,107 @@ public static void WriteMatrix2File(double[,] matrix, string fPath) } /// - /// ADD matrix m2 to matrix m1 + /// ADD matrix m2 to matrix m1. /// public static double[,] AddMatrices(double[,] m1, double[,] m2) - { - if (m1 == null) - { - return m2; - } + { + if ((m1 == null) || (m2 == null)) + { + return null; + } - if (m2 == null) - { - return m1; - } + int m1Rows = m1.GetLength(0); + int m1Cols = m1.GetLength(1); + int m2Rows = m2.GetLength(0); + int m2Cols = m2.GetLength(1); + if (m1Rows != m2Rows) + { + throw new Exception("ERROR! Matrix dims must be same for matrix addition."); + } - int m1Rows = m1.GetLength(0); - int m1Cols = m1.GetLength(1); - int m2Rows = m2.GetLength(0); - int m2Cols = m2.GetLength(1); - if (m1Rows != m2Rows) - { - throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); - } + if (m1Cols != m2Cols) + { + throw new Exception("ERROR! Matrix dims must be same for matrix addition."); + } - if (m1Cols != m2Cols) + double[,] newMatrix = (double[,])m1.Clone(); + for (int i = 0; i < m1Rows; i++) + { + for (int j = 0; j < m1Cols; j++) { - throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); + newMatrix[i, j] = m1[i, j] + m2[i, j]; } + } - double[,] newMatrix = (double[,])m1.Clone(); - for (int i = 0; i < m1Rows; i++) - { - for (int j = 0; j < m1Cols; j++) - { - newMatrix[i, j] = m1[i, j] + m2[i, j]; - } - } + return newMatrix; + } - return newMatrix; - } + /// + /// Create a matrix whose values are the max of two passed matrices, m1 and m2. + /// + public static double[,] MaxOfTwoMatrices(double[,] m1, double[,] m2) + { + if ((m1 == null) || (m2 == null)) + { + return null; + } - /// - /// adds two matrices using weighted sum - /// Typically expected that that w1 + w2 = 0 and both matrices are normalised. - /// - public static double[,] AddMatricesWeightedSum(double[,] m1, double w1, double[,] m2, double w2) - { - if (m1 == null) - { - return m2; - } + int m1Rows = m1.GetLength(0); + int m1Cols = m1.GetLength(1); + int m2Rows = m2.GetLength(0); + int m2Cols = m2.GetLength(1); + if (m1Rows != m2Rows || m1Cols != m2Cols) + { + throw new Exception("ERROR! Matrix dimensions must be same."); + } - if (m2 == null) - { - return m1; - } + double[,] newMatrix = new double[m1Rows, m1Cols]; + for (int i = 0; i < m1Rows; i++) + { + for (int j = 0; j < m1Cols; j++) + { + newMatrix[i, j] = Math.Max(m1[i, j], m2[i, j]); + } + } - int m1Rows = m1.GetLength(0); - int m1Cols = m1.GetLength(1); - int m2Rows = m2.GetLength(0); - int m2Cols = m2.GetLength(1); - if (m1Rows != m2Rows) - { - throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); - } + return newMatrix; + } - if (m1Cols != m2Cols) - { - throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); - } + /// + /// Adds two matrices using weighted sum. + /// Typically expected that that w1 + w2 = 0 and both matrices are normalised. + /// + public static double[,] AddMatricesWeightedSum(double[,] m1, double w1, double[,] m2, double w2) + { + if ((m1 == null) || (m2 == null)) + { + return null; + } - double[,] newMatrix = new double[m1Rows, m1Cols]; - for (int i = 0; i < m1Rows; i++) - { - for (int j = 0; j < m1Cols; j++) - { - newMatrix[i, j] = (w1 * m1[i, j]) + (w2 * m2[i, j]); - } - } + int m1Rows = m1.GetLength(0); + int m1Cols = m1.GetLength(1); + int m2Rows = m2.GetLength(0); + int m2Cols = m2.GetLength(1); + if (m1Rows != m2Rows || m1Cols != m2Cols) + { + throw new Exception("ERROR! Matrix dimensions must be same."); + } - return newMatrix; - } + double[,] newMatrix = new double[m1Rows, m1Cols]; + for (int i = 0; i < m1Rows; i++) + { + for (int j = 0; j < m1Cols; j++) + { + newMatrix[i, j] = (w1 * m1[i, j]) + (w2 * m2[i, j]); + } + } - /// - /// DIVIDE matrix m1 by factor - /// + return newMatrix; + } + + /// + /// DIVIDE matrix m1 by factor. + /// public static double[,] DivideMatrix(double[,] m1, double factor) { if (m1 == null) @@ -1101,24 +1117,24 @@ public static void WriteMatrix2File(double[,] matrix, string fPath) return newMatrix; } - /// - /// Subtract matrix m2 from matrix m1 - /// + /// + /// Subtract matrix m2 from matrix m1. + /// public static double[,] SubtractMatrices(double[,] m1, double[,] m2) - { + { int m1Rows = m1.GetLength(0); int m1Cols = m1.GetLength(1); int m2Rows = m2.GetLength(0); int m2Cols = m2.GetLength(1); if (m1Rows != m2Rows) - { - throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); - } + { + throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); + } if (m1Cols != m2Cols) - { - throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); - } + { + throw new Exception("ERROR! Matrix dims must be same for matrix subtraction."); + } double[,] newMatrix = (double[,])m1.Clone(); for (int i = 0; i < m1Rows; i++) diff --git a/src/TowseyLibrary/Statistics.cs b/src/TowseyLibrary/Statistics.cs index 48d58d94d..9d7fa35d5 100644 --- a/src/TowseyLibrary/Statistics.cs +++ b/src/TowseyLibrary/Statistics.cs @@ -1,11 +1,10 @@ -// +// // 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). // namespace TowseyLibrary { using System; - using System.Collections.Generic; using System.Text; /// @@ -21,51 +20,68 @@ public static double GetMedian(double[] v) return median; } + public static int GetNthPercentileBin(int[] distribution, int percentile) + { + int length = distribution.Length; + double threshold = percentile / 100D; + double[] probs = DataTools.NormaliseArea(distribution); + double[] cumProb = DataTools.ConvertProbabilityDistribution2CummulativeProbabilites(probs); + int percentileBin = 0; + for (int i = 0; i < length; i++) + { + if (cumProb[i] >= threshold) + { + percentileBin = i; + break; + } + } + + return percentileBin; + } + /// /// Analyses an array of events or hits, represented by a binary of matrix. /// Assumes a Poisson distribution /// Returns an array of Z-scores indicating the probability at any time or frame that the number of hits occuring /// in the window centred on that point could have occured by chance. /// - /// - /// - /// - /// - /// public static void AnalyseClustersOfHits(int[] hits, int window, double thresholdZ, int thresholdCount, out double[] zScores, out double expectedHits, out double sd) { int frameCount = hits.Length; int hitCount = DataTools.CountPositives(hits); - expectedHits = (double)hitCount * window / frameCount; - sd = Math.Sqrt(expectedHits); //assume Poisson Distribution - //LoggedConsole.WriteLine("hitCount="+hitCount+" expectedHits = " + expectedHits + "+/-" + sd+" thresholdSum="+thresholdSum); - int offset = (int)(window * 0.5); //assign score to position in window + // assume Poisson Distribution + sd = Math.Sqrt(expectedHits); + + // LoggedConsole.WriteLine("hitCount="+hitCount+" expectedHits = " + expectedHits + "+/-" + sd+" thresholdSum="+thresholdSum); + int offset = (int)(window * 0.5); // assign score to position in window int sum = 0; for (int i = 0; i < window; i++) { + // set up the song window if (hits[i] > 0) { - sum++; //set up the song window + sum++; } } - //now calculate z-scores for the number of syllable hits in a window + // now calculate z-scores for the number of syllable hits in a window zScores = new double[frameCount]; for (int i = window; i < frameCount; i++) { if (sum < thresholdCount) { - zScores[i - offset] = -10.0; //not enough hits to constitute a cluster - set ascore to neg value + // not enough hits to constitute a cluster - set ascore to neg value + zScores[i - offset] = -10.0; } else { zScores[i - offset] = (sum - expectedHits) / sd; } - sum = sum - hits[i - window] + hits[i]; //move the songwindow + sum = sum - hits[i - window] + hits[i]; // move the songwindow } } @@ -127,8 +143,8 @@ public static double tStatistic(double m1, double sd1, int count1, double v2 = sd2 * sd2; int df = count1 + count2 - 2; double v = (((count1 - 1) * v1) + ((count2 - 1) * v2)) / df; - double SEsquared = v * (count1 + count2) / (count1 * count2); - double t = (m1 - m2) / Math.Sqrt(SEsquared); + double seSquared = v * (count1 + count2) / (count1 * count2); + double t = (m1 - m2) / Math.Sqrt(seSquared); return t; } @@ -179,8 +195,7 @@ public static double tStatisticAlpha(double t, int df) return p; } - public static double[] bayesBoundary(int countC1, double meanC1, double sdC1, - int countC2, double meanC2, double sdC2) + public static double[] bayesBoundary(int countC1, double meanC1, double sdC1, int countC2, double meanC2, double sdC2) { double lnRatio = Math.Log(countC1 / (double)countC2); double sqrMean1 = meanC1 * meanC1; @@ -206,11 +221,11 @@ public static double[] quadraticRoots(double A, double B, double C) } double sqrt = Math.Sqrt((B * B) - (4 * A * C)); - double Q = -0.5 * (B + (signB * sqrt)); + double q = -0.5 * (B + (signB * sqrt)); double[] roots = new double[2]; - roots[0] = Q / A; - roots[1] = C / Q; + roots[0] = q / A; + roots[1] = C / q; return roots; } @@ -222,10 +237,10 @@ public static double[] CreateInverseProbabilityDistribution(int length) distribution[i] = 1 / (double)(i + 1); } - //for (int i = 0; i < length; i++) distribution[i] = 1 / (double)((i + 1) * (i + 1)); - //double sum = 0; - //for (int i = 0; i < length; i++) sum += distribution[i]; - //Console.WriteLine("pre-sum = {0:f3}", sum); + // for (int i = 0; i < length; i++) distribution[i] = 1 / (double)((i + 1) * (i + 1)); + // double sum = 0; + // for (int i = 0; i < length; i++) sum += distribution[i]; + // Console.WriteLine("pre-sum = {0:f3}", sum); distribution = DataTools.Normalise2Probabilites(distribution); return distribution; } @@ -238,9 +253,9 @@ public static double[] CreateQuadraticProbabilityDistribution(int length) distribution[i] = i * i; } - //double sum = 0; - //for (int i = 0; i < length; i++) sum += distribution[i]; - //Console.WriteLine("pre-sum = {0:f3}", sum); + // double sum = 0; + // for (int i = 0; i < length; i++) sum += distribution[i]; + // Console.WriteLine("pre-sum = {0:f3}", sum); distribution = DataTools.Normalise2Probabilites(distribution); distribution = DataTools.reverseArray(distribution); return distribution; @@ -250,7 +265,7 @@ public static Tuple RandomSamplingUsingProbabilityDistribution(int { double[] distribution = CreateInverseProbabilityDistribution(distributionlength); - //double[] distribution = Statistics.CreateQuadraticProbabilityDistribution(distributionlength); + // double[] distribution = Statistics.CreateQuadraticProbabilityDistribution(distributionlength); // double sum = distribution.Sum(); // Console.WriteLine("post-sum = {0:f3}", sum); distribution = DataTools.ConvertProbabilityDistribution2CummulativeProbabilites(distribution); @@ -263,106 +278,28 @@ public static Tuple RandomSamplingUsingProbabilityDistribution(int // int lowerIndex = 0; // int upperIndex = 99; // int location = DataTools.WhichSideOfCentre(distribution, refValue, lowerIndex, upperIndex); - // Console.WriteLine("location = " + location); - int[] samples = DataTools.SampleArrayRandomlyWithoutReplacementUsingProbabilityDistribution(distribution, sampleCount, seed); - - //for (int i = 0; i < sampleCount; i++) Console.WriteLine("s"+i+ " " + samples[i]); Tuple tuple = DataTools.SortArray(samples); int[] sortedSamples = tuple.Item2; return Tuple.Create(samples, sortedSamples); } - public static void main(string[] args) + /// + /// This method is a test for ensuring correct bin ID is chosen for some degenerate cases. + /// + public static void TestGetNthPercentileBin() { - /* - int countC1 = 4000000; - double meanC1 = -8.7; - double sdC1 = 4.6; - int countC2 = 4000; - double meanC2 = 8.0; - double sdC2 = 2.7; - double bb[] = bayesBoundary(countC1, meanC1, sdC1, countC2, meanC2, sdC2); - LoggedConsole.WriteLine("boundary 1="+bb[0]+" boundary 2="+bb[1]); - */ - - /* - double[] roots = NormalDist.quadraticRoots(6, -13, 6); - LoggedConsole.WriteLine("root1="+roots[0]+" root2="+roots[1]); - */ - - //calculating the t-statistic. - double av1 = 16.78; - double sd1 = 0.6788; - int count1 = 50; - double av2 = 17.00; - double sd2 = 0.782; - int count2 = 50; - double t = tStatistic(av1, sd1, count1, av2, sd2, count2); - LoggedConsole.WriteLine("t=" + t); - int df = count1 + count2 - 2; - LoggedConsole.WriteLine("alpha=" + tStatisticAlpha(Math.Abs(t), df)); - - //calculate a lot of t-statistics taken from two files. - /* String dir = "D:\\Bioinformatics\\Data\\Chlamydia_trachomatis\\TSSpredictionsSarahEML2\\"; - // String f1 = dir+"earlyGenesPostVirgilTStats.txt"; - String f1 = dir+"middleGenesPostVirgilTStats.txt"; - String f2 = dir+"allGenesPostVirgilTStats.txt"; - String op = dir+"earlyGenesPostVirgilTStatsOutput.txt"; - int count1 = 28; - int count2 = 798; - Vector v1 = FileUtilities.ReadFile2Vector(f1); - Vector v2 = FileUtilities.ReadFile2Vector(f2); - BufferedWriter bw = FileUtilities.getBufferedWriter(op); - for(int i=0;i<1000;i++) - { String line1av = (String)v1.get(i); - String line2av = (String)v2.get(i); - if(line1av.startsWith("#")) continue; - if(line2av.startsWith("#")) continue; - i++; - String line1sd = (String)v1.get(i); - String line2sd = (String)v2.get(i); - - //get the values - String[] av1array = line1av.split(" +"); - String[] av2array = line2av.split(" +"); - String[] sd1array = line1sd.split(" +"); - String[] sd2array = line2sd.split(" +"); - - String title = av1array[0]; - LoggedConsole.WriteLine(line1av); - LoggedConsole.WriteLine(line2av); - for(int n=1;n=v1.size()) break; - } - */ - - /* - int countC1 = 4000000; - double meanC1 = -8.7; - double sdC1 = 4.6; - int countC2 = 4000; - double meanC2 = 8.0; - double sdC2 = 2.7; - double bb[] = bayesBoundary(countC1, meanC1, sdC1, countC2, meanC2, sdC2); - LoggedConsole.WriteLine("boundary 1="+bb[0]+" boundary 2="+bb[1]); - */ - - LoggedConsole.WriteLine("FINISHED"); - }//end MAIN() - }//end class + for(int i = 0; i < 100; i++) + { + // distribution[i] = 0; + distribution[i] = 1; + } + + var binId = GetNthPercentileBin(distribution, 98); + } + } } diff --git a/tests/Acoustics.Test/AnalysisPrograms/Concatenation/ConcatenationTests.cs b/tests/Acoustics.Test/AnalysisPrograms/Concatenation/ConcatenationTests.cs index a8ef635b2..713bb73a0 100644 --- a/tests/Acoustics.Test/AnalysisPrograms/Concatenation/ConcatenationTests.cs +++ b/tests/Acoustics.Test/AnalysisPrograms/Concatenation/ConcatenationTests.cs @@ -104,7 +104,7 @@ public void ConcatenateEverythingYouCanLayYourHandsOn() var actualImage = ImageTools.ReadImage2Bitmap(imageFileInfo.FullName); Assert.That.ImageIsSize(722, 632, actualImage); Assert.That.PixelIsColor(new Point(100, 100), Color.FromArgb(211, 211, 211), actualImage); - Assert.That.PixelIsColor(new Point(200, 125), Color.FromArgb(47, 34, 255), actualImage); + Assert.That.PixelIsColor(new Point(200, 125), Color.FromArgb(60, 44, 255), actualImage); Assert.That.PixelIsColor(new Point(675, 600), Color.FromArgb(255, 105, 180), actualImage); } @@ -160,8 +160,8 @@ public void ConcatenateIndexFilesTest24Hour() // we expect only the second half (past midnight) of the image to be rendered Assert.That.ImageIsSize(512, 632, actualImage); - Assert.That.PixelIsColor(new Point(105, 154), Color.FromArgb(21, 200, 255), actualImage); - Assert.That.PixelIsColor(new Point(100, 160), Color.FromArgb(0, 69, 131), actualImage); + Assert.That.PixelIsColor(new Point(105, 154), Color.FromArgb(34, 30, 255), actualImage); + Assert.That.PixelIsColor(new Point(100, 160), Color.FromArgb(0, 79, 132), actualImage); } /// @@ -217,7 +217,7 @@ public void ConcatenateIndexFilesTest24HourWithoutDateRange() var actualImage1 = ImageTools.ReadImage2Bitmap(image1FileInfo.FullName); Assert.That.ImageIsSize(210, 632, actualImage1); Assert.That.PixelIsColor(new Point(100, 100), Color.FromArgb(211, 211, 211), actualImage1); - Assert.That.PixelIsColor(new Point(50, 50), Color.FromArgb(66, 17, 14), actualImage1); + Assert.That.PixelIsColor(new Point(50, 50), Color.FromArgb(86, 27, 16), actualImage1); // IMAGE 2: Compare image files - check that image exists and dimensions are correct var dateString2 = "20160726"; @@ -232,7 +232,7 @@ public void ConcatenateIndexFilesTest24HourWithoutDateRange() var actualImage2 = ImageTools.ReadImage2Bitmap(image2FileInfo.FullName); Assert.That.ImageIsSize(512, 632, actualImage2); - Assert.That.PixelIsColor(new Point(50, 124), Color.FromArgb(57, 28, 255), actualImage2); + Assert.That.PixelIsColor(new Point(50, 124), Color.FromArgb(70, 37, 255), actualImage2); Assert.That.PixelIsColor(new Point(460, 600), Color.FromArgb(255, 105, 180), actualImage2); } diff --git a/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LdSpectrogramStitchingTests.cs b/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LdSpectrogramStitchingTests.cs index 6e80120df..fc9c5e986 100644 --- a/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LdSpectrogramStitchingTests.cs +++ b/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LdSpectrogramStitchingTests.cs @@ -1,4 +1,4 @@ -// +// // 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). // @@ -42,8 +42,7 @@ public void TestDirectoryScannerMethod() }); var expected = test.Where(d => d.FullName.Contains(@"\b\")).ToArray(); - - var actual = LdSpectrogramStitching.GetSubDirectoriesForSiteData(expected, "b"); + var actual = LdSpectrogramStitching.GetSubDirectoriesForSiteData(expected, "b", SearchOption.AllDirectories); CollectionAssert.AreEqual(expected, actual); } diff --git a/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommonTests.cs b/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommonTests.cs index 1d2b0c2b6..4c4b43970 100644 --- a/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommonTests.cs +++ b/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/Zooming/ZoomCommonTests.cs @@ -26,7 +26,7 @@ public ZoomCommonTests() /// /// This test is designed to ensure that images are produced at the correct length. - /// We had a beviour where they were being trimmed by a whole pixel at the end of + /// We had a behaviour where they were being trimmed by a whole pixel at the end of /// recordings that didn't wholly fill a minute. At very low scales this is acceptable, but /// at high scales just because 1/6th of a pixel's worth of data is absent does not mean /// that we shouldn't render the other 5/6ths of the pixel. And if we don't, it creates diff --git a/tests/Fixtures/Indices/ACI.bin b/tests/Fixtures/Indices/ACI.bin index 16e4f8364..fd57821f5 100644 --- a/tests/Fixtures/Indices/ACI.bin +++ b/tests/Fixtures/Indices/ACI.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:48e139dc1225837f322cb67b50223c68096e38aea77cb311a1fdada91b9b1ed5 +oid sha256:51867bb43984592080a94dece892987029a9d8023de258a126ff11ba177b4bf3 size 2076