# -*- coding: utf-8 -*- # Generated by codesnippet sphinx extension on 2016-03-08 import mdp import numpy as np np.random.seed(0) def s_distr(npoints, hole=False): """Return a 3D S-shaped surface. If hole is True, the surface has a hole in the middle.""" t = mdp.numx_rand.random(npoints) y = mdp.numx_rand.random(npoints)*5. theta = 3.*mdp.numx.pi*(t-0.5) x = mdp.numx.sin(theta) z = mdp.numx.sign(theta)*(mdp.numx.cos(theta) - 1.) if hole: indices = mdp.numx.where(((0.3>t) | (0.7y) | (4.