In [21]:
%matplotlib inline
%load_ext autoreload
%autoreload 2
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import logging
# logging.getLogger('pygrfnn').setLevel(logging.INFO) # use/change this for development/debuging (use logging.DEBUG for debugging)
logging.getLogger('pygrfnn.resonances').setLevel(logging.INFO)
from pygrfnn import Zparam, GrFNN, Model
from pygrfnn.vis import vector_field
sr = 100
dur = 1.0
t = np.linspace(0, dur, sr*dur)
x = np.exp(2j*np.pi*3*t)
x[np.real(x)<0] = 0
plt.plot(t, np.real(x))
Out[21]:
In [22]:
zp = Zparam(-0.001, 2, -5, epsilon=0.9)
l = GrFNN(zp,
frequency_range=(0.5, 8),
num_oscs=128,
stimulus_conn_type='active',
name='Layer 1')
vector_field(zp, F=np.arange(0,1,0.1))
plt.ylim(-0.5, 1)
Out[22]:
In [23]:
from pygrfnn.network import make_connections
model = Model()
model.add_layer(l, input_channel=0)
# C = make_connections(l, l, modes=[1/2, 1, 2])
# model.connect_layers(l, # source
# l, # destination
# C, # connection matrix
# connection_type='allfreq',
# # connection_type='3freq',
# # connection_params={'N': 15, 'tol':1e-6, 'lowest_order_only': True},
# weight=0.01,
# )
In [24]:
from pygrfnn.vis import tf_detail
model.run(0.01*x, t, sr)
tf_detail(l.Z, t, l.f, t_detail=dur/2, title='TFR')
In [25]:
l.Z
Out[25]:
In [ ]: