Godtone (talk | contribs)
m My Python 3 code: make default to not convert subharmonic to avoid unexpected behaviour
Godtone (talk | contribs)
add wiki table generator to fill out barren/bad tables (needs testing first)
Line 1,185: Line 1,185:
print('\n'.join([ striv(x) for x in scale ]))
print('\n'.join([ striv(x) for x in scale ]))


def interpret_edo(edo,ol=17,sg=[],no=[],add=[],styler=lambda x,relerr: striv(x) if abs(relerr) < 1/2 else '*'+striv(x)+'*',dec='*'):
def interpret_edo(edo,ol=17,sg=[],no=[],add=[],styler=lambda x,relerr: striv(x) if abs(relerr) < 1/2 else '*'+striv(x)+'*',dec='*',wiki=0):
considered_bad = styler if type(styler)==int or type(styler)==float else 1/2
considered_bad = styler if type(styler)==int or type(styler)==float else 1/2
if considered_bad != 1/2 or dec != '*': # if a custom bound was provided instead of a styler or a decoration was provided
if considered_bad != 1/2 or dec != '*': # if a custom bound was provided instead of a styler or a decoration was provided
Line 1,195: Line 1,195:
odds = [odd for odd in range(1,ol+1,2) if in_subgroup(odd,sg) and odd not in no] + add
odds = [odd for odd in range(1,ol+1,2) if in_subgroup(odd,sg) and odd not in no] + add
sedo = 0
sedo = 0
if wiki:
def hyperlink(x):
return '[['+striv(x)+']]' if prime_idx(len(fact(x))-1) <= wiki else striv(x)
styler=lambda x,relerr: hyperlink(x) if abs(relerr) < considered_bad else dec+hyperlink(x)+dec[::-1]
for x in sorted( odd_lim(1,[],odds), key=lambda x: steps(x,ed(edo)) ):
for x in sorted( odd_lim(1,[],odds), key=lambda x: steps(x,ed(edo)) ):
sedoofx = pval(x,ed(edo))
sedoofx = pval(x,ed(edo))
Line 1,200: Line 1,204:
if sedoofx!=sedo:
if sedoofx!=sedo:
sedo = sedoofx
sedo = sedoofx
print('\n'+str(sedo)+'\\'+str(edo)+': '+styler(x,relerr),end='')
if wiki:
print('\n|-\n| '+str(sedo)+'\n| '+str( int(1200/edo*sedo * 100 + .5)/100 )+'\n| '+styler(x,relerr),end='')
else:
print('\n'+str(sedo)+'\\'+str(edo)+': '+styler(x,relerr),end='')
else:
else:
print(', '+styler(x,relerr),end='')
print(', '+styler(x,relerr),end='')