Skip to content

Your entry point¤

cryojax.simulator.make_image_model ¤

make_image_model(volume_parametrization: cryojax.simulator.AbstractVolumeParametrization, image_config: cryojax.simulator.AbstractImageConfig, pose: cryojax.simulator.AbstractPose, transfer_theory: cryojax.simulator.ContrastTransferTheory | None = None, volume_integrator: cryojax.simulator.AbstractVolumeIntegrator = cryojax.simulator.AutoVolumeProjection(), detector: cryojax.simulator.AbstractDetector | None = None, *, transform: cryojax.ndimage.AbstractImageTransform | None = None, normalizes_signal: bool = False, signal_region: Bool[NDArrayLike, '_ _'] | None = None, signal_centering: Literal['bg', 'mean'] = 'mean', translate_mode: Literal['fft', 'atom', 'none'] = 'fft', quantity_mode: Literal['contrast', 'intensity', 'counts'] | None = None) -> cryojax.simulator.AbstractImageModel

Construct an cryojax.simulator.AbstractImageModel for most common use-cases.

Simulate an image

import cryojax.simulator as cxs

# Load modeling components
volume, image_config, pose, transfer_theory = ...
# Build image formation model
image_model = cxs.make_image_model(volume, image_config, pose, transfer_theory)
# Simulate!
image = image_model.simulate()

Arguments:

Warning

The pose given to make_image_model always represents a rotation of the object, not of the frame. Some volume projection methods (e.g. cryojax.simulator.FourierSliceExtraction) instead image a rotation of the frame, so if volume_parametrization is such a representation, the pose is transposed under the hood.

Rotations will still differ by a transpose if:

In these cases, it is necessary to manually transpose the pose by calling pose.to_inverse_rotation().

Returns:

A cryojax.simulator.AbstractImageModel with type


cryojax.simulator.load_tabulated_volume ¤

load_tabulated_volume(path_or_mmdf: str | pathlib.Path | pandas.DataFrame, *, output_type: type[cryojax.simulator.IndependentAtomVolume | cryojax.simulator.GaussianMixtureVolume] = cryojax.simulator.IndependentAtomVolume, tabulation: Literal['peng', 'lobato'] = 'peng', include_b_factors: bool = False, b_factor_fn: Callable[[cryojax.jax_util.NDArrayLike, cryojax.jax_util.NDArrayLike], cryojax.jax_util.NDArrayLike] = identity_fn, selection_string: str = 'all', pdb_options: dict[str, Any] = {}) -> cryojax.simulator.IndependentAtomVolume | cryojax.simulator.GaussianMixtureVolume

Load an atomistic representation of a volume from tabulated electron scattering factors.

Warning

This function cannot be used with JIT compilation. Rather, its output should be passed to JIT-compiled functions. For example:

import cryojax.simulator as cxs
import equinox as eqx

path_to_pdb = ...
volume = cxs.load_tabulated_volume(path_to_pdb)

@eqx.filter_jit
def simulate_fn(volume, ...):
    image_model = cxs.make_image_model(volume, ...)
    return image_model.simulate()

image = simulate_fn(volume, ...)

Arguments:

Returns:

A cryojax.simulator.AbstractVoxelVolume with exact type equal to output_type.


cryojax.simulator.render_voxel_volume ¤

render_voxel_volume(atom_volume: cryojax.simulator.AbstractAtomVolume, render_fn: cryojax.simulator.AbstractVolumeRenderFn, *, output_type: type[cryojax.simulator.FourierVoxelGridVolume | cryojax.simulator.FourierVoxelSplineVolume | cryojax.simulator.RealVoxelGridVolume] = cryojax.simulator.FourierVoxelGridVolume) -> cryojax.simulator.FourierVoxelGridVolume | cryojax.simulator.FourierVoxelSplineVolume | cryojax.simulator.RealVoxelGridVolume

Render a voxel volume representation from an atomistic one.

Simulate an image with Fourier slice extraction

import cryojax.simulator as cxs

# Simulate an image with Fourier slice extraction
voxel_volume = cxs.render_voxel_volume(
    atom_volume=cxs.load_tabulated_volume("example.pdb"),
    render_fn=cxs.AutoVolumeRenderFn(shape=(100, 100, 100), voxel_size=1.0),
    output_type=cxs.FourierVoxelGridVolume,
)
image_model = cxs.make_image_model(voxel_volume, ...)
image = image_model.simulate()

Arguments:

Returns:

A cryojax.simulator.AbstractVoxelVolume with exact type equal to output_type.