Internal soundgen function called by getSurprisal
.
getSurprisal_matrix(
x,
win,
method = c("acf", "np")[1],
sameLagAllFreqs = TRUE,
weightByAmpl = TRUE,
rescale = FALSE
)
input matrix such as a spectrogram (columns = time, rows = frequency)
length of analysis window
acf = change in maximum autocorrelation after adding the final
point, np = nonlinear prediction (see nonlinPred
- works but
is VERY slow)
(only for method = 'acf') if TRUE, the best_lag is calculated by averaging the ACFs of all channels, and the same best_lag is used to calculate the surprisal in each frequency channel (we expect the same "rhythm" for all frequencies); if FALSE, the best_lag is calculated separately for each frequency channel (we can track different "rhythms" at different frequencies)
if TRUE, ACFs and surprisal are weighted by max amplitude per frequency channel
if TRUE, surprisal is normalized from (-Inf, Inf) to [-1, 1]