Module:Infobox interval: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 16: | Line 16: | ||
local ratio_approx = rat.as_float(ratio) | local ratio_approx = rat.as_float(ratio) | ||
local ratio_cents = rat.cents(ratio) | local ratio_cents = rat.cents(ratio) | ||
local regular = not ratio.nan and not ratio.zero and not ratio.inf | |||
local infobox_data = {} | local infobox_data = {} | ||
| Line 28: | Line 30: | ||
rat.factorisation(ratio) | rat.factorisation(ratio) | ||
}) | }) | ||
if regular then | |||
if | |||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'[[Just intonation subgroup|Subgroup]]', | '[[Just intonation subgroup|Subgroup]]', | ||
subgroup | rat.subgroup(ratio) | ||
}) | |||
end | |||
if regular then | |||
table.insert(infobox_data, { | |||
'[[Monzo]]', | |||
ratio_ket | |||
}) | |||
table.insert(infobox_data, { | |||
'Size in [[cent]]s', | |||
i._to_cents(ratio_approx, 8) | |||
}) | }) | ||
end | end | ||
local name = frame.args['Name'] | local name = frame.args['Name'] | ||
| Line 78: | Line 81: | ||
end | end | ||
table.insert(infobox_data, { | if regular then | ||
table.insert(infobox_data, { | |||
'Norms', | |||
'[[Tenney height|log<sub>2</sub> n⋅d]]: ' .. u._round(rat.tenney_height(ratio), 6) .. '<br/>' | |||
.. '[[Weil height|max(n, d)]]: ' .. u._round(rat.weil_height(ratio), 6) .. '<br/>' | |||
.. '[[Benedetti height|n⋅d]]: ' .. u._round(rat.benedetti_height(ratio), 6) | |||
}) | |||
end | |||
if | if regular then | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
'[[Harmonic entropy]]', | '[[Harmonic entropy]]', | ||