skedm example data


In [1]:
import sys
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('ticks')
sns.set_context(context='notebook',font_scale=1.3)
%matplotlib inline

In [2]:
%load_ext autoreload
%autoreload 2

In [3]:
# alter the line below to correspond to your file system
f = '../'
sys.path.append(f)

In [4]:
import skedm as edm
import skedm.data as data

1D Example Data

Logistic Map


In [5]:
x = data.logistic_map(sz=256, A=3.99, noise=.01, seed=36)
plt.plot(x);


Periodic


In [6]:
x = data.noisy_periodic(sz=256, freq=52, noise=0.5, seed=36)
plt.plot(x)


Out[6]:
[<matplotlib.lines.Line2D at 0x116c7ce80>]

Noise


In [7]:
x = data.noise_1d(sz=256, seed=36)
plt.plot(x)


Out[7]:
[<matplotlib.lines.Line2D at 0x116db90f0>]

Lorenz equations


In [8]:
X = data.lorenz(sz=10000, max_t=100.0, noise=0, parameters=(10.0, 2.6666666,28.0))

fig,ax = plt.subplots(nrows=3,sharex=True,figsize=(10,4))
ax[0].plot(X[:,0])
ax[1].plot(X[:,1])
ax[2].plot(X[:,2])


Out[8]:
[<matplotlib.lines.Line2D at 0x116f52c88>]

2d Example Data

2d Logistic Map diffused in space


In [9]:
x = data.chaos_2d(sz=128, A=3.99, eps=1.0, noise=.1, seed=36)
plt.imshow(x, cmap='magma')
plt.colorbar()


Out[9]:
<matplotlib.colorbar.Colorbar at 0x117218208>

2d horizontal sine wave added to a 2d vertial cosine wave


In [10]:
x = data.periodic_2d(sz=128, freq=36, noise=0.5, seed=36)
plt.imshow(x, cmap='magma')
plt.colorbar()


Out[10]:
<matplotlib.colorbar.Colorbar at 0x1174d6978>

2d Brown noise

Takes roughly 1.5 minute to generate on a macbook air


In [11]:
x = data.brown_noise(sz=128, num_walks=500, walk_sz=100000, spread=1000, seed=3)
plt.imshow(x, cmap='magma')
plt.colorbar()


Out[11]:
<matplotlib.colorbar.Colorbar at 0x116ba9f28>

Periodic Brown

Takes roughly 1.5 minutes to generate on a macbook air


In [12]:
x = data.periodic_brown(sz=128, freq=36, seed=15)
plt.imshow(x, cmap='magma')
plt.colorbar()


Out[12]:
<matplotlib.colorbar.Colorbar at 0x11d747da0>

2d Noise


In [13]:
x = data.noise_2d(sz=128, seed=36)
plt.imshow(x, cmap='magma')
plt.colorbar()


Out[13]:
<matplotlib.colorbar.Colorbar at 0x11db1e438>

Overlapping Circles


In [14]:
x = data.overlapping_circles(sz=256, rad=20.0, sigma=1, num_circles=1000)
plt.imshow(x, cmap='magma')
plt.colorbar()


Out[14]:
<matplotlib.colorbar.Colorbar at 0x11dced470>

Concentric Circles


In [15]:
x = data.concentric_circles([2, 5, 10])
plt.imshow(x, cmap='jet')
plt.colorbar()


Circles Generated: 97
Out[15]:
<matplotlib.colorbar.Colorbar at 0x11df78cf8>

In [16]:
np.unique(x)


Out[16]:
array([ 0.,  1.,  2.,  3.])

Two different sized circles


In [17]:
x = data.small_and_large_circles()
plt.imshow(x, cmap='jet')
plt.colorbar()


Number of circles: 82
Out[17]:
<matplotlib.colorbar.Colorbar at 0x10812c2b0>

In [18]:
np.unique(x)


Out[18]:
array([ 0.,  1.,  2.])

Randomly sized circles


In [19]:
x = data.random_sized_circles([4,5,6], [5,7,8], sz=512, num_circs=3000)
plt.imshow(x, cmap='jet')
plt.colorbar()


1113
Out[19]:
<matplotlib.colorbar.Colorbar at 0x11e81b668>

In [20]:
np.unique(x)


Out[20]:
array([ 0.,  5.,  7.,  8.])

Voronoi Matrix


In [21]:
x = data.voronoi_matrix(sz=512, percent=0.01, num_classes=27)
plt.imshow(x, cmap='jet')
plt.colorbar()


Out[21]:
<matplotlib.colorbar.Colorbar at 0x11f0e82b0>

In [22]:
np.unique(x)


Out[22]:
array([  0.,   1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.,
        11.,  12.,  13.,  14.,  15.,  16.,  17.,  18.,  19.,  20.,  21.,
        22.,  23.,  24.,  25.,  26.])

3d chaos


In [23]:
x = data.chaos_3d(sz=128, A=3.99, eps=1.0, steps=100, tstart=50)

In [24]:
x.shape


Out[24]:
(128, 128, 100)

In [25]:
fig,axes = plt.subplots(3,3,figsize=(10,10))

for i, ax in enumerate(axes.ravel()):
    ax.imshow(x[:,:,i*10], cmap='magma')
    ax.set_title(i*10)



In [ ]:


In [ ]: