Skip to content

recovar.simulation

Synthetic dataset generation and forward-model image simulation for testing and validation.

simulator

Forward-model cryo-EM image simulation from atomic volumes.

recovar.simulation.simulator

Forward-model cryo-EM image simulation from atomic volumes.

kent_sampling_scheme(n_images, grid_size, seed=0, arguments=None)

Generate Kent (5-parameter Fisher-Bingham - FB5) distributed data on the unit sphere

:param numsamp: Number of samples to generate :type numsamp: int :param kappa: Concentration parameter :param beta: Ovalness parameter :param mu: Mean vector of Kent distribution :type mu: np.array :param mu0: Mean vector of the Fisher part :type mu0: np.array :return: Data dictionary of type 'cart' containing numsamp Kent distributed data :rtype: dict

cryo_rotation_batch(U, theta)

Build rotation matrices from viewing directions U and in-plane angles theta.

Inputs

U: array-like, shape (N,3) or (3,) Viewing/propagation directions (needn't be unit; will be normalized). theta: float or array-like In-plane rotation(s) in radians. Can be scalar or shape (N,).

Returns

R: ndarray, shape (N,3,3) or (3,3) if input was a single vector Rotation matrices whose columns are [a, b, u], where u is the normalized viewing direction and (a,b) is an orthonormal basis of the plane ⟂ u, rotated by theta (right-hand rule about +u).

generate_synthetic_dataset(output_folder, voxel_size, volumes_path_root, n_images, outlier_file_input=None, grid_size=128, volume_distribution=None, dataset_params_option='dataset1', noise_level=1.0, noise_model='radial1', put_extra_particles=True, percent_outliers=0.1, volume_radius=0.9, trailing_zero_format_in_vol_name=True, noise_scale_std=0.3, contrast_std=0.3, disc_type='linear_interp', n_tilts=-1, dose_per_tilt=3, angle_per_tilt=3, image_dtype=np.float16, image_offset_n_std=0.0, per_particle_contrast=True, premultiplied_ctf=False, noise_increase_per_tilt=None, create_nested_structure=False, nested_prefix='Extract/job193', percent_tilt_series_outliers=0.0, noise_rng_batch_size=None)

int, optional

Batch size used only to advance the random-noise stream. When omitted, it matches the image processing batch size. Supplying a fixed value keeps generated noise independent of GPU-memory-driven processing batch changes (issue #148 fix).

make_noise_batch_from_rng_stream(noise_subkeys, noise_rng_batch_size, batch_st, batch_end, n_images, noise_image, images_batch_shape)

Return noise for a processing batch from a fixed reference RNG stream.

The RNG stream is chunked by noise_rng_batch_size (independent of the processing batch_size). For a processing batch spanning [batch_st, batch_end), pulls the corresponding pieces from one or more RNG chunks and concatenates them. This decouples generated noise from GPU-memory-driven processing-batch shape changes (issue #148 fix).

simulate_batch(config, volume, rotation_matrices, translations, ctf_params, skip_ctf=False)

Simulate a batch of images from a volume — Equinox API.

Simulate a batch of cryo-EM images from a volume using the Equinox API.

synthetic_dataset

Synthetic heterogeneous dataset generation.

recovar.simulation.synthetic_dataset

Synthetic heterogeneous dataset generation for testing.

simulate_scattering_potential

Compute atomic scattering potentials from PDB structures.

recovar.simulation.simulate_scattering_potential

Created on Thu Sep 30 16:04:24 2021

@author: marcaurele

voltage_to_wavelength(voltage)

Convert from electron voltage to wavelength. :param voltage: float, The electron voltage in kV. :return: float, The electron wavelength in nm.