MieScatterer#
- class deeptrack.scatterers.MieScatterer(coefficients: Callable[[...], Callable[[int], Tuple[Tuple[T, ...] | List[T] | ndarray, Tuple[T, ...] | List[T] | ndarray]]], input_polarization=0, output_polarization=0, offset_z: str | Callable[[...], str] = 'auto', collection_angle: str | Callable[[...], str] = 'auto', L: str | Callable[[...], str] = 'auto', refractive_index_medium=None, wavelength=None, NA=None, padding=(0, 0, 0, 0), output_region=None, polarization_angle=None, working_distance=1000000, position_objective=(0, 0), return_fft=False, coherence_length=None, illumination_angle=0, amp_factor=1, phase_shift_correction=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 beprecise, 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.
Parameters#
- coefficientsCallable[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.
- Lint or str
The number of terms used to evaluate the mie theory. If “auto”, it determines the number of terms automatically.
- positionarray_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.
- zfloat
The position in the direction normal to the camera plane. Used if position is of length 2.
- return_fftbool
If True, the feature returns the fft of the field, rather than the field itself.
- coherence_lengthfloat
The temporal coherence length of a partially coherent light given in meters. If None, the illumination is assumed to be coherent.
- amp_factorfloat
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_correctionbool
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, ...)Transform an image [abstract method].
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, voxel_size, padding, wavelength, refractive_index_medium, L, collection_angle, input_polarization, output_polarization, coefficients, offset_z, z, working_distance, position_objective, return_fft, coherence_length, output_region, illumination_angle, amp_factor, phase_shift_correction, **kwargs)#
Transform an image [abstract method].
Abstract method that defines how the feature transforms the input. The current value of all properties will be passed as keyword arguments.
Parameters#
- image‘Image’ or List[‘Image’]
The Image or list of images to transform.
- **kwargsDict[str, Any]
The current value of all properties in properties as well as any global arguments.
Returns#
- ‘Image’ or List[‘Image’]
The transformed image or list of images.
Raises#
- NotImplementedError
Must be overridden by subclasses.
- get_XY(shape, voxel_size)#
- get_detector_mask(X, Y, radius)#
- get_plane_in_polar_coords(shape, voxel_size, plane_position, illumination_angle)#
- get_xy_size(output_region, padding)#