def load_and_normalize(filename): """ Load curve from file, center on mean, scale such that height is unity. """ x, y = _load_raw_data(DATA_FOLDER + filename, 'c0') c0 = sample_discrete_curve(x, y) c0.translate(-c0[0, :]) w, h = c0.dimensions() c0.scale(1/h) c0.translate(-c0.mean()) return c0
def sample_from_curve(c0): "Uniformize number of sample points." c1 = sample_discrete_curve(c0.points[:, 0], c0.points[:, 1], N=100) return c1