[Chimera-users] writing mrc files

Thomas Goddard goddard at cgl.ucsf.edu
Fri Apr 21 13:50:45 PDT 2006


Hi Eran,

  Oops!  My suggested code was wrong.  a = a.resize(grid_size) gives an
error because Numeric tries copy values of a into a instead of just
rebinding variable a.  The corrected version is below.

	Tom


def write_mrc(data, zyx_grid_size):
    print data
    origin = (1.54, 2.45, 3.45)     # XYZ coordinates of array index (0,0,0)
    step = (.25, .25, .25)          # Spacing between grid points

    import Numeric
    a = Numeric.array(data, Numeric.Float32)
    a_3d = a.resize(zyx_grid_size)
    arrays = [a_3d]
    import VolumeData
    g = VolumeData.Array_Grid_Data(arrays, origin, step)
    path = '/home/eshacham/structures/result.mrc'
    from VolumeData.mrc import write_mrc2000_grid_data
    write_mrc2000_grid_data(g, path)



More information about the Chimera-users mailing list