MieScatterer#

class deeptrack.scatterers.MieScatterer(coefficients, input_polarization: int | Callable[[...], int] = 0, output_polarization: int | Callable[[...], int] = 0, offset_z: str | Callable[[...], str] = 'auto', collection_angle: str | Callable[[...], str] = 'auto', L: str | Callable[[...], str] = 'auto', refractive_index_medium: float | None = None, wavelength: float | None = None, NA: float | None = None, padding=(0, 0, 0, 0), output_region=None, polarization_angle: float | None = None, working_distance: float = 1000000, position_objective: Tuple[float, float] = (0, 0), return_fft: bool = False, coherence_length: float | None = None, illumination_angle: float = 0, amp_factor: float = 1, phase_shift_correction: bool = False, **kwargs)#

Bases: Scatterer

Base implementation of a Mie particle.

New Mie-theory scatterers can be implemented by extending this class, and passing a function that calculates the coefficients of the harmonics up to order L. To be precise, the feature expects a wrapper function that takes the current values of the properties, as well as a inner function that takes an integer as the only parameter, and calculates the coefficients up to that integer. The return format is expected to be a tuple with two values, corresponding to an and bn. See deeptrack.backend.mie.coefficients for an example.

Attributes#

coefficients: Callable[int] -> Tuple[ndarray, ndarray]

Function that returns the harmonics coefficients.

offset_z: “auto” or float

Distance from the particle in the z direction the field is evaluated. If “auto”, this is calculated from the pixel size and collection_angle.

collection_angle: “auto” or float

The maximum collection angle in radians. If “auto”, this is calculated from the objective NA (which is true if the objective is the limiting aperature).

input_polarization: float or Quantity

Defines the polarization angle of the input. For simulating circularly polarized light we recommend a coherent sum of two simulated fields. For unpolarized light we recommend a incoherent sum of two simulated fields. If defined as “circular”, the coefficients are set to 1/2.

output_polarization: float or Quantity or None

If None, the output light is not polarized. Otherwise defines the angle of the polarization filter after the sample. For off-axis, keep the same as input_polarization. If defined as “circular”, the coefficients are multiplied by 1. I.e. no change.

L: int or str

The number of terms used to evaluate the mie theory. If “auto”, it determines the number of terms automatically.

position: array_like[float, float (, float)]

The position of the particle. Third index is optional, and represents the position in the direction normal to the camera plane.

z: float

The position in the direction normal to the camera plane. Used if position is of length 2.

return_fft: bool

If True, the feature returns the fft of the field, rather than the field itself.

coherence_length: float

The temporal coherence length of a partially coherent light given in meters. If None, the illumination is assumed to be coherent.

amp_factor: float

A factor that scales the amplification of the field. This is useful for scaling the field to the correct intensity. Default is 1.

phase_shift_correction: bool

If True, the feature applies a phase shift correction to the output field. This is necessary for ISCAT simulations. The correction depends on the k-vector and z according to the formula: arr*=np.exp(1j * k * z + 1j * np.pi / 2)

Methods Summary

get(inp, position, voxel_size, padding, ...)

Abstract method to initialize the Mie scatterer

get_XY(shape, voxel_size)

get_detector_mask(X, Y, radius)

get_plane_in_polar_coords(shape, voxel_size, ...)

get_xy_size(output_region, padding)

Methods Documentation

get(inp, position: Tuple[T, ...] | List[T] | ndarray, voxel_size: Tuple[T, ...] | List[T] | ndarray, padding: Tuple[int, ...] | List[int] | ndarray, wavelength: float, refractive_index_medium: float, L: int | str, collection_angle: float, input_polarization: float, output_polarization: float, coefficients, offset_z: float, z: float, working_distance: float, position_objective: float, return_fft: bool, coherence_length: float, output_region: Tuple[T, ...] | List[T] | ndarray, illumination_angle: float, amp_factor: float, phase_shift_correction: bool, **kwargs) Tuple[float, ...] | List[float] | ndarray#

Abstract method to initialize the Mie scatterer

get_XY(shape: Tuple[int, ...] | List[int] | ndarray, voxel_size: Tuple[int, ...] | List[int] | ndarray) Tuple[int, ...] | List[int] | ndarray#
get_detector_mask(X: float, Y: float, radius: float) Tuple[bool, ...] | List[bool] | ndarray#
get_plane_in_polar_coords(shape: int, voxel_size: Tuple[T, ...] | List[T] | ndarray, plane_position: float, illumination_angle: float) Tuple[float, float, float, float]#
get_xy_size(output_region: Tuple[T, ...] | List[T] | ndarray, padding: Tuple[int, ...] | List[int] | ndarray) Tuple[int, ...] | List[int] | ndarray#