Commit ae2c0e91 authored by alessio.quaresima's avatar alessio.quaresima
Browse files

cleanup

parent eda8bc7f
......@@ -15,7 +15,7 @@ pyimport("importlib")."reload"(TIMIT)
path = "/home/cocconat/Documents/Research/phd_project/speech/litwin-kumar_model_thesis/Spike TIMIT"
dataset = TIMIT.create_dataset(joinpath(path,"train"))
spkrinfo, spkrsent = TIMIT_loader.create_spkrdata(path)
spkrinfo, spkrsent = TIMIT.create_spkrdata(path)
# dataset |> Pandas.DataFrame |> DataFrames.DataFrame
......@@ -48,16 +48,38 @@ words = TIMIT.get_spectra(speaker |> Pandas.DataFrame, target_words=["that"])
##
words[1].phones[1].db
##
using StatsBase
function py2j_words(words)
jwords = []
for word in words
phs = []
for ph in word.phones
push!(phs,SpikeTimit.Phone(ph.ph, ph.t0, ph.t1, Array{Float64}(ph.db), Matrix{Float64}(ph.osc)))
push!(phs,SpikeTimit.Phone(ph.ph, ph.t0, ph.t1, Array{Float64}(ph.osc), Matrix{Float64}(ph.db)))
end
push!(jwords,SpikeTimit.Word(word.word, phs, word.duration, word.t0, word.t1))
end
return jwords
end
py2j_words(words)
words =py2j_words(words)
function rate_coding_word(word::SpikeTimit.Word)
times = []
encoding = Matrix{Float64}(undef, 20, length(word.phones))
for (n,ph) in enumerate(word.phones)
encoding[:,n] = mean(ph.db, dims=2)[:,1]
push!(times, ph.t0 - word.t0)
end
return times, encoding
end
using Plots
times, phs = rate_coding_word(words[1])
a = heatmap(words[1].phones[1].db)
b = heatmap(words[1].phones[2].db)
c = heatmap(words[1].phones[3].db)
words[1].word
Plots.plot(a,b,c, layout=(1,3), colorbar=false, axes=nothing, ticks=nothing)
times, phs = rate_coding_word(words[9])
heatmap(phs)
words[1].phones[1].ph
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment