Exemplo n.º 1
0
def mlp_map(session, atoms, method, spacing, max_dist, nexp, name, open_map):
    data, bounds = calculatefimap(atoms, method, spacing, max_dist, nexp)

    # m.pot is 1-dimensional if m.writedxfile() was called.  Has indices in x,y,z order.
    origin = tuple(xmin for xmin, xmax in bounds)
    s = spacing
    step = (s, s, s)
    from chimerax.map_data import ArrayGridData
    g = ArrayGridData(data, origin, step, name=name)
    g.polar_values = True
    from chimerax.map import volume_from_grid_data
    v = volume_from_grid_data(g,
                              session,
                              open_model=open_map,
                              show_dialog=open_map)
    if open_map:
        v.update_drawings()  # Compute surface levels
        v.set_parameters(
            surface_colors=[(0, 139 / 255, 139 / 255,
                             1), (184 / 255, 134 / 255, 11 / 255, 1)])
    return v
Exemplo n.º 2
0
def laplacian(v, step=None, subregion=None, model_id=None):

    m = v.matrix(step=step, subregion=subregion)

    from numpy import float32, multiply, add
    lm = m.astype(float32)  # Copy array
    multiply(lm, -6.0, lm)
    add(lm[:-1, :, :], m[1:, :, :], lm[:-1, :, :])
    add(lm[1:, :, :], m[:-1, :, :], lm[1:, :, :])
    add(lm[:, :-1, :], m[:, 1:, :], lm[:, :-1, :])
    add(lm[:, 1:, :], m[:, :-1, :], lm[:, 1:, :])
    add(lm[:, :, :-1], m[:, :, 1:], lm[:, :, :-1])
    add(lm[:, :, 1:], m[:, :, :-1], lm[:, :, 1:])

    lm[0, :, :] = 0
    lm[-1, :, :] = 0
    lm[:, 0, :] = 0
    lm[:, -1, :] = 0
    lm[:, :, 0] = 0
    lm[:, :, -1] = 0

    origin, step = v.data_origin_and_step(subregion=subregion, step=step)
    d = v.data
    from chimerax.map_data import ArrayGridData
    ld = ArrayGridData(lm,
                       origin,
                       step,
                       d.cell_angles,
                       d.rotation,
                       name=v.name + ' Laplacian')
    ld.polar_values = True
    from chimerax.map import volume_from_grid_data
    lv = volume_from_grid_data(ld, v.session, model_id=model_id)
    lv.copy_settings_from(v, copy_thresholds=False, copy_colors=False)
    lv.set_parameters(cap_faces=False)

    v.display = False  # Hide original map

    return lv