xmipp3.protocols.protocol_mics_defocus_balancer module

class xmipp3.protocols.protocol_mics_defocus_balancer.XmippProtMicDefocusSampler(**args)[source]

Bases: ProtCTFMicrographs

Protocol to make a balanced subsample of meaningful CTFs in basis of the defocus values. Both CTFs and micrographs will be output. CTFs with different defocus values look differently, while low defocus images will have bigger fringes, higher defocus values will have more compact rings. Micrographs with a greater defocus will have more contrast.

createOutputStep()[source]

This function is shared by Xmipp and CTFfind estimation, or recalculate, protocols. if is recalculate, it will iterated for each CTF model, see if was recalculated and update with new defocus values. Else, the function that should be implemented in each subclass.

createOutputs(newDone)[source]
extractBalancedDefocus(ctfIds)[source]
fillOutput(ctfSet, micSet, newDone)[source]
initializeParams()[source]
updateRelations(cSet, mSet)[source]
xmipp3.protocols.protocol_mics_defocus_balancer.balanced_sampling(image_dict, N, bins=10)[source]

Perform balanced sampling of N images based on defocus values.

Parameters: - image_dict (dict): Dictionary where keys are image IDs and values are defocus values. - N (int): Total number of images to sample. - bins (int): Number of bins to divide defocus values into (default is 10).

Returns: - sampled_images (list): List of sampled image IDs.

xmipp3.protocols.protocol_mics_defocus_balancer.compute_statistics(values)[source]

Compute basic statistics for a list of numerical values.

Parameters: - values (list or array-like): A list of numerical values (e.g., defocus values).

Returns: - dict: A dictionary containing the statistics: min, max, mean, median, std, variance, and range.