Module:MOS modes: Difference between revisions

Sintel (talk | contribs)
really now, how many mos modules are there
Ganaram inukshuk (talk | contribs)
Brought back standard udp formatting of up|dp(p)
Line 59: Line 59:


-- Test function that produces the modes of a mos as a table
-- Test function that produces the modes of a mos as a table
-- TODO:
-- - Expand this (possibly as a separate template) for mos intervals
function p.modes_table(frame)
function p.modes_table(frame)
-- Mos is entered as a scale signature "xL ys" or "xL ys<p/q>" since the mos module can parse that format
-- Mos is entered as a scale signature "xL ys" or "xL ys<p/q>" since the mos module can parse that format
Line 125: Line 123:
result = result .. "|-\n"
result = result .. "|-\n"
-- Add the UDP, formatted as up|dp, where u is the number of bright generators going up,
-- Add the UDP, formatted as up|dp(p), where u is the number of bright generators going up,
-- d is the number of bright generators going down, and p is the number of periods
-- d is the number of bright generators going down, and p is the number of periods
-- (slightly different from standard UDP notation of up|dp(p))
-- Omit p if p = 1
local gens_down = (i - 1) * periods
local gens_down = (i - 1) * periods
local gens_up = (#mos_modes - i) * periods
local gens_up = (#mos_modes - i) * periods
result = result .. "|" .. gens_up .. '&#124;' .. gens_down .. "\n"
local udp_as_text = ""
if periods == 1 then
udp_as_text = gens_up .. '&#124;' .. gens_down
else
udp_as_text = string.format("%d|%d(%d)", gens_up, gens_down, periods)
end
result = result .. "|" .. udp_as_text .. "\n"
-- Add the mode's step pattern
-- Add the mode's step pattern
result = result .. "|" .. mos_modes[i] .. "\n"
result = result .. "|" .. mos_modes[i] .. "\n"