Annotations

class pypet.annotations.Annotations[source]

Simple container class for annotations.

Every tree node (leaves and group nodes) can be annotated. In case you use the standard HDF5StorageService, these annotations are stored in the attributes of the hdf5 nodes in the hdf5 file, you might wanna take a look at pytables attributes.

Annotations should be small (short strings or basic python data types) since their storage and retrieval is quite slow!

f_ann_to_str()[source]

Returns all annotations lexicographically sorted as a concatenated string.

f_empty()[source]

Removes all annotations from RAM

f_get(*args)[source]

Returns annotations

If len(args)>1, then returns a list of annotations.

f_get(X) with X integer will return the annotation with name annotation_X.

If the annotation contains only a single entry you can call f_get() without arguments. If you call f_get() and the annotation contains more than one element a ValueError is thrown.

f_is_empty()[source]

Checks if annotations are empty

f_remove(key)[source]

Removes key from annotations

f_set(*args, **kwargs)[source]

Sets annotations

Items in args are added as annotation and annotation_X where ‘X’ is the position in args for following arguments.

f_set_single(name, data)[source]

Sets a single annotation.

f_to_dict(copy=True)[source]

Returns annotations as dictionary.

Parameters:copy – Whether to return a shallow copy or the real thing (aka _dict).