Class EventFilters
Inherited Members
Namespace: AudioAnalysisTools.Events
Assembly: AudioAnalysisTools.dll
Syntax
public static class EventFilters
Methods
| Improve this Doc View SourceFilterEventsOnComponentCount(List<EventCommon>, Int32)
Removes composite events from a list of EventCommon that contain more than the specfied number of SpectralEvent components.
Declaration
public static List<EventCommon> FilterEventsOnComponentCount(List<EventCommon> events, int maxComponentCount)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | |
Int32 | maxComponentCount |
Returns
Type | Description |
---|---|
List<Event |
FilterEventsOnSidebandActivity(List<SpectralEvent>, BaseSonogram, Nullable<Int32>, Nullable<Int32>, Nullable<Double>, Nullable<Double>, TimeSpan)
Removes events from a list of events that contain excessive noise in the lower and/or upper neighbourhood. Excess noise can indicate that this is not a legitimate event. This method measures noise as the average decibel value in the buffer zones above and below the events.
Declaration
public static List<EventCommon> FilterEventsOnSidebandActivity(List<SpectralEvent> events, BaseSonogram spectrogram, int? lowerHertzBuffer, int? upperHertzBuffer, double? thresholdForBackgroundDecibels, double? thresholdForMaxSidebandActivity, TimeSpan segmentStartOffset)
Parameters
Type | Name | Description |
---|---|---|
List<Spectral |
events | A list of spectral events. |
Base |
spectrogram | A matrix of the spectrogram in which event occurs. |
Nullable<Int32> | lowerHertzBuffer | The band width of the required lower buffer. 100-200Hz is often appropriate. |
Nullable<Int32> | upperHertzBuffer | The band width of the required upper buffer. 300-500Hz is often appropriate. |
Nullable<Double> | thresholdForBackgroundDecibels | The max allowed value for the average decibels value (over all spectrogram cells) in an event's sideband. |
Nullable<Double> | thresholdForMaxSidebandActivity | The max allowed value for the decibels value in a sideband timeframe or freq bin. |
Time |
segmentStartOffset | Start time of the current recording segment. |
Returns
Type | Description |
---|---|
List<Event |
A list of filtered events. |
FilterEventsOnSyllableCountAndPeriodicity(List<EventCommon>, Int32, Double, Double)
Removes composite events from a list of EventCommon where the component syllables do not have the correct periodicity.
Declaration
public static List<EventCommon> FilterEventsOnSyllableCountAndPeriodicity(List<EventCommon> events, int maxSyllableCount, double expectedPeriod, double expectedSd)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | |
Int32 | maxSyllableCount | |
Double | expectedPeriod | |
Double | expectedSd |
Returns
Type | Description |
---|---|
List<Event |
FilterForEventType<T, U>(List<U>)
Declaration
public static (List<T> TargetEvents, List<U> OtherEvents) FilterForEventType<T, U>(this List<U> events)
where T : EventCommon where U : EventCommon
Parameters
Type | Name | Description |
---|---|---|
List<U> | events |
Returns
Type Parameters
Name | Description |
---|---|
T | |
U |
FilterLongEvents(List<SpectralEvent>, Double)
Filters list of events to remove long events.
Declaration
public static List<SpectralEvent> FilterLongEvents(List<SpectralEvent> events, double maximumDurationSeconds)
Parameters
Type | Name | Description |
---|---|---|
List<Spectral |
events | |
Double | maximumDurationSeconds |
Returns
Type | Description |
---|---|
List<Spectral |
FilterOnBandwidth(List<EventCommon>, Double, Double)
Declaration
public static List<EventCommon> FilterOnBandwidth(List<EventCommon> events, double minBandwidth, double maxBandwidth)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | |
Double | minBandwidth | |
Double | maxBandwidth |
Returns
Type | Description |
---|---|
List<Event |
FilterOnBandwidth(List<EventCommon>, Double, Double, Double)
Filters lists of spectral events based on their bandwidth. Note: The typical sigma threshold would be 2 to 3 sds.
Declaration
public static List<EventCommon> FilterOnBandwidth(List<EventCommon> events, double average, double sd, double sigmaThreshold)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | The list of events. |
Double | average | The expected value of the bandwidth. |
Double | sd | The standard deviation of the bandwidth. |
Double | sigmaThreshold | THe sigma value which determines the max and min thresholds. |
Returns
Type | Description |
---|---|
List<Event |
The filtered list of events. |
FilterOnDecibelDetectionThreshold(List<EventCommon>, Double)
Filters lists of events based on their DecibelDetectionThreshold.
Declaration
public static List<EventCommon> FilterOnDecibelDetectionThreshold(List<EventCommon> events, double threshold)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | The list of events. |
Double | threshold | The Decibel Detection Threshold. |
Returns
Type | Description |
---|---|
List<Event |
The filtered list of events. |
FilterOnDuration(List<EventCommon>, Double, Double)
Remove events from a list of events whose time duration is either too short or too long.
Declaration
public static List<EventCommon> FilterOnDuration(List<EventCommon> events, double minimumDurationSeconds, double maximumDurationSeconds)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | |
Double | minimumDurationSeconds | |
Double | maximumDurationSeconds |
Returns
Type | Description |
---|---|
List<Event |
FilterOnDuration(List<EventCommon>, Double, Double, Double)
Filters lists of events based on their duration. Note: The typical sigma threshold would be 2 to 3 sds.
Declaration
public static List<EventCommon> FilterOnDuration(List<EventCommon> events, double average, double sd, double sigmaThreshold)
Parameters
Type | Name | Description |
---|---|---|
List<Event |
events | The list of events. |
Double | average | The expected value of the duration. |
Double | sd | The standard deviation of the duration. |
Double | sigmaThreshold | THe sigma value which determines the max and min thresholds. |
Returns
Type | Description |
---|---|
List<Event |
The filtered list of events. |
FilterShortEvents(List<SpectralEvent>, Double)
Filters list of events to remove short events.
Declaration
public static List<SpectralEvent> FilterShortEvents(List<SpectralEvent> events, double minimumDurationSeconds)
Parameters
Type | Name | Description |
---|---|---|
List<Spectral |
events | |
Double | minimumDurationSeconds |
Returns
Type | Description |
---|---|
List<Spectral |
GetLowerEventSideband(SpectralEvent, Double[,], Double, Int32, UnitConverters)
Returns the matrix of neighbourhood values below an event.
Declaration
public static double[, ] GetLowerEventSideband(SpectralEvent ev, double[, ] spectrogramData, double bufferHertz, int gap, UnitConverters converter)
Parameters
Type | Name | Description |
---|---|---|
Spectral |
ev | The event. |
Double[,] | spectrogramData | The spectrogram data as matrix with origin top/left. |
Double | bufferHertz | THe bandwidth of the buffer zone in Hertz. |
Int32 | gap | |
Unit |
converter | A converter to convert seconds/Hertz to frames/bins. |
Returns
Type | Description |
---|---|
Double[,] | The sideband as a matrix. |
GetPeriodicity(Boolean[], Double)
Declaration
public static (int Count, double AveragePeriod, double SdPeriod) GetPeriodicity(bool[] temporalFootprint, double timeScale)
Parameters
Returns
Type | Description |
---|---|
(T1, T2, T3)<Int32, Double, Double> |
GetTemporalFootprint(EventCommon)
Declaration
public static (bool[] TemporalFootprint, double TimeScale) GetTemporalFootprint(EventCommon compositeEvent)
Parameters
Type | Name | Description |
---|---|---|
Event |
compositeEvent |
Returns
| Improve this Doc View SourceGetUpperEventSideband(SpectralEvent, Double[,], Double, Int32, UnitConverters)
Returns the matrix of neighbourhood values above an event.
Declaration
public static double[, ] GetUpperEventSideband(SpectralEvent ev, double[, ] spectrogramData, double bufferHertz, int gap, UnitConverters converter)
Parameters
Type | Name | Description |
---|---|---|
Spectral |
ev | The event. |
Double[,] | spectrogramData | The spectrogram data as matrix with origin top/left. |
Double | bufferHertz | The bandwidth of the buffer zone in Hertz. |
Int32 | gap | |
Unit |
converter | A converter to convert seconds/Hertz to frames/bins. |
Returns
Type | Description |
---|---|
Double[,] | The neighbourhood as a matrix. |
IsSidebandActivityBelowThreshold(Double[,], String, Nullable<Double>, Nullable<Double>)
This method determines the acoustic activity in a portion of a spectrogram. The passed matrix represents the sideband of an acoustic event. The sideband is subject to two tests:. Test 1: Tests whether the average or background decibel value in the sideband is below the user supplied threshold? Test 2: This test covers the possibility that there is much acoustic activity concentrated in one or two freq bins or time frames. Therefore, also require that there be at most one sideband bin or frame containing acoustic activity greater than the supplied decibel threshold.
Declaration
public static bool IsSidebandActivityBelowThreshold(double[, ] sidebandMatrix, string side, double? thresholdForBackgroundDecibels, double? thresholdForActivityDecibels)
Parameters
Type | Name | Description |
---|---|---|
Double[,] | sidebandMatrix | A matrix that represents a portion of spectrogram which is actually the sideband of an acoustic event. |
String | side | |
Nullable<Double> | thresholdForBackgroundDecibels | Decibel threshold for the background test. |
Nullable<Double> | thresholdForActivityDecibels | Decibel threshold for the activity test. |
Returns
Type | Description |
---|---|
Boolean | A boolean determining whether the sideband is accepoted or rejected. |