Table Of Contents

Previous topic

mvpa.misc.io.eepbin

Next topic

mvpa.misc.io.meg

This Page

Quick search

mvpa.misc.io.hamster

Helper for simple storage facility via cPickle and zlib

The comprehensive API documentation for this module, including all technical details, is available in the Epydoc-generated API reference for mvpa.misc.io.hamster (for developers).

Hamster

class mvpa.misc.io.hamster.Hamster(*args, **kwargs)

Bases: dict

Simple container class which is derived from the dictionary

It is capable of storing itself in a file, or loading from a file (using cPickle + zlib tandem). Any serializable object can be bound to a hamster to be stored.

To undig burried hamster use Hamster(filename). Here is an example:

>>> h = Hamster(bla='blai')
>>> h.boo = N.arange(5)
>>> h.dump(filename)
...
>>> h = Hamster(filename)

Initialize Hamster.

Providing a single parameter string would treat it as a filename from which to undig the data. Otherwise all the parameters are equivalent to the ones of dict

dump(filename)
Bury the hamster into the file

See also

Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the Hamster documentation.

Full API documentation of Hamster in module mvpa.misc.io.hamster.