Skip to content

Commit

Permalink
Update EventCommon.cs
Browse files Browse the repository at this point in the history
Issue #297 Ensure that the normalised score of an event does not exceed 1.0;
  • Loading branch information
towsey committed May 7, 2020
1 parent b8880db commit bf2bd6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/AudioAnalysisTools/Events/EventCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace AudioAnalysisTools.Events
{
using System;
using Acoustics.Shared;
using AnalysisBase.ResultBases;
using AudioAnalysisTools.Events.Drawing;
Expand Down Expand Up @@ -49,7 +50,12 @@ public abstract class EventCommon : EventBase, IDrawableEvent
/// </summary>
public Interval<double> ScoreRange { get; set; }

public double ScoreNormalised => this.Score / this.ScoreRange.Maximum;
/// <summary>
/// Gets a score in the range 0,1.
/// Up to user to determine a suitable range maximum.
/// Minimum of range assumed to be zero.
/// </summary>
public double ScoreNormalised => Math.Min(1.0, this.Score / this.ScoreRange.Maximum);

/// <summary>
/// Draw this event on an image.
Expand Down

0 comments on commit bf2bd6f

Please sign in to comment.