Hologram

class shampoo.Hologram(hologram, crop_fraction=None, wavelength=4.05e-07, rebin_factor=1, dx=3.45e-06, dy=3.45e-06, threads=2)[source] [edit on github]

Bases: object

Container for holograms and methods to reconstruct them.

Parameters:

hologram : ndarray

Input hologram

crop_fraction : float

Fraction of the image to crop for analysis

wavelength : float [meters]

Wavelength of laser

rebin_factor : int

Rebin the image by factor rebin_factor. Must be an even integer.

dx : float [meters]

Pixel width in x-direction (unbinned)

dy : float [meters]

Pixel width in y-direction (unbinned)

Notes

Non-square holograms will be cropped to a square with the dimensions of the smallest dimension.

Methods Summary

apodize(array[, alpha]) Force the magnitude of an array to go to zero at the boundaries.
Hologram.detect_specimens
fourier_peak_centroid(fourier_arr[, ...]) Calculate the centroid of the signal spike in Fourier space near the frequencies of the real image.
Hologram.fourier_trans_of_impulse_resp_func
from_tif(hologram_path, **kwargs) Load a hologram from a TIF file.
get_digital_phase_mask(psi[, plots]) Calculate the digital phase mask (i.e.
real_image_mask(center_x, center_y, radius) Calculate the Fourier-space mask to isolate the real image
reconstruct(propagation_distance[, ...]) Reconstruct the wave at propagation_distance.
Hologram.reconstruct_multithread

Methods Documentation

apodize(array, alpha=0.075)[source] [edit on github]

Force the magnitude of an array to go to zero at the boundaries.

Parameters:

array : ndarray

Array to apodize

alpha : float between zero and one

Alpha parameter for the Tukey window function. For best results, keep between 0.075 and 0.2.

Returns:

apodized_arr : ndarray

Apodized array

fourier_peak_centroid(fourier_arr, mask_radius=None, margin_factor=0.1, plot=False)[source] [edit on github]

Calculate the centroid of the signal spike in Fourier space near the frequencies of the real image.

Parameters:

fourier_arr : ndarray

Fourier-transform of the hologram

margin_factor : int

Fraction of the length of the Fourier-transform of the hologram to ignore near the edges, where spurious peaks occur there.

plot : bool

Plot the peak-centroiding visualization of the fourier transform of the hologram? Default is False.

Returns:

pixel : ndarray

Pixel at the centroid of the spike in Fourier transform of the hologram near the real image.

classmethod from_tif(hologram_path, **kwargs)[source] [edit on github]

Load a hologram from a TIF file.

This class method takes the path to the TIF file as the first argument. All other arguments are the same as Hologram.

Parameters:

hologram_path : str

Path to the hologram to load

get_digital_phase_mask(psi, plots=False)[source] [edit on github]

Calculate the digital phase mask (i.e. reference wave), as in Colomb et al. 2006, Eqn. 26 [R3].

Fit for a second order polynomial, numerical parametric lens with least squares to remove tilt, spherical aberration.

[R3]http://www.ncbi.nlm.nih.gov/pubmed/16512526
Parameters:

psi : ndarray

The product of the Fourier transform of the hologram and the Fourier transform of impulse response function

plots : bool

Display plots after calculation if True

Returns:

phase_mask : ndarray

Digital phase mask, used for correcting phase aberrations.

real_image_mask(center_x, center_y, radius)[source] [edit on github]

Calculate the Fourier-space mask to isolate the real image

Parameters:

center_x : int

x centroid [pixels] of real image in Fourier space

center_y : int

y centroid [pixels] of real image in Fourier space

radius : float

Radial width of mask [pixels] to apply to the real image in Fourier space

Returns:

mask : ndarray

Binary-valued mask centered on the real-image peak in the Fourier transform of the hologram.

reconstruct(propagation_distance, plot_aberration_correction=False, plot_fourier_peak=False, cache=False)[source] [edit on github]

Reconstruct the wave at propagation_distance.

If cache is True, the reconstructed wave will be cached onto the Hologram object for quick retrieval.

Parameters:

propagation_distance : float

Propagation distance [m]

plot_aberration_correction : bool

Plot the abberation correction visualization? Default is False.

plot_fourier_peak : bool

Plot the peak-centroiding visualization of the fourier transform of the hologram? Default is False.

cache : bool

Cache reconstructions onto the hologram object? Default is False.

Returns:

reconstructed_wave : ReconstructedWave

The reconstructed wave.