Configuring an image¤
The AbstractImageConfig is an object at the core of simulating images in cryojax. It stores a configuration for the simulated image and the electron microscope, such as the shape of the desired image and the wavelength of the incident electron beam.
cryojax.simulator.AbstractImageConfig
cryojax.simulator.AbstractImageConfig
¤
Configuration and utilities for an electron microscopy image.
__abstractclassvars__
class
¤
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
__abstractmethods__
class
¤
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
__abstractvars__
class
¤
frozenset() -> empty frozenset object frozenset(iterable) -> frozenset object
Build an immutable unordered collection of unique elements.
__annotations__
class
¤
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
__dataclass_fields__
class
¤
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
__dataclass_params__
class
¤
__doc__
class
¤
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
__match_args__
class
¤
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
__module__
class
¤
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
coordinate_grid_in_angstroms
property
¤
coordinate_grid_in_pixels
property
¤
frequency_grid_in_angstroms
property
¤
frequency_grid_in_pixels
property
¤
full_frequency_grid_in_angstroms
property
¤
full_frequency_grid_in_pixels
property
¤
interaction_constant
property
¤
The electron interaction constant at the given voltage_in_kilovolts.
lorentz_factor
property
¤
The lorenz factor at the given voltage_in_kilovolts.
n_pixels
property
¤
Convenience property for math.prod(shape)
padded_coordinate_grid_in_angstroms
property
¤
padded_coordinate_grid_in_pixels
property
¤
padded_frequency_grid_in_angstroms
property
¤
padded_frequency_grid_in_pixels
property
¤
padded_full_frequency_grid_in_angstroms
property
¤
padded_full_frequency_grid_in_pixels
property
¤
padded_n_pixels
property
¤
Convenience property for math.prod(padded_shape)
padded_x_dim
property
¤
Convenience property for padded_shape[1]
padded_y_dim
property
¤
Convenience property for padded_shape[0]
wavelength_in_angstroms
property
¤
The incident electron wavelength corresponding to the beam
energy voltage_in_kilovolts.
x_dim
property
¤
Convenience property for shape[1]
y_dim
property
¤
Convenience property for shape[0]
__check_init__()
¤
__init__()
¤
Initialize self. See help(type(self)) for accurate signature.
get_coordinate_grid(*, padding: bool = False, physical: bool = True)
¤
Return the image coordinate system. See
cryojax.ndimage.make_coordinate_grid for more
information.
Arguments:
padding: IfTrue, return coordinates with shapeimage_config.padded_shape. Otherwise, return with shapeimage_config.shape.physical: IfTrue, return coordinates in units of angstroms. Otherwise, return on the unit box.
Returns:
The coordinate grid.
get_frequency_grid(*, padding: bool = False, physical: bool = True, full: bool = False)
¤
Return a grid of FFT frequencies. See
[cryojax.ndimage.make_frequency_grid] for more
information.
Arguments:
padding: IfTrue, return frequencies corresponding to shapeimage_config.padded_shape. Otherwise, useimage_config.shape.physical: IfTrue, return frequencies in units of inverse angstroms. Otherwise, return unitless where Nyquist is equal to 0.5.full: IfTrue, return the full plane of frequencies for usage withjax.numpy.fft.fftn. Otherwise, return the half plane for usage withjax.numpy.fft.rfftn.
Returns:
The frequency grid.
cryojax.simulator.BasicImageConfig(cryojax.simulator.AbstractImageConfig)
¤
Configuration and utilities for a basic electron microscopy image.
wavelength_in_angstroms
property
¤
The incident electron wavelength corresponding to the beam
energy voltage_in_kilovolts.
lorentz_factor
property
¤
The lorenz factor at the given voltage_in_kilovolts.
interaction_constant
property
¤
The electron interaction constant at the given voltage_in_kilovolts.
n_pixels
property
¤
Convenience property for math.prod(shape)
y_dim
property
¤
Convenience property for shape[0]
x_dim
property
¤
Convenience property for shape[1]
padded_n_pixels
property
¤
Convenience property for math.prod(padded_shape)
padded_y_dim
property
¤
Convenience property for padded_shape[0]
padded_x_dim
property
¤
Convenience property for padded_shape[1]
__init__(shape: tuple[int, int], pixel_size: cryojax.jax_util.FloatLike, voltage_in_kilovolts: cryojax.jax_util.FloatLike, *, padded_shape: tuple[int, int] | None = None, precompute_mode: Literal['none', 'rfft', 'fft', 'all', 'compile_time_eval'] = 'none')
¤
Arguments:
shape: Shape of the imaging plane in pixels.pixel_size: The pixel size of the image in angstroms.voltage_in_kilovolts: The incident energy of the electron beam.padded_shape: The shape of the image after padding. By default, equal toshape.precompute_mode: How to pre-compute coordinate and frequency grids stored in theimage_config. Options are- 'none': Compute grids at runtime and cache the result.
- 'rfft':
Only precompute frequencies
in the Fourier domain for a real-valued function (i.e.
for use with
jax.numpy.fft.rfftn). This is the best option for most use cases. - 'fft':
Precompute frequencies
in the Fourier domain for both real and complex-valued functions
(i.e. for use with
jax.numpy.fft.rfftnandjax.numpy.fft.fftn). Relevant for use with Ewald sphere extraction. - 'all': Precompute all grids in both real-space and frequency-space.
- 'compile_time_eval':
Evaluate grids as needed at compile time using
jax.ensure_compile_time_eval.
get_coordinate_grid(*, padding: bool = False, physical: bool = True)
¤
Return the image coordinate system. See
cryojax.ndimage.make_coordinate_grid for more
information.
Arguments:
padding: IfTrue, return coordinates with shapeimage_config.padded_shape. Otherwise, return with shapeimage_config.shape.physical: IfTrue, return coordinates in units of angstroms. Otherwise, return on the unit box.
Returns:
The coordinate grid.
get_frequency_grid(*, padding: bool = False, physical: bool = True, full: bool = False)
¤
Return a grid of FFT frequencies. See
[cryojax.ndimage.make_frequency_grid] for more
information.
Arguments:
padding: IfTrue, return frequencies corresponding to shapeimage_config.padded_shape. Otherwise, useimage_config.shape.physical: IfTrue, return frequencies in units of inverse angstroms. Otherwise, return unitless where Nyquist is equal to 0.5.full: IfTrue, return the full plane of frequencies for usage withjax.numpy.fft.fftn. Otherwise, return the half plane for usage withjax.numpy.fft.rfftn.
Returns:
The frequency grid.
cryojax.simulator.DoseImageConfig(cryojax.simulator.AbstractImageConfig)
¤
Configuration and utilities for an electron microscopy image, including the electron dose.
wavelength_in_angstroms
property
¤
The incident electron wavelength corresponding to the beam
energy voltage_in_kilovolts.
lorentz_factor
property
¤
The lorenz factor at the given voltage_in_kilovolts.
interaction_constant
property
¤
The electron interaction constant at the given voltage_in_kilovolts.
n_pixels
property
¤
Convenience property for math.prod(shape)
y_dim
property
¤
Convenience property for shape[0]
x_dim
property
¤
Convenience property for shape[1]
padded_n_pixels
property
¤
Convenience property for math.prod(padded_shape)
padded_y_dim
property
¤
Convenience property for padded_shape[0]
padded_x_dim
property
¤
Convenience property for padded_shape[1]
__init__(shape: tuple[int, int], pixel_size: cryojax.jax_util.FloatLike, voltage_in_kilovolts: cryojax.jax_util.FloatLike, electron_dose: cryojax.jax_util.FloatLike, *, padded_shape: tuple[int, int] | None = None, precompute_mode: Literal['none', 'rfft', 'fft', 'all', 'compile_time_eval'] = 'none')
¤
Arguments:
shape: Shape of the imaging plane in pixels.pixel_size: The pixel size of the image in angstroms.voltage_in_kilovolts: The incident energy of the electron beam.electron_dose: The integrated dose rate of the electron beam in \(e^-/A^2\)padded_shape: The shape of the image after padding. By default, equal toshape.precompute_mode: How to pre-compute coordinate and frequency grids stored in theimage_config. Options are- 'none': Compute grids at runtime and cache the result.
- 'rfft':
Only precompute frequencies
in the Fourier domain for a real-valued function (i.e.
for use with
jax.numpy.fft.rfftn). This is the best option for most use cases. - 'fft':
Precompute frequencies
in the Fourier domain for both real and complex-valued functions
(i.e. for use with
jax.numpy.fft.rfftnandjax.numpy.fft.fftn). Relevant for use with Ewald sphere extraction. - 'all': Precompute all grids in both real-space and frequency-space.
- 'compile_time_eval':
Evaluate grids as needed at compile time using
jax.ensure_compile_time_eval.
get_coordinate_grid(*, padding: bool = False, physical: bool = True)
¤
Return the image coordinate system. See
cryojax.ndimage.make_coordinate_grid for more
information.
Arguments:
padding: IfTrue, return coordinates with shapeimage_config.padded_shape. Otherwise, return with shapeimage_config.shape.physical: IfTrue, return coordinates in units of angstroms. Otherwise, return on the unit box.
Returns:
The coordinate grid.
get_frequency_grid(*, padding: bool = False, physical: bool = True, full: bool = False)
¤
Return a grid of FFT frequencies. See
[cryojax.ndimage.make_frequency_grid] for more
information.
Arguments:
padding: IfTrue, return frequencies corresponding to shapeimage_config.padded_shape. Otherwise, useimage_config.shape.physical: IfTrue, return frequencies in units of inverse angstroms. Otherwise, return unitless where Nyquist is equal to 0.5.full: IfTrue, return the full plane of frequencies for usage withjax.numpy.fft.fftn. Otherwise, return the half plane for usage withjax.numpy.fft.rfftn.
Returns:
The frequency grid.