Godtone
Joined 17 December 2020
→My Python 3 code: added code for checking odd-limit consistency |
→My Python 3 code: include octave complements of intervals in odd limits by default |
||
| Line 561: | Line 561: | ||
def consistent_err(x, et2, p=None): | def consistent_err(x, et2, p=None): | ||
return pval(x if type(x)==list else fact(x,p), et2, p) - steps(as_float(x,p),et2) | return pval(x if type(x)==list else fact(x,p), et2, p) - steps(as_float(x,p),et2) | ||
def odd_lim(lim, remove=set(), add=set()): | def odd_lim(lim, remove=set(), add=set(), include_complements = True): | ||
odds = set([i for i in range(1,lim+1,2) if i not in remove]) | odds = set([i for i in range(1,lim+1,2) if i not in remove]) | ||
odds |= set(add) | odds |= set(add) | ||
| Line 572: | Line 572: | ||
oct_denom *= 2 | oct_denom *= 2 | ||
ivs|={iv(numer,oct_denom)} | ivs|={iv(numer,oct_denom)} | ||
if include_complements: | |||
ivs = set([ iv(i[1]*2,i[0]) for i in ivs ]) | |||
return ivs | return ivs | ||
def inconsistencies(ivs, et2, threshold=1/2): | def inconsistencies(ivs, et2, threshold=1/2): | ||
return [r for r in ivs if abs( consistent_err(fact(r),et2) )>=threshold] | return [r for r in ivs if abs( consistent_err(fact(r),et2) )>=threshold] | ||
</syntaxhighlight> | </syntaxhighlight> | ||