In [15]:
# Import here
%matplotlib inline
import matplotlib.pylab as pylab
import matplotlib.pyplot as plt
import numpy as np
import theano
import theano.tensor as T
pylab.rcParams['figure.figsize'] = (9.0, 6.0)
In [16]:
dim_unit = 64
basis = np.zeros((dim_unit, dim_unit), dtype=np.float32)
phase = 2 * np.pi * np.arange(dim_unit, dtype=np.float32) / dim_unit
for i in range(dim_unit):
f = (i + 1) / 2
shift = i % 2
basis[i, :] = np.sin(f * phase + shift * np.pi / 2)
basis[0, :] = 1
basis /= np.sqrt(np.sum(basis ** 2, axis=1, keepdims=True))
In [17]:
plt.imshow(basis, interpolation='None')
Out[17]:
In [18]:
plt.plot(basis[33, :])
Out[18]:
In [19]:
np.save('/Users/chayut/Dropbox/data/grid_cells/fourier_discrete_basis_1d_64.npy', basis)
In [ ]: