In [1]:
import numpy as np
import matplotlib.pyplot as plt
import twpca
from twpca import TWPCA
%matplotlib inline
%load_ext autoreload
%autoreload 2
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]:
In [4]:
np.nanmax(np.abs(model.transform() - data)) < 1e-5
Out[4]:
In [5]:
model = TWPCA(data, n_components=1, warpinit='shift')
In [6]:
plt.imshow(np.squeeze(model.transform()))
Out[6]: