Class GapsAndJoins
Inherited Members
Namespace: AudioAnalysisTools.Indices
Assembly: AudioAnalysisTools.dll
Syntax
public class GapsAndJoins
Fields
| Improve this Doc View SourceErroneousIndexSegmentsFilenameFragment
Declaration
public const string ErroneousIndexSegmentsFilenameFragment = "WARNING-IndexGapsAndJoins"
Field Value
Type | Description |
---|---|
String |
GapDescriptionFileJoin
Declaration
public static string GapDescriptionFileJoin
Field Value
Type | Description |
---|---|
String |
KeyFileJoin
Declaration
public const string KeyFileJoin = "FileJoin"
Field Value
Type | Description |
---|---|
String |
KeyRecordingExists
Declaration
public const string KeyRecordingExists = "RecordingExists"
Field Value
Type | Description |
---|---|
String |
KeyZeroSignal
Declaration
public const string KeyZeroSignal = "ZeroSignal"
Field Value
Type | Description |
---|---|
String |
Properties
| Improve this Doc View SourceEndPosition
Declaration
public int EndPosition { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
GapDescription
Declaration
public string GapDescription { get; set; }
Property Value
Type | Description |
---|---|
String |
GapRendering
Gets or sets the gap rendering mode.
Declaration
public ConcatMode GapRendering { get; set; }
Property Value
Type | Description |
---|---|
ConcatMode |
StartPosition
Declaration
public int StartPosition { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceDataIntegrityCheck(Dictionary<String, Double[,]>, ConcatMode)
Does three data integrity checks.
Declaration
public static List<GapsAndJoins> DataIntegrityCheck(Dictionary<string, double[, ]> spectralIndices, ConcatMode gapRendering)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<String, Double[,]> | spectralIndices | a dictionary of spectral indices. |
ConcatMode | gapRendering | how to render the gap in image terms. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DataIntegrityCheck(IEnumerable<SummaryIndexValues>, ConcatMode)
Does several data integrity checks.
Declaration
public static List<GapsAndJoins> DataIntegrityCheck(IEnumerable<SummaryIndexValues> summaryIndices, ConcatMode gapRendering)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SummaryIndexValues> | summaryIndices | a dictionary of summary indices. |
ConcatMode | gapRendering | describes how recording gaps are to be rendered. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DataIntegrityCheckForFileJoins(IEnumerable<SummaryIndexValues>, ConcatMode)
This method reads through a SUMMARY index array to check for file joins.
Declaration
public static List<GapsAndJoins> DataIntegrityCheckForFileJoins(IEnumerable<SummaryIndexValues> summaryIndices, ConcatMode gapRendering)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SummaryIndexValues> | summaryIndices | array of summary indices. |
ConcatMode | gapRendering | how to render the gap in image terms. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DataIntegrityCheckForZeroSignal(IEnumerable<SummaryIndexValues>)
This method reads through a ZeroIndex SUMMARY array. It reads the ZeroSignal array to make sure there was actually a signal to analyse. If this occurs an error is flagged. TODO: should do a unit test. Argument should be an a array of zeros with two insertions of short runs of ones. // One of the runs should terminate the array. e.g. 000000000000000000000000000000001111110000000000000000000000001111111111111.
Declaration
public static List<GapsAndJoins> DataIntegrityCheckForZeroSignal(IEnumerable<SummaryIndexValues> summaryIndices)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SummaryIndexValues> | summaryIndices | array of summary indices. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DataIntegrityCheckIndexValues(Dictionary<String, Double[]>)
This method reads through three SUMMARY index arrays to check for signs that something might be wrong with the data. It reads through the ACI, Temporal Entropy and SNR summary index arrays to check that they have positive values. These should never be LTE zero. If any of these events occurs, an error is flagged. The tests done here are not particularly realistic and the chosen errors are possible unlikely to occur. TODO Other data integrity tests can be inserted in the future.
Declaration
public static List<GapsAndJoins> DataIntegrityCheckIndexValues(Dictionary<string, double[]> summaryIndices)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<String, Double[]> | summaryIndices | Dictionary of the currently calculated summary indices. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DataIntegrityCheckRecordingGaps(IEnumerable<SummaryIndexValues>, ConcatMode)
This method reads through a SUMMARY index array looking for gaps in the recording. I initilly tried to detect these when the RankOrder index takes consecutive zero values. However this does not work with recordings sampled one minute in N minutes. So reverted to detecting the mising data flag which is when row.FileName == missingRow. If this occurs a gap event is flagged.
Declaration
public static List<GapsAndJoins> DataIntegrityCheckRecordingGaps(IEnumerable<SummaryIndexValues> summaryIndices, ConcatMode gapRendering)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SummaryIndexValues> | summaryIndices | array of summary indices. |
ConcatMode | gapRendering | how to render the gap in image terms. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DataIntegrityCheckSpectralIndices(Dictionary<String, Double[,]>, ConcatMode)
This method reads through SPECTRAL index matrices to check for signs that something might be wrong with the data. Currently, it reads through the ACI matrix to check where the spectral row sums are close to zero. These should never be LTE zero. This test is not particularly realistic but might occur. Other tests can be inserted in the future.
Declaration
public static List<GapsAndJoins> DataIntegrityCheckSpectralIndices(Dictionary<string, double[, ]> spectralIndices, ConcatMode gapRendering)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<String, Double[,]> | spectralIndices | Dictionary of the currently calculated spectral indices. |
ConcatMode | gapRendering | how to render the gap in image terms. |
Returns
Type | Description |
---|---|
List<GapsAndJoins> | a list of erroneous segments. |
DrawEchoPatch(Image<Rgb24>, GapsAndJoins)
Draws an echo patch into a spectrogram image.
Declaration
public static Image<Rgb24> DrawEchoPatch(Image<Rgb24> source, GapsAndJoins error)
Parameters
Type | Name | Description |
---|---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> | source | |
GapsAndJoins | error |
Returns
Type | Description |
---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
DrawErrorPatch(Int32, Boolean)
Draws a error patch based on properties of the error type. Depends on how gap rendering is to be done.
Declaration
public Image<Rgb24> DrawErrorPatch(int height, bool textInVerticalOrientation)
Parameters
Type | Name | Description |
---|---|---|
Int32 | height | height in pixels of the error patch. |
Boolean | textInVerticalOrientation | orientation of error text should match orientation of the patch. |
Returns
Type | Description |
---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
DrawErrorSegments(Image<Rgb24>, List<GapsAndJoins>, Boolean)
This method draws error segments on false-colour spectrograms and/or summary index plots. This method draws the error segments in hierarchical order, highest level errors first. This way error due to missing recording is drawn last and overwrites other casading errors due to missing recording.
Declaration
public static Image<Rgb24> DrawErrorSegments(Image<Rgb24> bmp, List<GapsAndJoins> list, bool drawFileJoins)
Parameters
Type | Name | Description |
---|---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> | bmp | The chromeless spectrogram to have segments drawn on it. |
List<GapsAndJoins> | list | list of erroneous segments. |
Boolean | drawFileJoins | drawing file joins is optional. |
Returns
Type | Description |
---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> | spectrogram with erroneous segments marked. |
DrawFileJoins(Image<Rgb24>, List<GapsAndJoins>)
Declaration
public static Image<Rgb24> DrawFileJoins(Image<Rgb24> bmp, List<GapsAndJoins> errorList)
Parameters
Type | Name | Description |
---|---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> | bmp | |
List<GapsAndJoins> | errorList |
Returns
Type | Description |
---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
DrawGapPatches(Image<Rgb24>, List<GapsAndJoins>, String, Int32, Boolean)
Declaration
public static Image<Rgb24> DrawGapPatches(Image<Rgb24> bmp, List<GapsAndJoins> errorList, string errorDescription, int height, bool textInVerticalOrientation)
Parameters
Type | Name | Description |
---|---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> | bmp | |
List<GapsAndJoins> | errorList | |
String | errorDescription | |
Int32 | height | |
Boolean | textInVerticalOrientation |
Returns
Type | Description |
---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
RemoveGapPatch(Image<Rgb24>, GapsAndJoins)
Cuts out gap portion of a spectrogram image.
Declaration
public static Image<Rgb24> RemoveGapPatch(Image<Rgb24> source, GapsAndJoins error)
Parameters
Type | Name | Description |
---|---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> | source | |
GapsAndJoins | error |
Returns
Type | Description |
---|---|
SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgb24> |
WriteErrorsToFile(List<GapsAndJoins>, DirectoryInfo, String)
Writes a list of erroneous segment properties to file.
Declaration
public static void WriteErrorsToFile(List<GapsAndJoins> errors, DirectoryInfo outputDirectory, string fileStem)
Parameters
Type | Name | Description |
---|---|---|
List<GapsAndJoins> | errors | list of erroneous segments. |
DirectoryInfo | outputDirectory | directory in which json file to be written. |
String | fileStem | name of json file. |