ENH: Add interpolation code and example

cc / FYI @agramfort @wmvanvliet @MadsJensen @t3on @christianbrodbeck 
yeah yeah got that

2014-12-12 20:50 GMT+01:00 Eric Larson <notifications@github.com>:
>
> In mne/preprocessing/maxfilter.py
> <https://github.com/mne-tools/mne-python/pull/1696#discussion-diff-21768655>
> :
>
> > +    radius_init = (xradius + yradius) / 2
> > +    center_init = np.array([0.0, 0.0, np.max(points[:, 2]) - radius_init])
> > +
> > +    # optimization
> > +    x0 = np.r_[center_init, radius_init]
> > +
> > +    def cost_fun(x, points):
> > +        return np.sum((np.sqrt(np.sum((points - x[:3]) ** 2, axis=1)) -
> > +                      x[3]) ** 2)
> > +
> > +    x_opt = optimize.fmin_powell(cost_fun, x0, args=(points,),
> > +                                 disp=True)
> > +
> > +    origin_head = x_opt[:3]
> > +    radius = x_opt[3]
> > +    return radius, origin_head
>
> ...in other words, this function seems to have nothing having to do with a
> head in it currently, so it should probably be renamed, and it would be
> more convenient import-wise to have it be in mne.channels somewhere. The
> headshape-fitting function that uses this should probably also be moved
> over there, since it's more a property of the channels / info than being
> maxfilter-specific.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mne-tools/mne-python/pull/1696/files#r21768655>.
>