mne-tools/mne-python — pull request #799 by mluessi (2013-10-09 21:07:01+00:00)
Title: FIX self-morph, vertex order

Fixes two bugs:

- Shortcut for creating self-morph matrices had a bug and wasn't covered by a test
- In some cases, morphing also caused the vertex indices in `SourceEstimate` to be un-ordered. This leads to problems because we often use e.g. `np.searchsorted` which assumes that the arrays are sorted. To fix it, I modified the morph code so the vertex indices are ordered. I also changed `read_source_estimate` so the vertex indices are re-ordered when reading `.stc` files that have a strange vertex order (e.g. those produced by `mne_make_movie`)

To prevent the second problem in the future, I added checks to `SourceEstimate` and `Label` to make sure the vertex indices are ordered.

Note: There is some strange bug in the morph code that causes the values to be different at exactly 2 vertices.. I spent a long time trying to figure out where it comes from but ran out of time (for now). Bug bounty: 1 beer from me.