| | 53 | |
|---|
| | 54 | |
|---|
| | 55 | |
|---|
| | 56 | class ProgressBarTest(unittest.TestCase): |
|---|
| | 57 | |
|---|
| | 58 | def runTest(self): |
|---|
| | 59 | |
|---|
| | 60 | import time |
|---|
| | 61 | print '\nINFO: Testing progress bar...' |
|---|
| | 62 | for i in range(100): |
|---|
| | 63 | plotting.progress_bar(i/100.) |
|---|
| | 64 | time.sleep(.01) |
|---|
| | 65 | print '\n' |
|---|
| | 66 | |
|---|
| | 67 | |
|---|
| | 68 | |
|---|
| | 69 | class Save2DImageTest(unittest.TestCase): |
|---|
| | 70 | |
|---|
| | 71 | def runTest(self): |
|---|
| | 72 | |
|---|
| | 73 | import numpy |
|---|
| | 74 | mat = numpy.random.random([50,50]) |
|---|
| | 75 | filename = 'deleteme.png' |
|---|
| | 76 | if os.path.exists(filename): os.remove(filename) |
|---|
| | 77 | plotting.save_2D_image(mat, filename) |
|---|
| | 78 | assert os.path.exists(filename) |
|---|
| | 79 | os.remove(filename) |
|---|
| | 80 | |
|---|
| | 81 | |
|---|
| | 82 | |
|---|
| | 83 | class Save2DMovieTest(unittest.TestCase): |
|---|
| | 84 | |
|---|
| | 85 | def runTest(self): |
|---|
| | 86 | |
|---|
| | 87 | import numpy |
|---|
| | 88 | frames = [] |
|---|
| | 89 | duration = 0.1 |
|---|
| | 90 | for i in range(10): |
|---|
| | 91 | frames.append(numpy.random.randint(0,255,[10,10])) |
|---|
| | 92 | filename = 'deleteme.zip' |
|---|
| | 93 | if os.path.exists(filename): os.remove(filename) |
|---|
| | 94 | plotting.save_2D_movie(frames, filename, duration) |
|---|
| | 95 | assert os.path.exists(filename) |
|---|
| | 96 | os.remove(filename) |
|---|