In [1]:
import numpy as np
import matplotlib.pyplot as plt
import twpca
from twpca import TWPCA
%matplotlib inline

%load_ext autoreload
%autoreload 2

check identity warp does not change data appreciably


In [2]:
_, _, data = twpca.datasets.jittered_neuron()
model = TWPCA(data, n_components=1, warpinit='identity')

In [3]:
np.all(np.isclose(model.params['warp'], np.arange(model.shared_length), atol=1e-5, rtol=2))


Out[3]:
True

In [4]:
np.nanmax(np.abs(model.transform() - data)) < 1e-5


Out[4]:
True

check that shift initialization for warp solves the simple toy problem


In [5]:
model = TWPCA(data, n_components=1, warpinit='shift')

In [6]:
plt.imshow(np.squeeze(model.transform()))


Out[6]:
<matplotlib.image.AxesImage at 0x1209ebb70>