def main():
    '\n    Unit tests\n    '
    max_depth = 4.0
    numFrames = 10
    height_ratio = 0.5
    sub_sample = 1
    reduce_to = 'middle_lower'
    print('Program settings:')
    print(('\tmax_depth: ' + str(max_depth)))
    print(('\tnumFrames: ' + str(numFrames)))
    print(('\theight_ratio: ' + str(height_ratio)))
    print(('\tsub_sample: ' + str(sub_sample)))
    print(('\treduce_to: ' + reduce_to))
    cam = Camera(max_depth=max_depth)
    cam.connect()
    time.sleep(2.5)
    t1 = time.time()
    d = cam.getFrames(numFrames)
    t2 = time.time()
    printStmt = ('Time to get {0} frames: ' + str((t2 - t1)))
    print(printStmt.format(numFrames))
    d_small = cam.reduceFrame(d, height_ratio=height_ratio, sub_sample=sub_sample, reduce_to=reduce_to)
    plt.figure(figsize=(6, 7))
    ax2 = plt.subplot(2, 1, 2)
    plt.imshow(d_small, cmap='gist_rainbow')
    plt.colorbar()
    plt.title('Scaled (height_ratio = {0}, sub_sample = {1})'.format(height_ratio, sub_sample))
    plt.grid()
    plt.subplot(2, 1, 1)
    plt.imshow(d, cmap='gist_rainbow')
    plt.colorbar()
    plt.title('Original')
    plt.grid()
    plt.subplots_adjust(hspace=0.3)
    plt.show()
    cam.disconnect()
Unit tests
def main():
    '\n    \n    '
    max_depth = 4.0
    numFrames = 10
    height_ratio = 0.5
    sub_sample = 1
    reduce_to = 'middle_lower'
    print('Program settings:')
    print(('\tmax_depth: ' + str(max_depth)))
    print(('\tnumFrames: ' + str(numFrames)))
    print(('\theight_ratio: ' + str(height_ratio)))
    print(('\tsub_sample: ' + str(sub_sample)))
    print(('\treduce_to: ' + reduce_to))
    cam = Camera(max_depth=max_depth)
    cam.connect()
    time.sleep(2.5)
    t1 = time.time()
    d = cam.getFrames(numFrames)
    t2 = time.time()
    printStmt = ('Time to get {0} frames: ' + str((t2 - t1)))
    print(printStmt.format(numFrames))
    d_small = cam.reduceFrame(d, height_ratio=height_ratio, sub_sample=sub_sample, reduce_to=reduce_to)
    plt.figure(figsize=(6, 7))
    ax2 = plt.subplot(2, 1, 2)
    plt.imshow(d_small, cmap='gist_rainbow')
    plt.colorbar()
    plt.title('Scaled (height_ratio = {0}, sub_sample = {1})'.format(height_ratio, sub_sample))
    plt.grid()
    plt.subplot(2, 1, 1)
    plt.imshow(d, cmap='gist_rainbow')
    plt.colorbar()
    plt.title('Original')
    plt.grid()
    plt.subplots_adjust(hspace=0.3)
    plt.show()
    cam.disconnect()