Skip to content

Commit

Permalink
Set up new methods for drawing spectral tracks
Browse files Browse the repository at this point in the history
Issue #297 Set up different track drawing method for each type of spectral track.
  • Loading branch information
towsey committed Apr 7, 2020
1 parent 5db59e7 commit 297729e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
12 changes: 0 additions & 12 deletions src/AnalysisBase/ResultBases/EventBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ namespace AnalysisBase.ResultBases
{
using System;

public enum EventType
{
Blob,
Whistle,
Track,
Whip,
Click,
Oscillation,
StackedHarmonic,
Untyped, // obtained using AED.
}

/// <summary>
/// The base class for all Event style results.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static (List<AcousticEvent> Events, double[] CombinedIntensity) GetSpectr
var ae = new AcousticEvent(segmentStartOffset, oblong, nyquist, binCount, frameDuration, frameStep, frameCount)
{
// get the track as matrix
TheTrack = track.GetTrackAsMatrix(frameStep, binWidth),
TheTrack = track,
};
events.Add(ae);

Expand Down Expand Up @@ -140,7 +140,7 @@ public static (List<AcousticEvent> Events, double[] CombinedIntensity) GetSpectr

public static SpectralTrack GetTrack(double[,] peaks, int startRow, int startBin, double threshold)
{
var track = new SpectralTrack(startRow, startBin, peaks[startRow, startBin]);
var track = new SpectralTrack(SpectralTrackType.HorizontalTrack, startRow, startBin, peaks[startRow, startBin]);

// set the start point in peaks matrix to zero to prevent return to this point.
peaks[startRow, startBin] = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static (List<AcousticEvent> Events, double[] CombinedIntensity) GetVertic
var ae = new AcousticEvent(segmentStartOffset, oblong, nyquist, binCount, frameDuration, frameStep, frameCount)
{
// get the track as matrix
TheTrack = track.GetTrackAsMatrix(frameStep, binWidth),
TheTrack = track,
};

events.Add(ae);
Expand Down Expand Up @@ -153,7 +153,7 @@ public static (List<AcousticEvent> Events, double[] CombinedIntensity) GetVertic

public static SpectralTrack GetVerticalTrack(double[,] peaks, int startRow, int startBin, int maxBin, double threshold)
{
var track = new SpectralTrack(startRow, startBin, peaks[startRow, startBin]);
var track = new SpectralTrack(SpectralTrackType.VerticalTrack, startRow, startBin, peaks[startRow, startBin]);

// set the start point in peaks matrix to zero to prevent return to this point.
peaks[startRow, startBin] = 0.0;
Expand Down
5 changes: 2 additions & 3 deletions src/AudioAnalysisTools/AcousticEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ public AcousticEventClassMap()
public double Bandwidth => this.HighFrequencyHertz - this.LowFrequencyHertz + 1;

/// <summary>
/// Gets or sets a matrix representing the track.
/// i.e. it defines the track.
/// Gets or sets a horizontal or vertical spectral track.
/// </summary>
public double[,] TheTrack { get; set; }
public SpectralTrack TheTrack { get; set; }

public bool IsMelscale { get; set; }

Expand Down

0 comments on commit 297729e

Please sign in to comment.