Class LdSpectrogramStitching
This class used to contain only two methods: (1) StitchPartialSpectrograms() and (2) ConcatenateSpectralIndexFiles()
Now it contains several versions to concatenate Index files. This is because there are now several use cases.
Here are the original two methods:
(1) StitchPartialSpectrograms()
This method stitches together images and/or indices derived from a sequence of short recordings with gaps between them.
It was written to deal with a set of recordings with protocol of Gianna Pavan (10 minutes every 30 minutes).
The following Powershell command was constructed by Anthony to do the analysis and join the sequence of images so derived:
Y:\Italy_GianniPavan\Sassofratino1day | % {& "C:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisPrograms\bin\Release\AnalysisPrograms.exe" audio2csv -so ($_.FullName) -o "Y:\Italy_GianniPavan\output" -c "C:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisConfigFiles\Towsey.Acoustic.Parallel.yml" }
where:
Y:\Italy_GianniPavan\Sassofratino1day is the directory containing recordings
| = a pipe
% = foreach{} = perform the operation in curly brackets on each item piped from the directory.
& "C:\Work\GitHub\audio-analysis\AudioAnalysis\AnalysisPrograms\bin\Release\AnalysisPrograms.exe" = runs an executable
audio2csv = first command line argument which determines the "activity" performed
-so ($_.FullName) = the input file
-o "Y:\Italy_GianniPavan\output" = the output directory
-c "PATH\Towsey.Acoustic.Parallel.yml" is the config file
The following PowerShell command was used by Anthony to stitch together a sequence of spectrogam images without any gap between them.
It requires ImageMagick software to be installed: i.e. C:\Program Files\ImageMagick-6.8.9-Q16\montage.exe
Y:\Italy_GianniPavan\output\Towsey.Acoustic> & "C:\Program Files\ImageMagick-6.8.9-Q16\montage.exe" -mode concatenate -tile x1 *2MAP* "..\..\merge.png"
(2) ConcatenateSpectralIndexFiles()
This method was written to deal with a new recording protocol in which 24 hours of recording are made in 4 blocks of 6 hours each.
It merges all files of acoustic indices derived from a sequence of consecutive 6 hour recording, into one file. It then creates the images.
Inheritance
LdSpectrogramStitching
Assembly: AudioAnalysisTools.dll
public static class LdSpectrogramStitching
Fields
|
Improve this Doc
View Source
Declaration
public const string CsvFileExt = "csv"
Field Value
|
Improve this Doc
View Source
Declaration
public const string ImgFileExt = "png"
Field Value
|
Improve this Doc
View Source
Declaration
public const string SpectralIndicesStr = "SpectralIndices"
Field Value
|
Improve this Doc
View Source
Declaration
public const string SummaryIndicesStr = "SummaryIndices"
Field Value
Methods
|
Improve this Doc
View Source
RECENT METHOD TO CONCATENATE Spectral INDEX.CSV FILES - August 2015. Revised Septermber 2016
Was written to deal with EDDIE GAME PNG data where the files to be concatenated are all in one top level directory.
This method merges all files of spectral indices in the passed directories.
The total length of the concatenated files can exceed 24 hours - limited by memory!.
Declaration
public static Dictionary<string, double[, ]> ConcatenateAllSpectralIndexFiles(DirectoryInfo[] directories, string[] keys, IndexGenerationData indexGenerationData)
Parameters
Returns
|
Improve this Doc
View Source
Joins summary indices csv files together.
This method merges ALL the passed files of acoustic indices
It is assumed you are concatenating a sequence of consecutive short recordings.
Declaration
public static List<SummaryIndexValues> ConcatenateAllSummaryIndexFiles(FileInfo[] summaryIndexFiles, DirectoryInfo opDir, IndexGenerationData indexGenerationData, string outputFileBaseName)
Parameters
Returns
|
Improve this Doc
View Source
ONLY Use this concatenation method when you want to concatenate the files for a fixed single day.
The files to be concatenated must be somewhere in the subdirectory structure of the passed list of data directories
Read them into a dictionary
MOST RECENT METHOD TO CONCATENATE Spectral INDEX.CSV FILES - Early September 2015.
It is designed to deal with Yvonne's case where want to concatenate files distributed over arbitrary directories.
It only merges files for the passed fixed date. i.e only 24 hours.
Declaration
public static void DrawSpectralIndexFiles(Dictionary<string, double[, ]> dictionary, LdSpectrogramConfig sgConfig, IndexGenerationData indexGenerationData, FileInfo indexPropertiesConfigFileInfo, DirectoryInfo opDir, SiteDescription siteDescription, FileInfo sunriseDataFile = null, List<GapsAndJoins> segmentErrors = null)
Parameters
|
Improve this Doc
View Source
Declaration
public static void DrawSummaryIndexFiles(Dictionary<string, double[]> dictionaryOfCsvColumns, IndexGenerationData indexGenerationData, FileInfo indexPropertiesConfigFileInfo, DirectoryInfo opDir, SiteDescription siteDescription, FileInfo sunriseDatafile = null, List<GapsAndJoins> erroneousSegments = null, bool verbose = false)
Parameters
|
Improve this Doc
View Source
Declaration
public static DirectoryInfo[] GetDirectoryArrayForOneDay(SortedDictionary<DateTimeOffset, DirectoryInfo> dict, DateTimeOffset dto)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public static FileInfo[] GetFileArrayForOneDay(SortedDictionary<DateTimeOffset, FileInfo> dict, DateTimeOffset dto)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public static DirectoryInfo[] GetSubDirectoriesForSiteData(IEnumerable<DirectoryInfo> topLevelDataDirectories, string site, SearchOption searchOption)
Parameters
Returns
|
Improve this Doc
View Source
This method stitches together spectrogram images derived from consecutive shorter recordings over a 24 hour period.
Currently set for the recording protocol of Gianna Pavan (10 minutes every 30 minutes).
Call this method from Sandpit or where ever!
IMPORTANT NOTE: This method does NOT check to see if the images are in temporal order.
A SORT line should be inserted somewhere.
Declaration
public static void StitchPartialSpectrograms()