Skip to content

Commit

Permalink
Edit code to adjust to config changes
Browse files Browse the repository at this point in the history
Change code so that both min and max bounds are taken from the default value in the indexPropertiesConfig file or they are both calculated.
Some resharper changes on the way.
  • Loading branch information
towsey committed Apr 2, 2019
1 parent b6f64ca commit 1d78306
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 74 deletions.
14 changes: 7 additions & 7 deletions src/AnalysisConfigFiles/IndexPropertiesConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ ACI:
DoDisplay: true
NormMin: 0.4
NormMax: 0.7
CalculateNormBounds: true
CalculateNormBounds: false
ProjectID: Acoustic Indices
Units: ""
BGN:
Expand All @@ -518,10 +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
CalculateNormBounds: true
CalculateNormBounds: false
ProjectID: Acoustic Indices
Units: "dB"
CVR:
Expand All @@ -532,8 +532,8 @@ CVR:
DefaultValue: 0.0
DoDisplay: true
NormMin: 0.0
NormMax: 0.7
CalculateNormBounds: true
NormMax: 0.2
CalculateNormBounds: false
ProjectID: Acoustic Indices
Units: ""
DIF:
Expand All @@ -555,7 +555,7 @@ ENT:
DoDisplay: true
NormMin: 0.0
NormMax: 0.6
CalculateNormBounds: true
CalculateNormBounds: false
ProjectID: Acoustic Indices
Units: ""
EVN:
Expand All @@ -566,7 +566,7 @@ EVN:
DoDisplay: true
NormMin: 0.0
NormMax: 2.0
CalculateNormBounds: true
CalculateNormBounds: false
ProjectID: Acoustic Indices
Units: "events/s"
OSC:
Expand Down
9 changes: 7 additions & 2 deletions src/AnalysisPrograms/Sandpit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public override Task<int> Execute(CommandLineApplication app)
//CodeToPlaceScoreTracksUnderLdfcSpectrograms();
//CodeToPlaceScoreTracksUnderSingleImage();

//ConcatenateIndexFilesAndSpectrograms();
ConcatenateIndexFilesAndSpectrograms();
//ConcatenateGreyScaleSpectrogramImages();
//ConcatenateMarineImages();
//ConcatenateImages();
Expand All @@ -96,7 +96,7 @@ public override Task<int> Execute(CommandLineApplication app)
//TestEigenValues();
//TestChannelIntegrity();
//TestDct();
Statistics.TestGetNthPercentileBin();
//Statistics.TestGetNthPercentileBin();

//TEST_FilterMovingAverage();
//TestImageProcessing();
Expand Down Expand Up @@ -705,6 +705,11 @@ public static void ConcatenateIndexFilesAndSpectrograms()
string gapRendering = "TimedGaps"; // the default
bool concatenateEverythingYouCanLayYourHandsOn = false; // default is 24-hour blocks

// WARNING: Be careful about Search option. The default is all directories but in some of my work require TopDirectoryOnly.
// See LdSpectrogramStitching.GetSubDirectoriesForSiteData() lines 64 and 65.
// var searchOption = SearchOption.AllDirectories;
// var searchOption = SearchOption.TopDirectoryOnly;

/*
// ########################## CONCATENATION of Sarah Lowe's recordings
// The drive: work = G; home = E
Expand Down
16 changes: 3 additions & 13 deletions src/AudioAnalysisTools/Indices/IndexProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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);

/// <summary>
Expand Down
Loading

0 comments on commit 1d78306

Please sign in to comment.