oap_model.intensity module
- class oap_model.intensity.AmplitudeField(field: ndarray, pixel_size: float = 1e-05)[source]
Bases:
objectA class to represent an amplitude field.
Uses the numpy array as a base class, adding the pixel size attribute, storing a grid of phases from a single interaction
- Parameters
np.ndarray – The amplitude field
- embed(single_particle_amplitude, particle, detector_position)[source]
Embed the intensity profile of a particle into the total intensity array.
- field: ndarray
- property intensity
The intensity field.
- property phase
The phase field.
- pixel_size: float = 1e-05
- class oap_model.intensity.IntensityField(field: ndarray, pixel_size: float = 1e-05)[source]
Bases:
objectA class to represent an intensity field.
Uses the numpy array as a base class, adding the pixel size attribute, plotting methods, and measurement methods.
- Parameters
np.ndarray – The intensity field
- field: ndarray
- frames(threshold=0.5) Generator[Self, None, None][source]
Split the intensity field into frames.
- Parameters
threshold (float, optional) – The threshold to use to split the frames. Defaults to 0.5.
- Yields
Generator[Self, None, None] – The intensity field for each frame.
- measure_diameters(threshold=0.5, bounded=False, filled=False, diameter_method='xy') dict[source]
Measure the diameters of all connected regions in the image.
- Returns
The list of (diameter/µm, position/px) couples.
- Return type
dict
- n_pixels_depletion_range(min_dep: float, max_dep: float) int[source]
Calculate the number of pixels in the depletion range
- Parameters
min_dep (float) – The minimum depletion value.
max_dep (float) – The maximum depletion value.
- Returns
The number of pixels in the depletion range.
- Return type
int
- pixel_size: float = 1e-05
- plot(ax: Axes = None, axis_length: float = None, grayscale_bounds: list[float] = None, colorbar: bool = False, **kwargs) Axes[source]
Plot the intensity field.
- Parameters
ax (matplotlib.axes.Axes) – The axis to plot on.
axis_length (float) – The axis_length of the object in micrometres.
grayscale_bounds (list) – The list of bounds for grayscale bands. When None, the intensity is plotted.
- Returns
The plotted image.
- Return type
matplotlib.image.Axes
- oap_model.intensity.plot_outline(mapimg, ax=None)[source]
From https://stackoverflow.com/questions/24539296/outline-a-region-in-a-graph/24540564#24540564