Module:Infobox ET: Difference between revisions

R-4981 (talk | contribs)
Undo revision 146168 by R-4981 (talk)
Tag: Undo
Undo. Uninteresting information that broke large edos
Tag: Undo
Line 5: Line 5:
local ET = require("Module:ET")
local ET = require("Module:ET")
local infobox = require("Module:Infobox")
local infobox = require("Module:Infobox")
local interval_extension = require("Module:Interval_extension")


-- check whether the input is a non-empty string
-- check whether the input is a non-empty string
Line 200: Line 199:
"Distinct consistency limit",
"Distinct consistency limit",
distinct_consistency,
distinct_consistency,
})
end
local harmonic_entropy_r = 0
local harmonic_entropy_min = 1000
local harmonic_entropy_list = {}
local l = 0
for i=1, math.floor(et.size)-1 do
he = interval_extension.harmonic_entropy_with_lookup_table(step_size * i)
harmonic_entropy_r = harmonic_entropy_r + he
if he <= harmonic_entropy_min then harmonic_entropy_min = he end
table.insert(harmonic_entropy_list, he)
l = l + 1
end
harmonic_entropy_r = harmonic_entropy_r / l
table.sort(harmonic_entropy_list)
local harmonic_entropy_median = harmonic_entropy_list[math.floor((et.size-2)/2)]
if et.size == 3 then
harmonic_entropy_median = harmonic_entropy_r
end
if et.size <= 2 then
harmonic_entropy_r = 0
harmonic_entropy_median = 0
harmonic_entropy_min = 0
end
table.insert(infobox_data, {
"Average of [[HE]] <br> (from [http://www.mikebattagliamusic.com/HE-JS/HE.html HE Calc])",
"~" .. utils._round(harmonic_entropy_r, 6) .. " nats"
})
table.insert(infobox_data, {
"Median of HE",
"~" .. utils._round(harmonic_entropy_median, 6) .. " nats"
})
table.insert(infobox_data, {
"Min of HE",
"~" .. utils._round(harmonic_entropy_min, 6) .. " nats"
})
if et.size <= 70 and et.size > 4 then
local delta_harmonic_entropy = 0
local l = 0
for i=1, math.floor(et.size)-2 do
for j=1, i-1 do
local delta = (math.pow(2, i * step_size / 1200) - math.pow(2, j * step_size / 1200)) / (math.pow(2, j * step_size / 1200) - 1)
local he = interval_extension.harmonic_entropy_with_lookup_table(rat.cents(delta))
delta_harmonic_entropy = delta_harmonic_entropy + he
l = l + 1
end
end
delta_harmonic_entropy = delta_harmonic_entropy / l
table.insert(infobox_data, {
"[[Delta-rational]] HE",
"~" .. utils._round(delta_harmonic_entropy, 6) .. " nats"
})
})
end
end