IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP.isd.gmm_tools Namespace Reference

Tools for handling Gaussian Mixture Models. More...

Detailed Description

Tools for handling Gaussian Mixture Models.

Functions

 decorate_gmm_from_text (in_fn, ps, mdl, transform=None, radius_scale=1.0, mass_scale=1.0)
 read the output from write_gmm_to_text, decorate as Gaussian and Mass
 draw_points (pts, out_fn, trans=IMP.algebra.get_identity_transformation_3d(), use_colors=False)
 given some points (and optional transform), write them to chimera 'bild' format; colors flag only applies to ellipses, otherwise it'll be weird
 fit_dirichlet_gmm_to_points (points, n_components, mdl, ps=[], num_iter=100, covariance_type='full', mass_multiplier=1.0)
 fit a GMM to some points.
 fit_gmm_to_points (points, n_components, mdl, ps=[], num_iter=100, covariance_type='full', min_covar=0.001, init_centers=[], force_radii=-1.0, force_weight=-1.0, mass_multiplier=1.0)
 fit a GMM to some points.
 write_gmm_to_map (to_draw, out_fn, voxel_size, bounding_box=None, origin=None, fast=False, factor=2.5)
 write density map from GMM.
 write_gmm_to_text (ps, out_fn, comments=[])
 write a list of gaussians to text.
 write_sklearn_gmm_to_map (gmm, out_fn, apix=0, bbox=None, dmap_model=None)
 write density map directly from sklearn GMM (kinda slow)

Function Documentation

◆ decorate_gmm_from_text()

decorate_gmm_from_text ( in_fn,
ps,
mdl,
transform = None,
radius_scale = 1.0,
mass_scale = 1.0 )

read the output from write_gmm_to_text, decorate as Gaussian and Mass

Note
This function is only available in Python.

Definition at line 22 of file gmm_tools.py.

◆ draw_points()

draw_points ( pts,
out_fn,
trans = IMP.algebra.get_identity_transformation_3d(),
use_colors = False )

given some points (and optional transform), write them to chimera 'bild' format; colors flag only applies to ellipses, otherwise it'll be weird

Note
This function is only available in Python.

Definition at line 151 of file gmm_tools.py.

◆ fit_dirichlet_gmm_to_points()

fit_dirichlet_gmm_to_points ( points,
n_components,
mdl,
ps = [],
num_iter = 100,
covariance_type = 'full',
mass_multiplier = 1.0 )

fit a GMM to some points.

Will return core::Gaussians. if no particles are provided, they will be created

points: list of coordinates (python) n_components: number of gaussians to create mdl: IMP Model ps: list of particles to be decorated. if empty, will add num_iter: number of EM iterations covariance_type: covar type for the gaussians. options: 'full', 'diagonal', 'spherical' init_centers: initial coordinates of the GMM force_radii: fix the radii (spheres only) force_weight: fix the weights mass_multiplier: multiply the weights of all the gaussians by this value

Note
This function is only available in Python.

Definition at line 363 of file gmm_tools.py.

◆ fit_gmm_to_points()

fit_gmm_to_points ( points,
n_components,
mdl,
ps = [],
num_iter = 100,
covariance_type = 'full',
min_covar = 0.001,
init_centers = [],
force_radii = -1.0,
force_weight = -1.0,
mass_multiplier = 1.0 )

fit a GMM to some points.

Will return the score and the Akaike score. Akaike information criterion for the current model fit. It is a measure of the relative quality of the GMM that takes into account the parsimony and the goodness of the fit. if no particles are provided, they will be created

points: list of coordinates (python) n_components: number of gaussians to create mdl: IMP Model ps: list of particles to be decorated. if empty, will add num_iter: number of EM iterations covariance_type: covar type for the gaussians. options: 'full', 'diagonal', 'spherical' min_covar: assign a minimum value to covariance term. That is used to have more spherical shaped gaussians init_centers: initial coordinates of the GMM force_radii: fix the radii (spheres only) force_weight: fix the weights mass_multiplier: multiply the weights of all the gaussians by this value dirichlet: use the DGMM fitting (can reduce number of components, takes longer)

Note
This function is only available in Python.

Definition at line 243 of file gmm_tools.py.

◆ write_gmm_to_map()

write_gmm_to_map ( to_draw,
out_fn,
voxel_size,
bounding_box = None,
origin = None,
fast = False,
factor = 2.5 )

write density map from GMM.

input can be either particles or gaussians

Note
This function is only available in Python.

Definition at line 118 of file gmm_tools.py.

◆ write_gmm_to_text()

write_gmm_to_text ( ps,
out_fn,
comments = [] )

write a list of gaussians to text.

must be decorated as Gaussian and Mass

Note
This function is only available in Python.

Definition at line 60 of file gmm_tools.py.

◆ write_sklearn_gmm_to_map()

write_sklearn_gmm_to_map ( gmm,
out_fn,
apix = 0,
bbox = None,
dmap_model = None )

write density map directly from sklearn GMM (kinda slow)

Note
This function is only available in Python.

Definition at line 128 of file gmm_tools.py.