iodata.api module

Functions to be used by end users.

dump_many(iodatas, filename, fmt=None, **kwargs)[source]

Write multiple IOData instances to a file.

This routine uses the extension or prefix of the filename to determine the file format. For each file format, a specialized function is called that does the real work.

Parameters
  • iodatas (Iterator[IOData]) – An iterator over IOData instances.

  • filename (str) – The file to write the data to.

  • fmt (Optional[str]) – The name of the file format module to use.

  • **kwargs – Keyword arguments are passed on to the format-specific dump_many function.

dump_one(iodata, filename, fmt=None, **kwargs)[source]

Write data to a file.

This routine uses the extension or prefix of the filename to determine the file format. For each file format, a specialized function is called that does the real work.

Parameters
  • iodata (IOData) – The object containing the data to be written.

  • filename (str) – The file to write the data to.

  • fmt (Optional[str]) – The name of the file format module to use. When not given, it is guessed from the filename.

  • **kwargs – Keyword arguments are passed on to the format-specific dump_one function.

load_many(filename, fmt=None, **kwargs)[source]

Load multiple IOData instances from a file.

This function uses the extension or prefix of the filename to determine the file format. When the file format is detected, a specialized load function is called for the heavy lifting.

Parameters
  • filename (str) – The file to load data from.

  • fmt (Optional[str]) – The name of the file format module to use. When not given, it is guessed from the filename.

  • **kwargs – Keyword arguments are passed on to the format-specific load_many function.

Yields

out – An instance of IOData with data for one frame loaded for the file.

Return type

Iterator[IOData]

load_one(filename, fmt=None, **kwargs)[source]

Load data from a file.

This function uses the extension or prefix of the filename to determine the file format. When the file format is detected, a specialized load function is called for the heavy lifting.

Parameters
  • filename (str) – The file to load data from.

  • fmt (Optional[str]) – The name of the file format module to use. When not given, it is guessed from the filename.

  • **kwargs – Keyword arguments are passed on to the format-specific load_one function.

Returns

The instance of IOData with data loaded from the input files.

Return type

out