In [76]:
import imp
import numpy as np
import matplotlib.pyplot as plt
from jedi import jedi
from jedi.utils import plot, seedutil, func_generator, init_tools
import cPickle
import random

%config InlineBackend.figure_format = 'retina'
%matplotlib inline

In [83]:
np.random.randint(0,1e9)


Out[83]:
528455150

In [143]:
ds = cPickle.load(open("../../data/stability/romo/base/base.p", "rb"))

In [144]:
ds.keys()


Out[144]:
[93945, 38570, 59947, 'parameters']

In [145]:
ds['parameters'].keys()


Out[145]:
['trial_num',
 'rho',
 'trials',
 'N',
 'sparsity',
 'start_validate',
 'lr',
 'tstart',
 'pE',
 'dt']

In [146]:
seed = 93945

In [147]:
t = np.linspace(0,10,1002)
errors = ds[seed]['force'][0]
derrors = ds[seed]['dforce'][0]
zs = ds[seed]['force'][1]
dzs = ds[seed]['dforce'][1]
params = ds['parameters']

In [148]:
for error in errors[7:]:
    t = np.arange(len(error))
    plt.plot(t, np.abs(error))



In [153]:
for trial, z in zip(params['trials'], zs)[:7]:
    t = np.arange(len(z))
    plt.plot(t, z)
    plt.plot(t, trial['outputs'][:,1])



In [150]:
for error in derrors[7:]:
    t = np.arange(len(error))
    plt.plot(t, np.abs(error))



In [151]:
for trial, z in zip(params['trials'], dzs)[7:]:
    t = np.arange(len(z))
    plt.plot(t, z)
    plt.plot(t, trial['outputs'][:,1])



In [40]:
plt.figure(figsize=(12,3))
plot.cross_signal_error(errors, derrors, t, tstart, tstop, 
                        title="FORCE vs DFORCE (Sin Wave)", burn_in=10)



In [35]:
t = np.linspace(0,10,1002)
errors = dff['force'][0]
derrors = dff['dforce'][0]
params = dff['parameters']

tstart, tstop = params['tstart'], params['tstop']

In [36]:
plt.figure(figsize=(12,3))
plot.cross_signal_error(errors, derrors, t, tstart, tstop, 
                        title="FORCE vs DFORCE (Flipflop)", burn_in=10)



In [ ]: