You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
2 years ago
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import numpy as np
|
||
|
import pandas as pd
|
||
|
|
||
|
import sys
|
||
|
sys.path.insert(0, './Modules')
|
||
|
|
||
|
from gratings import grating_model
|
||
|
from plotting import plot_data, plot_mean_against_index, show_feature
|
||
|
from persistence import persistence
|
||
|
from decoding import cohomological_parameterization, remove_feature
|
||
|
from noisereduction import PCA_reduction, z_cutoff
|
||
|
|
||
|
|
||
|
|
||
|
## Generate data
|
||
|
data = grating_model(Nn=8, Np=(18,1,18,1), deltaT=55, random_neurons=True)
|
||
|
|
||
|
## Apply noise reduction
|
||
|
# data = PCA_reduction(data, 5)
|
||
|
# data = z_cutoff(data,2)
|
||
|
|
||
|
## Analyze shape
|
||
|
persistence(data,homdim=2,coeff=2)
|
||
|
persistence(data,homdim=2,coeff=3)
|
||
|
|
||
|
## Decode first parameter
|
||
|
decoding1 = cohomological_parameterization(data, coeff=23)
|
||
|
show_feature(decoding1)
|
||
|
plot_mean_against_index(data,decoding1,"orientation")
|
||
|
plot_mean_against_index(data,decoding1,"phase")
|
||
|
# plot_data(data,transformation="PCA", labels=decoding1,
|
||
|
# colors=["Twilight","Viridis","Twilight","Viridis","Twilight"])
|
||
|
|
||
|
## Decode second parameter
|
||
|
# reduced_data = remove_feature(data, decoding1, cut_amplitude=0.5)
|
||
|
# decoding2 = cohomological_parameterization(reduced_data, coeff=23)
|
||
|
# show_feature(decoding2)
|
||
|
# plot_mean_against_index(data,decoding2,"orientation")
|
||
|
# plot_mean_against_index(data,decoding2,"phase")
|
||
|
# plot_data(data,transformation="PCA", labels=decoding2,
|
||
|
# colors=["Twilight","Viridis","Twilight","Viridis","Twilight"])
|