Module:JI ratios: Difference between revisions

Ganaram inukshuk (talk | contribs)
Add in tenney height and complement filtering
Ganaram inukshuk (talk | contribs)
m bugfix tenney height filtering
Line 93: Line 93:
end
end


-- Remove ratios that exceed the Tenney height. This is skipped if the Tenney
-- Remove ratios that exceed the Tenney height. This does nothing if the Tenney
-- height is infinity.
-- height is infinity.
function p.filter_ratios_by_tenney_height(ratios, equave, fine_search_args)
function p.filter_ratios_by_tenney_height(ratios, equave, fine_search_args)
if not fine_search_args["Tenney Height"] == 1/0 then
local filtered_ratios = {}
local filtered_ratios = {}
for i = 1, #ratios do
for i = 1, #ratios do
if rat.tenney_height(ratios[i]) <= fine_search_args["Tenney Height"] then
if rat.tenney_height(ratios[i]) <= fine_search_args["Tenney Height"] then
table.insert(filtered_ratios, ratios[i])
table.insert(filtered_ratios, ratios[i])
end
end
end
return filtered_ratios
else
return ratios
end
end
return filtered_ratios
end
end


Line 403: Line 399:


local equave = rat.new(2,1)
local equave = rat.new(2,1)
local fine_search_args = p.parse_search_args("Subgroup: 2.5.9/7.21; Complements Only: 1")
local fine_search_args = p.parse_search_args("Subgroup: 2.5.9/7.21; Int Limit: 50; Complements Only: 0; Tenney Height: 10")
local subgroup = {rat.new(2), rat.new(3), rat.new(5), rat.new(7)}
local subgroup = {rat.new(2), rat.new(3), rat.new(5), rat.new(7)}




return p.search_footnotes(fine_search_args)
return p.ratios_as_string(p.search_by_args_within_equave(equave, fine_search_args))
end
end


return p
return p