Load brick

From PyMOLWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

load_brick is an API-only function to load an array of data as a map into PyMOL.

Volume visualization of a map (artificial data)

Example

from pymol import cmd
from chempy.brick import Brick
import numpy

# grid spacing in Angstrom
yourgridspacing = (0.2, 0.2, 0.2)

# numpy array with some artificial data
yourdata = numpy.zeros((100, 100, 100))
yourdata[20:80, 20:80, 20:80] = 1.0
yourdata[40:60, 40:60, 40:60] = 2.0

# load into PyMOL
brick = Brick.from_numpy(yourdata, yourgridspacing)
cmd.load_brick(brick, 'yourmap')

# visualize
cmd.volume('yourvolume', 'yourmap', [\
      0.5, 'blue', 0.4, \
      0.6, 'blue', 0.0, \
      1.4, 'red', 0.0, \
      1.5, 'red', 0.9, \
    ])

See Also