em_map_utils.map_threshold¶
map_threshold.py
- Author:
Ardan Patwardhan
- Affiliation:
EMBL-EBI, Wellcome Genome Campus, CB10 1SD, UK
- Date:
05/08/2025
- Description:
Threshold map.
Attributes¶
Classes¶
Class to represent the map histogram, the related cumulative |
Functions¶
|
Count the number of voxels in the map that are within the dimensions |
|
Determine a threshold level for the map which is suitable for |
Module Contents¶
- em_map_utils.map_threshold.logger¶
- class em_map_utils.map_threshold.MapHistogram(map_grid, histogram_bins=5000, sigma_factor=3.0, log_histogram=False)¶
Class to represent the map histogram, the related cumulative distribution function and histogram of the background (noise) in a map.
- plot_map_histogram(log_y=True)¶
Plot the map histogram.
- Parameters:
log_y – If True, log scale the y-axis of the map histogram.
- Returns:
A tuple with the figure and axes objects.
- plot_map_cdf()¶
Plot the map cumulative distribution function.
- Returns:
A tuple with the figure and axes objects.
- plot_bg_histogram(log_y=True)¶
Plots the background histogram.
- Parameters:
log_y – If True, log scale the y-axis of the map histogram.
- Returns:
A tuple with the figure and axes objects.
- sigma_factor = 3.0¶
- bin_width¶
- cum_dist_func¶
- map_hist_peak_idx¶
- map_hist_peak_val¶
- map_mean¶
- map_var¶
- map_sigma¶
- bg_hist_sum¶
- bg_frac¶
- bg_mean_idx¶
- bg_var_idx¶
- bg_mean¶
- bg_var¶
- bg_sigma¶
- bg_threshold¶
- em_map_utils.map_threshold.count_voxels_matching_criteria(map, threshold, cuboid_dims)¶
Count the number of voxels in the map that are within the dimensions of a centred cuboid and with map values above a threshold.
- Parameters:
map – Input map.
threshold – Threshold to count voxels with.
cuboid_dims – Only count voxels within a centred cuboid with these dimensions.
- Returns:
Count of voxels within the cuboid and with map values above a threshold.
- em_map_utils.map_threshold.threshold_map(map_grid)¶
Determine a threshold level for the map which is suitable for visualisation. A two-step procedure is used. First the background sigma in the map is estimated and a threshold is calculated based on this. The map is thresholded and then orthogonal line projection profiles are calculated. A second threshold is calculated based on the width of these profiles. These two values are averaged to a final value. Note: This algorithm exploits the characteristics of cryoEM maps
and may not work on synthetic maps.
- Parameters:
map_grid – Input map.
- Returns:
A tuple with the thresholded map, the threshold level, the histogram object and the line profile object.
- em_map_utils.map_threshold.parser¶