Scripts: square.py
| File square.py, 471 bytes (added by , 16 years ago) |
|---|
| Line | |
|---|---|
| 1 | # Make a new map by squaring the values of the currently active map. |
| 2 | |
| 3 | # Get the currently active volume |
| 4 | from VolumeViewer import active_volume |
| 5 | v = active_volume() |
| 6 | |
| 7 | # Square the density values. |
| 8 | import numpy |
| 9 | m = v.full_matrix().astype(numpy.float32) |
| 10 | m[:] = m*m |
| 11 | |
| 12 | # Make a new map. |
| 13 | from VolumeData import Array_Grid_Data |
| 14 | from VolumeViewer.volume import volume_from_grid_data |
| 15 | g = Array_Grid_Data(m, v.data.origin, v.data.step, v.data.cell_angles) |
| 16 | c = volume_from_grid_data(g) |
![[Chimera Issue Tracking System]](/trac/chimera/chrome/site/chimera_logo.png)