lisa-lab/pylearn2 — pull request #1173 by SuperElectric (2014-10-09 16:48:21+00:00)
Title: bugfix in new_norb.py, browse_norb.py can now show monocular NORB

This is a replacement for https://github.com/lisa-lab/pylearn2/pull/1091, with a clean git history.

Fixed a bug in NORB that was only visible when the NORB object was given memmaps instantiated with mode='w+' as its .X or .y fields.

When pickling NORB files, its getstate would replace .X and .y with argument lists for instantiating the memmap files, used to load the memmaps when unpickling. The bug was that these argument lists contained mode='w+' if the memmap was originally created with mode='w+'. When unpickling, this mode was used, causing the memmap to be overwritten. This bug is now fixed (repaced 'w+' with 'r+').

Also, there was a risk that, after pickling a NORB object, a user could still edit its memmaps, causing changes to the "saved" data. To prevent this, when a NORB is pickled, it now automatically switches its memmaps to be read-only. The user must now explicitly switch the memmaps back to read-write if they want to.