Commit d0c919270867ef1f9f9320f978777219d5608e22
- Diff rendering mode:
- inline
- side by side
show_img.py
(35 / 0)
|   | |||
| 1 | #!/usr/bin/env python | ||
| 2 | #-*- mode: python -*- | ||
| 3 | |||
| 4 | from convention import * | ||
| 5 | import_convention(globals()) | ||
| 6 | |||
| 7 | from pylab import * | ||
| 8 | from mpmath import * | ||
| 9 | |||
| 10 | |||
| 11 | # program start | ||
| 12 | data = numpy.zeros((50,50)) | ||
| 13 | |||
| 14 | for i in range(0,50): | ||
| 15 | for j in range(0,50): | ||
| 16 | coefficient = pi/mpf(12.25) | ||
| 17 | data[i,j] = sin(i*coefficient) * sin(j*coefficient) | ||
| 18 | |||
| 19 | |||
| 20 | imshow(data) | ||
| 21 | colorbar() | ||
| 22 | savefig("show_img.png") | ||
| 23 | clf() | ||
| 24 | os.system("open show_img.png") | ||
| 25 | |||
| 26 | |||
| 27 | # plot grid.Plane | ||
| 28 | from fdtd import grid | ||
| 29 | plane = grid.Plane(data) | ||
| 30 | |||
| 31 | imshow(numpy.array(plane,dtype="float")) | ||
| 32 | colorbar() | ||
| 33 | savefig("plane.png") | ||
| 34 | clf() | ||
| 35 | os.system("open plane.png") |

