oap_model.ast_model module
- class oap_model.ast_model.ASTModel(opaque_shape: ndarray, wavenumber: float = 9548913.84069846, pixel_size: float = 1e-05)[source]
Bases:
objectAngular Spectrum Theory model.
A model to contain the diffraction behaviour of a single opaque object, exposed to a plane wave of light at a specific wavelength, and imaged using a specific pixel size.
- Parameters
opaque_shape (np.ndarray) – The shape of the opaque object in the z=0 plane.
wavenumber (float, optional) – The wavenumber of the light. Defaults to \(2\pi / \text{(658 nm)}\).
pixel_size (float, optional) – The size of the pixels in the opaque_shape. Defaults to 10 µm.
- classmethod from_diameter(diameter: float, wavenumber: float = None, pixel_size: float = None)[source]
Create a model for a circular opaque object.
- Parameters
diameter (float) – The diameter of the opaque object in micrometres.
wavenumber (float, optional) – The wavenumber of the light. Defaults to \(2\pi / \text{(658 nm)}\).
pixel_size (float, optional) – The size of the pixels in the opaque_shape. Defaults to 10 µm.
- Returns
The model.
- Return type
- classmethod from_diameter_rectangular(diameter: float, aspect_ratio: float, **kwargs)[source]
Create a model for a rectangular opaque object with a given diameter xy mean diameter and aspect ratio.
- classmethod from_diameter_rosette(diameter: float, n_rectangles: int, width: float = 40, wavenumber: float = None, pixel_size: float = None, **kwargs)[source]
Create a model for a rosette opaque object made up of n_rectangles opaque objects.
- classmethod from_rectangle(width: float, height: float, angle: float | tuple[float, float] = 0, wavenumber: float = None, pixel_size: float = None)[source]
Create a model for a rectangular opaque object.
- Parameters
width (float) – The width of the opaque object in micrometres.
height (float) – The height of the opaque object in micrometres.
angle (float) – The angle of the opaque object in degrees.
wavenumber (float, optional) – The wavenumber of the light. Defaults to \(2\pi / \text{(658 nm)}\).
pixel_size (float, optional) – The size of the pixels in the opaque_shape. Defaults to 10 µm.
- get_zd(z_val: float, diameter_type: str) float[source]
Calculate the dimensionless diffraction z distance.
The diffraction pattern for a particle (sized relative to the true diameter) is a function of the dimensionless diffraction z distance,
\[z_\text{D} = \frac{4 \pi z}{D^2}.\]- Parameters
z_val (float) – The distance of the the opaque_shape from the object plane.
diameter_type (str) – The type of diameter to use.
- Returns
The dimensionless diffraction z distance.
- Return type
float
- opaque_shape: ndarray
- pixel_size: float = 1e-05
- plot_intensity(z_val: int, **kwargs) Axes[source]
Plot the intensity at a given z
- Parameters
z (float) – The distance of the the opaque_shape from the object plane.
- process(z_val: float, low_pass=1.0) AmplitudeField[source]
Process the model, calculating the amplitude given the opaque shape is at z.
- Parameters
z_val (float) – The distance of the the opaque_shape from the object plane.
low_pass (float, optional) – The low pass filter to apply to the amplitude. Defaults to 1.0.
- Returns
The amplitude (transmission function) of the image at z.
- Return type
- process_range(z_range: ndarray) ndarray[source]
Process the model for offsetting the object at range of z values.
- Parameters
z_range (np.ndarray) – The range of z values to process.
- Returns
The intensity of the image at z.
- Return type
np.ndarray
- static rectangle(px_height, px_width, angle: float | tuple[float, float] = 0.0)[source]
Create a rectangular opaque object.
- Parameters
px_height (int) – The height of the opaque object in pixels.
px_width (int) – The width of the opaque object in pixels.
angle (float|tuple[float,float], optional) – The angle of the opaque object in degrees. Defaults to 0.
- Returns
The shape of the opaque object.
- Return type
np.ndarray
- regrid(pixel_size=1e-05)[source]
Regrid the model to a new pixel size.
Resamples the opaque object and any already-measured amplitude profiles to a new pixel size, such as one that matches the real detector.
- Parameters
pixel_size (float) – The pixel size to move to.
- rescale(diameter_scale_factor)[source]
Produce a new AST model for similar object at a different scale.
Scales the object, and any already-measured diameters or processed amplitude profiles by a given factor.
- Parameters
diameter_scale_factor (float) – The factor by which to scale the object’s diameter.
- Returns
The new AST model object.
- Return type
- wavenumber: float = 9548913.84069846