Documented functions with links to source¶
Program to examine all excised in-plane rotated segments and compute their collapsed (1D) and 2D power spectrum and width profile of helices
-
class
segmentexam.
SegmentExamPar
[source]¶ Class to initiate default dictionary with input parameters including help and range values and status dictionary
Methods
define_parameters_and_their_properties
define_program_states
set_compute_layer_line_correlation
set_layer_line_region
set_power_spectrum_reference
-
class
segmentexam.
SegmentExamPower
(parset=None)[source]¶ Class that holds functions for examining segments from micrographs
__init__ Function to interpret multi-input parameters
Methods
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
bin_image_stack_by_binfactor
-
apply_binfactor
(binfactor, infilestack, segsizepix, helixwidthpix, pixelsize, image_list=None, outfile=None)[source]¶ Function to reduce stack and modify pixelsize according to desired binfactor
Input: binfactor, infile stack to be binned, segment size (pixel), helix width (pixel) pixelsize
Output: binned stack, adjusted segment size (pixel), helix width (pixel), pixelsize
Usage: binned stack, segsizepix, helixwidth, pixelsize = apply_binfactor(binfactor, infilestack, segsizepix, helixwidth, pixelsize)
-
enhance_power
(avg_periodogram=None, pixelsize=None)[source]¶ Function to visually enhance power spectrum by compensating for decay of amplitude
Input: power spectrum
Output: enhanced power spectrum
Usage: avg_periodogram_enhanced = enhance_power(avg_periodogram)
-
collapse_power
(addpowimg)[source]¶ Function to project powerspectrum onto 1D plot to determine layer line position
Input: power spectrum, segment size (pixel)
Output: collapsed profile
Usage: add1dimg = collapse_power(avg_periodogram)
-
class
segmentexam.
SegmentExamMask
(parset=None)[source]¶ Methods
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
generate_falloff_line
(segment_size_in_pixel, …)>>> from spring.segment2d.segmentexam import SegmentExam
make_smooth_rectangular_mask
(hel_width_pix, …)>>> from spring.segment2d.segmentexam import SegmentExam
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
add_smooth_gaussian_falloff_to_edge_of_binary_mask
bin_image_stack_by_binfactor
compute_radial_average_from_line
generate_radial_falloff_gradient
generate_rectangular_mask_with_linear_falloffs
generate_two_dee_cosine_falloff
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
insure_mirror_symmetry_of_mask_parameters
limit_width_falloff_to_available_pixels_outside_binary_mask
make_binary_shape_mask
pad_image_to_current_size
resize_mask_to_segment_dimensions
window_image_to_current_sizes
-
limit_width_falloff_to_available_pixels_outside_binary_mask
(helix_width_in_pixel, helix_height_in_pixel, segment_size_in_pixel, width_falloff)[source]¶
-
add_smooth_gaussian_falloff_to_edge_of_binary_mask
(segment_size_in_pixel, width_falloff, binary_mask)[source]¶
-
generate_falloff_line
(segment_size_in_pixel, width_falloff)[source]¶ >>> from spring.segment2d.segmentexam import SegmentExam >>> s = SegmentExam() >>> s.generate_falloff_line(20, 0.5) (array([1. , 0.97488286, 0.90205491, 0.78883309, 0.64659262, 0.48962419, 0.33369821, 0.19448033, 0.08595758, 0.01903308]), 10)
>>> s.generate_falloff_line(20, 0) (array([], dtype=float64), 0)
-
generate_rectangular_mask_with_linear_falloffs
(helix_width_in_pixel, helix_height_in_pixel, segment_size_in_pixel, width_falloff)[source]¶
-
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
(radial_quadrant, falloff_line, rect_mask)[source]¶
-
make_smooth_rectangular_mask
(hel_width_pix, hel_height_pix, seg_size_pix, width_falloff=0.1)[source]¶ >>> from spring.segment2d.segmentexam import SegmentExam >>> helixmask = SegmentExam().make_smooth_rectangular_mask(13, 30, 40) >>> mask_row = helixmask.get_row(20) >>> EMNumPy.em2numpy(mask_row) array([0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.13561368, 0.4896242 , 0.84986573, 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 1. , 0.84986573, 0.4896242 , 0.13561368, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. ], dtype=float32) >>> helixmask = SegmentExam().make_smooth_rectangular_mask(20, 20, 40, 0) >>> mask_row = helixmask.get_row(20) >>> EMNumPy.em2numpy(mask_row) array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], dtype=float32)
-
class
segmentexam.
SegmentExamWidth
(parset=None)[source]¶ Methods
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
find_local_extrema
(fits[, target, window])Function from [SciPy-user] mailing list ‘Finding local minima of greater than a given depth’
generate_falloff_line
(segment_size_in_pixel, …)>>> from spring.segment2d.segmentexam import SegmentExam
make_smooth_rectangular_mask
(hel_width_pix, …)>>> from spring.segment2d.segmentexam import SegmentExam
measure_peakdist
([rowsaddimg, segsizepix, …])Function to measure distance between two symmetrical peaks of 1D helix width projection
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
add_smooth_gaussian_falloff_to_edge_of_binary_mask
bin_image_stack_by_binfactor
compute_radial_average_from_line
generate_radial_falloff_gradient
generate_rectangular_mask_with_linear_falloffs
generate_two_dee_cosine_falloff
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
insure_mirror_symmetry_of_mask_parameters
limit_width_falloff_to_available_pixels_outside_binary_mask
make_binary_shape_mask
pad_image_to_current_size
resize_mask_to_segment_dimensions
window_image_to_current_sizes
-
find_local_extrema
(fits, target='maxima', window=None)[source]¶ Function from [SciPy-user] mailing list ‘Finding local minima of greater than a given depth’
Input: 1D/2D array of data and window size for minimum filter
Output: ordered indices and minimum values
Usage: ind, minima = find_local_extrema(array, target, window)
-
measure_peakdist
(rowsaddimg=None, segsizepix=None, pixelsize=None)[source]¶ Function to measure distance between two symmetrical peaks of 1D helix width projection
Input: rowsaddimg = projection to be measured, segsizepix = segment size (pixel), pixelsize
Output: width of helix in Angstrom
Usage: width = measure_peakdist(rowsaddimg, segsizepix, pixelsize)
-
class
segmentexam.
SegmentExamLayerCorrelation
(parset=None)[source]¶ Methods
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
>>> from spring.segment2d.segmentexam import SegmentExam
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
find_local_extrema
(fits[, target, window])Function from [SciPy-user] mailing list ‘Finding local minima of greater than a given depth’
generate_falloff_line
(segment_size_in_pixel, …)>>> from spring.segment2d.segmentexam import SegmentExam
make_smooth_rectangular_mask
(hel_width_pix, …)>>> from spring.segment2d.segmentexam import SegmentExam
measure_peakdist
([rowsaddimg, segsizepix, …])Function to measure distance between two symmetrical peaks of 1D helix width projection
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
add_smooth_gaussian_falloff_to_edge_of_binary_mask
bin_image_stack_by_binfactor
compute_power_correlations_with_rings
compute_radial_average_from_line
enter_correlation_values_in_database
generate_radial_falloff_gradient
generate_rectangular_mask_with_linear_falloffs
generate_series_of_circular_masks_from_radii
generate_two_dee_cosine_falloff
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
insure_mirror_symmetry_of_mask_parameters
limit_width_falloff_to_available_pixels_outside_binary_mask
make_binary_shape_mask
pad_image_to_current_size
resize_mask_to_segment_dimensions
window_image_to_current_sizes
-
class
segmentexam.
SegmentExamVisualize
(parset=None)[source]¶ Methods
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
cleanup
(*files)Function to clean up intermediate image files
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
compute_radii_for_fourier_mask
(…)>>> from spring.segment2d.segmentexam import SegmentExam
display_average_and_variance
([twodavg, twodvar])Function to add average and variance images to diagnostic output plot
Function to visualize power spectra: sum of power spectra, enhanced sum and their collapsed 1D profile
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
find_local_extrema
(fits[, target, window])Function from [SciPy-user] mailing list ‘Finding local minima of greater than a given depth’
generate_falloff_line
(segment_size_in_pixel, …)>>> from spring.segment2d.segmentexam import SegmentExam
make_oneoverres
([arr, pixelsize])Function to generate an array of resolution in reciprocal Angstrom
make_smooth_rectangular_mask
(hel_width_pix, …)>>> from spring.segment2d.segmentexam import SegmentExam
measure_peakdist
([rowsaddimg, segsizepix, …])Function to measure distance between two symmetrical peaks of 1D helix width projection
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
setup_fourxtwo
([figno])Function to setup 4 x 2 subplot grid for diagnostic output
split_quarters
([addpowimgenh])Function to split enhanced power spectrum (EMData object) into lower right quarter
Function to add width profile to diagnostic output plot
add_smooth_gaussian_falloff_to_edge_of_binary_mask
add_width_histogram_next_to_width_profile
add_width_profile_from_avg_and_var
bin_image_stack_by_binfactor
compute_power_correlations_with_rings
compute_radial_average_from_line
enter_correlation_values_in_database
generate_radial_falloff_gradient
generate_rectangular_mask_with_linear_falloffs
generate_series_of_circular_masks_from_radii
generate_two_dee_cosine_falloff
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
insure_mirror_symmetry_of_mask_parameters
limit_width_falloff_to_available_pixels_outside_binary_mask
make_binary_shape_mask
pad_image_to_current_size
resize_mask_to_segment_dimensions
window_image_to_current_sizes
-
split_quarters
(addpowimgenh=None)[source]¶ Function to split enhanced power spectrum (EMData object) into lower right quarter
Input: avg_periodogram_enhanced = added power spectrum, segment size (pixel)
Output: lower right quarter
Usage: addpowimgenh1st = split_quarters(avg_periodogram_enhanced)
-
setup_fourxtwo
(figno=None)[source]¶ Function to setup 4 x 2 subplot grid for diagnostic output
Input: figno = figure number
Output: figure
Usage figure = setupfourxtwo(figno)
-
display_average_and_variance
(twodavg=None, twodvar=None)[source]¶ Function to add average and variance images to diagnostic output plot
Input: 2D average, 2d variance
Output: subplot ax1, subplot ax3
Usage: ax1, ax3 = display_average_and_variance(twodavg, twodvar)
-
visualize_widthprofile_and_histogram
(widths=None, widthavg=None, widthvar=None, pixelsize=None)[source]¶ Function to add width profile to diagnostic output plot
Input: widths = list of widths, widthavg = average of width, widthvar = variance of width, pixelsize Output: subplot ax2, ax4 Usage: ax2, ax4 = visualize_widthprofile_and_histogram(widths, widthavg, widthvar, pixelsize)
-
display_power_spectra_enhanced_and_collapsed
(avg_periodogram=None, avg_periodogram_enhanced=None, avg_collapsed_power_line=None, avg_collapsed_line_enhanced=None)[source]¶ Function to visualize power spectra: sum of power spectra, enhanced sum and their collapsed 1D profile
Input: avg_periodogram = sum of power spectra (img), avg_periodogram_enhanced = enhanced sum of power spectra, avg_collapsed_power_line = collapsed profile of power spectrum (img), avg_collapsed_line_enhanced = collapsed profile of enhanced power spectrum
Output: subplots ax5, ax6, ax7, ax8
- Usage: ax5, ax6, ax7, ax8 = display_power_spectra_enhanced_and_collapsed(avg_periodogram,
avg_periodogram_enhanced, avg_collapsed_power_line, avg_collapsed_line_enhanced)
-
make_oneoverres
(arr=None, pixelsize=None)[source]¶ Function to generate an array of resolution in reciprocal Angstrom
Input: array, pixelsize
Output: array of reciprocal resolution (1/Angstrom)
Usage: arrresolution = make_overoverres(arr, pixelsize)
>>> from spring.segment2d.segmentexam import SegmentExam >>> SegmentExam().make_oneoverres(range(10), 10) array([0. , 0.00555556, 0.01111111, 0.01666667, 0.02222222, 0.02777778, 0.03333333, 0.03888889, 0.04444444, 0.05 ])
>>> SegmentExam().make_oneoverres(range(25), 1) array([0. , 0.02083333, 0.04166667, 0.0625 , 0.08333333, 0.10416667, 0.125 , 0.14583333, 0.16666667, 0.1875 , 0.20833333, 0.22916667, 0.25 , 0.27083333, 0.29166667, 0.3125 , 0.33333333, 0.35416667, 0.375 , 0.39583333, 0.41666667, 0.4375 , 0.45833333, 0.47916667, 0.5 ]) >>> 1/SegmentExam().make_oneoverres(range(25), 1) array([ inf, 48. , 24. , 16. , 12. , 9.6 , 8. , 6.85714286, 6. , 5.33333333, 4.8 , 4.36363636, 4. , 3.69230769, 3.42857143, 3.2 , 3. , 2.82352941, 2.66666667, 2.52631579, 2.4 , 2.28571429, 2.18181818, 2.08695652, 2. ])
-
class
segmentexam.
SegmentExam
(parset=None)[source]¶ Methods
Function to compute sum of in-planed rotated segments
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
cleanup
(*files)Function to clean up intermediate image files
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
compute_radii_for_fourier_mask
(…)>>> from spring.segment2d.segmentexam import SegmentExam
determine_width
(infilestack, segsizepix, …)Function to project width profile of segments
display_average_and_variance
([twodavg, twodvar])Function to add average and variance images to diagnostic output plot
display_power_spectra_enhanced_and_collapsed
([…])Function to visualize power spectra: sum of power spectra, enhanced sum and their collapsed 1D profile
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
find_local_extrema
(fits[, target, window])Function from [SciPy-user] mailing list ‘Finding local minima of greater than a given depth’
generate_falloff_line
(segment_size_in_pixel, …)>>> from spring.segment2d.segmentexam import SegmentExam
make_oneoverres
([arr, pixelsize])Function to generate an array of resolution in reciprocal Angstrom
make_smooth_rectangular_mask
(hel_width_pix, …)>>> from spring.segment2d.segmentexam import SegmentExam
measure_peakdist
([rowsaddimg, segsizepix, …])Function to measure distance between two symmetrical peaks of 1D helix width projection
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
setup_fourxtwo
([figno])Function to setup 4 x 2 subplot grid for diagnostic output
split_quarters
([addpowimgenh])Function to split enhanced power spectrum (EMData object) into lower right quarter
Function to combine output of width and power spectra analysis into single summary sheet
visualize_widthprofile_and_histogram
([…])Function to add width profile to diagnostic output plot
add_smooth_gaussian_falloff_to_edge_of_binary_mask
add_up_power_spectra
add_width_histogram_next_to_width_profile
add_width_profile_from_avg_and_var
bin_image_stack_by_binfactor
collapse_periodograms
compute_avg_and_var_of_width_and_image
compute_power_correlations_with_rings
compute_radial_average_from_line
copy_database_and_filter_segment_ids
correlate_layer_lines_of_average_power_with_individual_segments
enter_correlation_values_in_database
generate_radial_falloff_gradient
generate_rectangular_mask_with_linear_falloffs
generate_series_of_circular_masks_from_radii
generate_two_dee_cosine_falloff
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
insure_mirror_symmetry_of_mask_parameters
limit_width_falloff_to_available_pixels_outside_binary_mask
make_binary_shape_mask
pad_image_to_current_size
resize_mask_to_segment_dimensions
window_image_to_current_sizes
write_avg_periodograms
-
add_power_spectra_from_verticalized_stack
(infilestack, segment_ids, helixwidth=None, masked_infilestack=None, power_infilestack=None, padsize=4)[source]¶ Function to compute sum of in-planed rotated segments
-
determine_width
(infilestack, segsizepix, segment_ids)[source]¶ Function to project width profile of segments
Input: stackfile, segment size (pixel)
Output: width average profile, width variance profile, measured width list
Usage: widthavg, widthvar, widths = determine_width(infilestack, segsizepix)
-
correlate_layer_lines_of_average_power_with_individual_segments
(avg_periodogram, masked_power, segment_ids)[source]¶
-
class
segmentexam_mpi.
SegmentExamMpi
(parset=None)[source]¶ Methods
add_power_spectra_from_verticalized_stack
(…)Function to compute sum of in-planed rotated segments
apply_binfactor
(binfactor, infilestack, …)Function to reduce stack and modify pixelsize according to desired binfactor
cleanup
(*files)Function to clean up intermediate image files
collapse_power
(addpowimg)Function to project powerspectrum onto 1D plot to determine layer line position
compute_radii_for_fourier_mask
(…)>>> from spring.segment2d.segmentexam import SegmentExam
determine_width
(infilestack, segsizepix, …)Function to project width profile of segments
display_average_and_variance
([twodavg, twodvar])Function to add average and variance images to diagnostic output plot
display_power_spectra_enhanced_and_collapsed
([…])Function to visualize power spectra: sum of power spectra, enhanced sum and their collapsed 1D profile
enhance_power
([avg_periodogram, pixelsize])Function to visually enhance power spectrum by compensating for decay of amplitude
find_local_extrema
(fits[, target, window])Function from [SciPy-user] mailing list ‘Finding local minima of greater than a given depth’
generate_falloff_line
(segment_size_in_pixel, …)>>> from spring.segment2d.segmentexam import SegmentExam
>>> from spring.segment2d.segmentexam_mpi import SegmentExamMpi
make_oneoverres
([arr, pixelsize])Function to generate an array of resolution in reciprocal Angstrom
make_smooth_rectangular_mask
(hel_width_pix, …)>>> from spring.segment2d.segmentexam import SegmentExam
measure_peakdist
([rowsaddimg, segsizepix, …])Function to measure distance between two symmetrical peaks of 1D helix width projection
project_helix
([seg])Function to project image along helical axis by adding rows of image
project_normal_to_helix
([seg])Function to project image perpendicular to helical axis by adding columns of image
setup_fourxtwo
([figno])Function to setup 4 x 2 subplot grid for diagnostic output
split_quarters
([addpowimgenh])Function to split enhanced power spectrum (EMData object) into lower right quarter
visualize_power_avg_and_width_analysis
(…)Function to combine output of width and power spectra analysis into single summary sheet
visualize_widthprofile_and_histogram
([…])Function to add width profile to diagnostic output plot
add_powers_locally_and_reduce_on_main_node
add_smooth_gaussian_falloff_to_edge_of_binary_mask
add_up_power_spectra
add_width_histogram_next_to_width_profile
add_width_profile_from_avg_and_var
bin_image_stack_by_binfactor
collapse_periodograms
compute_avg_and_var_of_width_and_image
compute_power_correlations_with_rings
compute_radial_average_from_line
copy_database_and_filter_segment_ids
correlate_layer_line_region_mpi
correlate_layer_lines_of_average_power_with_individual_segments
determine_width_from_collapsed_profile_mpi
enter_correlation_values_in_database
generate_radial_falloff_gradient
generate_rectangular_mask_with_linear_falloffs
generate_series_of_circular_masks_from_radii
generate_two_dee_cosine_falloff
insert_radial_falloff_gradient_into_corners_of_rectangular_mask
insure_mirror_symmetry_of_mask_parameters
limit_width_falloff_to_available_pixels_outside_binary_mask
make_binary_shape_mask
pad_image_to_current_size
prepare_segmentexam_mpi
reduce_emdata_from_memory_on_main_node
resize_mask_to_segment_dimensions
visualize_avg_var_widths_and_power_spectra_mpi
window_image_to_current_sizes
write_avg_periodograms
-
generate_local_name_for_reduction
(emdata_file, rank)[source]¶ >>> from spring.segment2d.segmentexam_mpi import SegmentExamMpi >>> SegmentExamMpi().generate_local_name_for_reduction('ps_234567891.hdf', 2) 'ps_2345678912.hdf'