コード例 #1
0
    print "numtests", numtests, " numpass", numpass, " numfail", numfail
    assert numpass + numfail == numtests
   


def _main(argv):
    import os.path
    prog = os.path.basename(argv[0])
    args = argv[1:]

    print prog, args

    usage = "%s --logreftest" % (prog,)
    
    if (len(args) > 0 and args[0] == '--logreftest') or prog == '':
        _logreftest()
        return

    print "usage:", usage
    print
    raise ValueError("invalid or missing args: %s" % (' '.join(map(repr, args)),))


if __name__ == '__main__':
    from onyx import onyx_mainstartup
    onyx_mainstartup()

    from sys import argv
    if len(argv) > 1:
        _main(argv)
コード例 #2
0
ファイル: livedemo.py プロジェクト: uncledickHe/speechAD
    highfreq = 4000
    import math
    low_index = int(math.ceil(lowfreq * fft_size / samples_per_sec))
    high_index = int(math.floor(highfreq * fft_size / samples_per_sec))
    # the bin selector
    select = slice(low_index, high_index)
    def display(data):
        band = data[select]
        band *= band
        sum = float(band.sum())
        dB = int(dB_scale * (10 * math.log10(sum) + dB_offset))
        dp('%11.6f ' % sum, '%3d' % dB)
        dB = max(1, dB)
        #outfile.write('\n' + ' ' * dB + '|')
        outfile.write( pen * dB + 'O' + '\n')

    mic.set_sendee(fftmag.process)
    fftmag.set_sendee(display)

if __name__ == '__main__':

    from onyx import onyx_mainstartup
    onyx_mainstartup()
    del onyx_mainstartup

del division


##     startup(args)
##     del args, startup