vak.common.files.spect.is_valid_set_of_spect_files#

vak.common.files.spect.is_valid_set_of_spect_files(spect_paths, spect_format, freqbins_key='f', timebins_key='t', spect_key='s', n_decimals_trunc=5)[source]#

validate a set of spectrogram files that will be used as a dataset. Validates that:

  • all files contain a spectrogram array that can be accessed with the specified key

  • the length of the frequency bin array in each file equals the number of rows in the spectrogram array

  • the frequency bins are the same across all files

  • the length of the time bin array in each file equals the number of columns in the spectrogram array

  • the duration of a spectrogram time bin is the same across all files

Parameters:
  • spect_paths (list) – of strings or pathlib.Path objects; paths to spectrogram files.

  • spect_format (str) – format of files containing spectrograms. One of {β€˜mat’, β€˜npz’}

  • freqbins_key (str) – key for accessing vector of frequency bins in files. Default is β€˜f’.

  • timebins_key (str) – key for accessing vector of time bins in files. Default is β€˜t’.

  • spect_key (str) – key for accessing spectrogram in files. Default is β€˜s’.

  • n_decimals_trunc (int) – number of decimal places to keep when truncating the timebin duration calculated from the vector of time bins. Default is 3, i.e. assumes milliseconds is the last significant digit.

  • logger (logging.Logger) – instance created by vak.logging.get_logger. Default is None.

Return type:

returns True if all validation checks pass. If not, an error is raised.