aspecd.infofile module

Handle infofile files containing meta data for (experimental) data.

The infofile format is a special format dedicated to storing meta data accompanying experimental data. Further information can be found online:

https://www.till-biskup.de/en/software/info/format

This module reads and parses files complying with the infofile file format.

Note

For own purposes, you may prefer using YAML files to store metadata that are collected in parallel to recording data over the infofile format. For more information on this format and it specification, consult its webpage: http://yaml.org/.

As the lead developer of the ASpecD framework originally invented the infofile format for own purposes, there are quite some datasets floating around in his lab using this format for the corresponding metadata. Hence the need of a module handling this particular file type.

To map the information contained in the info file to datasets, have a look at the aspecd.metadata.MetadataMapper class. You can define rather elaborate mapping tables, allowing to rename keys as well as to combine items of a dictionary.

exception aspecd.infofile.Error

Bases: Exception

Base class for exceptions in this module.

exception aspecd.infofile.InfofileTypeError(message='')

Bases: aspecd.infofile.Error

Exception raised for wrong file format.

message

explanation of the error

Type

str

exception aspecd.infofile.InfofileEmptyError(message='')

Bases: aspecd.infofile.Error

Exception raised for empty file.

message

explanation of the error

Type

str

class aspecd.infofile.Infofile(filename=None)

Bases: object

Reading metadata contained in info files.

parameters

Structure containing parameters read from info file.

Type

collections.OrderedDict

filename

Name of the info file read

Type

str

infofile_info

Information about the infofile, such as kind, version, and date.

Helpful for mapping metadata contained in an infofile to datasets.

Type

dict

Parameters

filename (str) – Name of the info file to read

Raises
parse()

Parse info file.

Raises
aspecd.infofile.parse(filename='')

Parse info file.

Conventional interface provided for convenience that gives easy access to the metadata stored in an infofile. For full use of the capabilities of the Infofile class, use its object-oriented interface.

Warning

This will only return the metadata read from the info file, not the version information that is read and parsed as well. To obtain this version information, e.g., for mapping of metadata onto other structures, you should use the object-oriented interface of the Infofile class.

Parameters

filename (str) – Name of the info file to parse

Returns

metadata – Dictionary with metadata read from info file

Return type

dict