Load brick
Jump to navigation
Jump to search
load_brick is an API-only function to load an array of data as a map into PyMOL.
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, \
])