ocmw.core.fileTools module

Basic file manipulation tools used in the OCMW processes.

getListOfFiles

Get a list of file from a directory based on a search string.

loadmat

This function should be called instead of direct scipy.io.loadmat as it cures the problem of not properly recovering python dictionaries from mat files.

generateGlobalAttributes

Generate a generic global attributes dictionary for adding meta data to a data dictionary.

Basic file manipulation tools used in the OCMW processes.

ocmw.core.fileTools.getListOfFiles(filePath, searchStr='')[source]

Get a list of file from a directory based on a search string.

Parameters:
  • filePath (str) – path string to directory to be searched for files.

  • searchStr (str) – sub-string fragment that can be used to identify a file or set of files.

Returns:

files (list, str) – a list of the file names containing the search string.

ocmw.core.fileTools.loadmat(filename)[source]

This function should be called instead of direct scipy.io.loadmat as it cures the problem of not properly recovering python dictionaries from mat files. It calls the function check keys to cure all entries which are still mat-objects.

ocmw.core.fileTools.print_mat_nested(d, indent=0)[source]

Pretty print nested structures from .mat files

ocmw.core.fileTools.generateGlobalAttributes(titleStr)[source]

Generate a generic global attributes dictionary for adding meta data to a data dictionary.

Parameters:

titleStr (str) – a string defining the data set being attributed.

Returns:

globalAttr (dict) – a dictionary containing generic data about the dataset creation.