Skip to content

Integrate estimate_ctf, CTFFilter, and CoordinateSources #622

@chris-langfield

Description

@chris-langfield

CTF Estimator

The estimate_ctf method (which creates a CTFEstimator object internally) takes in a directory containing micrographs and outputs results, a list of tuples containing CTF parameters for each micrograph:

def estimate_ctf(
data_folder,
pixel_size,
cs,
amplitude_contrast,
voltage,
num_tapers,
psd_size,
g_min,
g_max,
output_dir,
dtype=np.float32,
):
"""
Given paramaters estimates CTF from experimental data
and returns CTF as a mrc file.
"""

The first 3 items here correspond to defocus_u, defocus_v, and defocus_angle.

result = (
cc_array[ml, 0],
cc_array[ml, 1],
cc_array[ml, 2], # Radians
cs,
voltage,
pixel_size,
amp,
name,
)

CTF Filter

CTFFilter initialization has a different order, but this should be easily fixed.

class CTFFilter(Filter):
def __init__(
self,
pixel_size=10,
voltage=200,
defocus_u=15000,
defocus_v=15000,
defocus_ang=0,
Cs=2.26,
alpha=0.07,
B=0,
):
"""
A CTF (Contrast Transfer Function) Filter

Coordinate Sources

BoxesCoordinateSource and CentersCoordinateSource objects are initialized with empty unique_filters (this variable is designed to store CTF filters)

# Create filter indices for the source. These are required in order to
# pass through the filter eval code.
# Bypassing the filter_indices setter in ImageSource allows us
# create this source with absolutely *no* metadata.
# Otherwise, six default Relion columns are created w/defualt values
self.set_metadata("__filter_indices", np.zeros(self.n, dtype=int))
self.unique_filters = [IdentityFilter()]

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions