Module:Infobox ET: Difference between revisions
No edit summary |
No edit summary |
||
| Line 205: | Line 205: | ||
local harmonic_entropy = 0 | local harmonic_entropy = 0 | ||
local harmonic_entropy_min = 1000 | local harmonic_entropy_min = 1000 | ||
local harmonic_entropy_list = {} | |||
for i=1, math.floor(et.size)-1 do | for i=1, math.floor(et.size)-1 do | ||
he = interval_extension.harmonic_entropy_with_lookup_table(step_size * i) | he = interval_extension.harmonic_entropy_with_lookup_table(step_size * i) | ||
harmonic_entropy = harmonic_entropy + he | harmonic_entropy = harmonic_entropy + he | ||
if he <= harmonic_entropy_min then harmonic_entropy_min = he end | if he <= harmonic_entropy_min then harmonic_entropy_min = he end | ||
table.insert(harmonic_entropy_list, he) | |||
end | end | ||
table.sort(harmonic_entropy_list) | |||
harmonic_entropy = harmonic_entropy / (et.size-2) | harmonic_entropy = harmonic_entropy / (et.size-2) | ||
harmonic_entropy_median = harmonic_entropy_list[math.floor((et.size-2)/2)] | |||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"[[Harmonic entropy]]<br | "Average of [[Harmonic entropy]] <br> (from [http://www.mikebattagliamusic.com/HE-JS/HE.html HE Calc])", | ||
"~" .. utils._round(harmonic_entropy, 6) .. " nats ( | "~" .. utils._round(harmonic_entropy, 6) .. " nats" | ||
}) | |||
table.insert(infobox_data, { | |||
"Median of [[Harmonic entropy]]", | |||
"~" .. utils._round(harmonic_entropy_median, 6) .. " nats" | |||
}) | |||
table.insert(infobox_data, { | |||
"Min of [[Harmonic entropy]]", | |||
"~" .. utils._round(harmonic_entropy_min, 6) .. " nats" | |||
}) | }) | ||