anypytools.datautils.anyoutputfile_generator

anypytools.datautils.anyoutputfile_generator(folder=None, match='.*\\.(csv|txt)')[source]

Create a generator which opens AnyOutput files.

Parameters
  • folder (str, optional) – path of the directory to look for AnyOutput files. Defaults is the current working directory

  • match (str) – regular expression to match with filenames. Default is to include file ending with .csv or .txt ‘.*(.csv|.txt)’

Yields
  • data (array_like) – data collumns in the anyoutput file

  • header (list) – list of the collumn names

  • constants (dict) – mapping with constants found in the file

  • filename (str) – name of the file from which the data was read

Examples

>>> for (data, header, const, fn) in anyoutputfile_generator():
        print(fn)
        print(header)
        print(data.shape)