Skip to content

Commit

Permalink
Work on ZoomTiledSpectrograms
Browse files Browse the repository at this point in the history
1: removed LoadSpectra() method from ZoomTiledSpectrograms and placed it in ZoomCommon
2: Reworked some of the bounds in the the config file
  • Loading branch information
towsey committed Apr 4, 2019
1 parent 3f9fe4f commit f9ed53d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
9 changes: 4 additions & 5 deletions src/AnalysisConfigFiles/IndexPropertiesConfig.Zooming.yml
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ 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
CalculateNormBounds: false
Expand All @@ -497,16 +497,15 @@ BGN:
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
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 is NOT an acoustic index. It is used as intermediate for subsequent calculation of ACI."
Expand Down Expand Up @@ -569,7 +568,7 @@ PMN:
DefaultValue: 0.0
DoDisplay: true
NormMin: 0.0
NormMax: 5.5
NormMax: 15.0
CalculateNormBounds: false
ProjectID: Acoustic Indices
Units: "dB"
Expand Down
13 changes: 8 additions & 5 deletions src/AnalysisPrograms/Draw/Zooming/DrawZoomingSpectrograms.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// --------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DrawZoomingSpectrograms.cs" company="QutEcoacoustics">
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group).
// </copyright>
Expand Down Expand Up @@ -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"))
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -329,24 +328,6 @@ private static (TilingProfile Profile, TimeSpan padding) GetTilingProfile(
return (namingPattern, padding);
}

private static (Dictionary<string, double[,]>, Dictionary<string, IndexProperties>) LoadSpectra(
AnalysisIoInputDirectory io,
string analysisTag,
string fileStem,
Dictionary<string, IndexProperties> indexProperties)
{
indexProperties = InitialiseIndexProperties.FilterIndexPropertiesForSpectralOnly(indexProperties);
string[] keys = indexProperties.Keys.ToArray();

Dictionary<string, double[,]> 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.
Expand Down

0 comments on commit f9ed53d

Please sign in to comment.