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.