In [1]:
# Scientific Python libraries
import numpy as np
import matplotlib.pyplot as plt
import mpld3
import seaborn as sn
mpld3.enable_notebook()
import sys
sys.path.append("../")
# Nexa in-house libraries
from signals.time_series_class import MixAr
from signals.aux_functions import sidekick
from input.sensors import PerceptualSpace, Sensor
from nexa.nexa import Nexa
# Visualization libraries
from visualization.sensor_clustering import visualize_cluster_matrix
from visualization.sensors import visualize_SLM
from visualization.sensors import visualize_STDM_seaborn
from visualization.time_cluster import visualize_time_cluster_matrix
from visualization.code_vectors import visualize_code_vectors
In [2]:
# Time parameters
dt = 0.1
Tmax = 400
w = 4 * (2.0 * np.pi / Tmax)
# Let's get the axuiliary class
t = np.arange(0, Tmax, dt)
sine = np.sin(w * t)
sine_phase = np.sin(w * t + np.pi)
# Plot the things here
%matplotlib inline
plt.plot(t, sine)
plt.hold(True)
plt.plot(t, sine_phase)
plt.show()
In [3]:
# Here we will calculate correlations
Nlags = 20000
Ntime_clusters = 2
Nembedding = 3 # Dimension of the embedding space
# We create the here perceptual space
aux_sensors = [Sensor(sine, dt), Sensor(sine_phase, dt)]
perceptual_space = PerceptualSpace(aux_sensors, Nlags)
# Now the Nexa object
nexa_object = Nexa(perceptual_space, Nlags, Nspatial_clusters,
Ntime_clusters, Nembedding)
# Calculate all the quantities
nexa_object.calculate_all()
# Build the code vectors
code_vectors = nexa_object.build_code_vectors()
In [24]:
fig = visualize_SLM(nexa_object)
plt.show(fig)
In [25]:
fig = visualize_cluster_matrix(nexa_object)
In [ ]: