This commit is contained in:
Connor Olding 2014-10-02 01:33:47 -07:00
parent 9ef423de71
commit f937547991
2 changed files with 4 additions and 3 deletions

View file

@ -30,8 +30,9 @@ def note2freq(name):
return A*rel**(fullnum + 3)
if __name__ == '__main__':
test_fmt = '{:3} gave {: 9.2f} Hz\nexpected {: 9.2f} Hz'
def test(name, expected):
print('{:3} gave {: 9.2f} Hz\nexpected {: 9.2f} Hz'.format(name, note2freq(name), expected))
print(test_fmt.format(name, note2freq(name), expected))
test('C2' , 65.41)
test('Ab4', 415.30)

View file

@ -16,8 +16,8 @@ def uw2tension(uw, freq, SL):
def tension2uw(t, freq, SL):
return (t*uw_const)/(2*SL*freq)**2
outfmt = '{:<8} at {:> 5.2f} lbs ({:>+4.2f})'
finalfmt = 'total: {:>7.2f} lbs ({:>+5.2f})'
outfmt = '{:<8} at {:> 5.2f} lb ({:>+4.2f})'
finalfmt = 'total: {:>7.2f} lb ({:>+5.2f})'
def print_ideal_stock(strings, scale_length=25.512):
SL = scale_length
total_tension = 0