Utilities (pylorenzmie.utilities)#
- pylorenzmie.utilities.example_hologram.example_hologram(name='crop.png')[source]#
Return a normalized example hologram.
Loads an image from the package’s tutorials directory and returns it as a
Hologram.- Parameters:
name (str, optional) – Filename of the image in
docs/tutorials/. Default:'crop.png'.- Return type:
- Returns:
hologram (Hologram) – Hologram intensity divided by the background level (100 counts), shape
(height, width), dtypefloat64.
- class pylorenzmie.utilities.normalizer.Normalizer(method='median', size=51, reference=None)[source]#
Bases:
objectNormalize a hologram image by its estimated background illumination.
- Parameters:
method (str) – Normalization method:
'median'(default)Divide by the scalar median of the image. Assumes spatially uniform illumination.
'filter'Estimate the background with a large-kernel median filter. Suppresses the rapidly-oscillating fringe pattern while preserving slow illumination variation. Requires no reference.
'reference'Divide by a prerecorded reference image or a scalar value. Gives the highest quality result when a background image is available.
size (int) – Kernel size (pixels) for the
'filter'method. Should exceed the largest fringe spacing expected in the holograms. Default: 51.reference (ndarray or float, optional) – Background for the
'reference'method: either an image array with the same shape as the input or a scalar intensity value.
- methods = ('filter', 'median', 'reference')#
Efficient approximation to a running median filter.
- class pylorenzmie.utilities.vmedian.VMedian(order=0, shape=None)[source]#
Bases:
objectRunning median of a video stream.
Computes an approximate running median using a hierarchical tree of 3-element median buffers. Each level reduces the update rate by a factor of 3, so a tree of depth
orderaccumulates3**(order + 1)frames before producing its first output.- Parameters:
order (int) – Depth of the median tree. Default: 0 (single 3-frame buffer).
shape (tuple of int, optional) – Shape
(height, width)of the input images.
- get(reshape=True)[source]#
Return the current median image.
- Parameters:
reshape (bool) – If True (default), return array with the original image shape. If False, return the flattened internal buffer.
- Return type:
- Returns:
median (ndarray)
Physical properties of water
- pylorenzmie.utilities.water.density(temperature=24.0)[source]#
Returns the density of water
Accounts for dependence of density on temperature
Source: CRC Handbook of Chemistry and Physics: Thermophysical properties of water and steam.
- Parameters:
temperature (float) – Temperature [celsius]. Default: 24.
- Return type:
- Returns:
density (float) – Density of water [kg/m^3].
- pylorenzmie.utilities.water.refractiveindex(wavelength=0.589, temperature=24)[source]#
Returns the refractive index of water
Accounts for dispersion and temperature dependence
Source: The International Association for the Properties of Water and Steam (IAPWS), Release on the Refractive Index of Ordinary Water Substance as a Function of Wavelength, Temperature and Pressure (1997) http://www.iapws.org/relguide/rindex.pdf
- Parameters:
wavelength (float or ndarray) – Wavelength of light [μm]. Default: 0.589 (sodium D line).
temperature (float) – Temperature of water [celsius]. Default: 24.
- Return type:
- Returns:
n (float or ndarray) – Refractive index of water at the specified wavelength and temperature.