Skip to content

Commit

Permalink
Final edits after Anthony review.
Browse files Browse the repository at this point in the history
Issue #297 branch for recognizers.
  • Loading branch information
towsey committed May 11, 2020
1 parent 79e8f35 commit 6f4eda6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/AnalysisPrograms/Draw/RibbonPlots/RibbonPlot.Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void Operation(IImageProcessingContext context)
var y = Padding + ((Padding + ribbonHeight) * b);

// draw label
context.DrawTextSafe(textGraphics, dateLabel, scaledFont, textColor, new Point(HorizontalPadding, y + (ribbonHeight / 2)));
context.DrawTextSafe(dateLabel, scaledFont, textColor, new Point(HorizontalPadding, y + (ribbonHeight / 2)));

// draw void
var @void = new RectangularPolygon(ribbonLeft, y, estimatedWidth, ribbonHeight);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override AnalyzerConfig ParseConfig(FileInfo file)
return config;
}

throw new ConfigFileException($"Autralasian Bittern expects one and only one {nameof(OneBinTrackParameters)}} algorithm.", file);
throw new ConfigFileException($"Autralasian Bittern expects one and only one {nameof(OnebinTrackParameters)} algorithm.", file);
}

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions src/AudioAnalysisTools/AudioAnalysisTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Events\Tracks\**" />
<EmbeddedResource Remove="Events\Tracks\**" />
<None Remove="Events\Tracks\**" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Acoustics.Shared\Acoustics.Shared.csproj" />
<ProjectReference Include="..\Acoustics.Tools\Acoustics.Tools.csproj" />
Expand Down Expand Up @@ -36,7 +41,4 @@
</PackageReference>
<PackageReference Include="Towel" Version="1.0.11-alpha" />
</ItemGroup>
<ItemGroup>
<Folder Include="Events\Tracks\" />
</ItemGroup>
</Project>
7 changes: 2 additions & 5 deletions src/AudioAnalysisTools/Events/Drawing/EventDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,20 @@ namespace AudioAnalysisTools.Events.Drawing

public static class EventDrawer
{

/// <summary>
/// Draws a "score" indicator on the left edge of an event.
/// </summary>
/// <param name="event">The event for which to draw the score indicator.</param>
/// <param name="graphics">The image context to draw to.</param>
/// <param name="options">The event rendering optons to use.</param>
/// <param name="@event">The event for which to draw the score indicator.</param>
public static void DrawScoreIndicator(this SpectralEvent @event, IImageProcessingContext graphics, EventRenderingOptions options)
{
if (!options.DrawScore)
{
return;
}

// Although an Interval<double> ScoreRange property has been added to EventCommon,
// this does not clamp values. For now, we clamp before drawing.
var normalisedScore = @event.ScoreNormalised.Clamp(0, 1);
var normalisedScore = @event.GetScoreNormalised();

if (normalisedScore == 0)
{
Expand Down
6 changes: 5 additions & 1 deletion src/AudioAnalysisTools/Events/EventCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ public abstract class EventCommon : EventBase, IDrawableEvent
/// Up to user to determine a suitable range maximum.
/// Minimum of range assumed to be zero.
/// </summary>
public double ScoreNormalised => this.Score / this.ScoreRange.Maximum;
public double GetScoreNormalised()
{
var range = this.ScoreRange.Maximum - this.ScoreRange.Minimum;
return (this.Score / range).Clamp(0, 1);
}

/// <summary>
/// Draw this event on an image.
Expand Down
8 changes: 0 additions & 8 deletions src/AudioAnalysisTools/UnitConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ public UnitConverters(double segmentStartOffset, int sampleRate, int frameSize,
/// </summary>
public LinearScale TemporalScale { get; }

/// <summary>
/// Gets the temporal scale in second units.
/// </summary>
/// <remarks>
/// Measured in seconds per spectrogram frame.
/// </remarks>
//public LinearSecondsScale SecondsScale { get; }

/// <summary>
/// Gets the spectral scale.
/// </summary>
Expand Down

0 comments on commit 6f4eda6

Please sign in to comment.