holopy.propagation package¶
Submodules¶
Code to propagate objects/waves using scattering models.
-
propagate
(data, d, medium_index=None, illum_wavelen=None, cfsp=0, gradient_filter=False)¶ Propagates a hologram along the optical axis
Parameters: - data (xarray.DataArray) – Hologram to propagate
- d (float or list of floats) – Distance to propagate or desired schema. A list tells to propagate to several distances and return the volume
- cfsp (integer (optional)) – Cascaded free-space propagation factor. If this is an integer > 0, the transfer function G will be calculated at d/csf and the value returned will be G**csf. This helps avoid artifacts related to the limited window of the transfer function
- gradient_filter (float) – For each distance, compute a second propagation a distance gradient_filter away and subtract. This enhances contrast of rapidly varying features. You may wish to use the number that is a multiple of the medium wavelength (illum_wavelen / medium_index)
Returns: data – The hologram progagated to a distance d from its current location.
Return type: xarray.DataArray
Notes
holopy is agnostic to units, and the propagation result will be correct as long as the distance and wavelength are in the same units.
-
trans_func
(schema, d, med_wavelen, cfsp=0, gradient_filter=0)¶ Calculates the optical transfer function to use in reconstruction
This routine uses the analytical form of the transfer function found in in Kreis [1]. It can optionally do cascaded free-space propagation for greater accuracy [2], although the code will run slightly more slowly.
Parameters: - schema (xarray.DataArray) – Hologram to obtain the maximum dimensions of the transfer function
- d (float or list of floats) – Reconstruction distance. If list or array, this function will return an array of transfer functions, one for each distance
- med_wavelen (float) – The wavelength in the medium you are propagating through
- cfsp (integer (optional)) – Cascaded free-space propagation factor. If this is an integer > 0, the transfer function G will be calculated at d/csf and the value returned will be G**csf
- gradient_filter (float (optional)) – Subtract a second transfer function a distance gradient_filter from each z
Returns: trans_func – The calculated transfer function. This will be at most as large as shape, but may be smaller if the frequencies outside that are zero
Return type: xarray.DataArray
References
[1] Kreis, Handbook of Holographic Interferometry (Wiley, 2005), equation 3.79 (page 116) [2] Kreis, Optical Engineering 41(8):1829, section 5
-
interpolate2D
(data, i, j, fill=None)¶ Interpolates values from a 2D array (data) given non-integer indecies i and j. If [i,j] is outside of the shape of data, fill is returned. If fill=None, the value of the closest edge pixel to (i,j) is used.
-
ps_propagate
(data, d, L, beam_c, out_schema=None)¶ Propagates light back through a hologram that was taken using a diverging reference beam.
Parameters: - is a holopy Xarray. It is the hologram to reconstruct. Must be (data) –
- The pixel spacing must also be square. (square.) –
- = distance from pinhole to reconstructed image, in meters (this is (d) –
- in Jericho and Kreuzer) Can be a scalar or a 1D list or array. (z) –
- = distance from screen to pinhole, in meters (L) –
- = [x,y] coodinates of beam center, in pixels (beam_c) –
- = size of output image and pixel spacing, default is the schema (out_schema) –
- data. (of) –
Returns: Return type: an image(volume) corresponding to the reconstruction at plane(s) d.
Notes
Only propagation through media with refractive index 1 is supported. This is a wrapper function for ps_propagate_plane() This function can handle a single reconstruction plane or a volume.
Based on the algorithm described in Manfred H. Jericho and H. Jurgen Kreuzer, “Point Source Digital In-Line Holographic Microscopy,” Chapter 1 of Coherent Light Microscopy, Springer, 2010. http://link.springer.com/chapter/10.1007%2F978-3-642-15813-1_1
-
ps_propagate_plane
(data, d, L, beam_c, out_schema=None, old_Ip=False)¶ Propagates light back through a hologram that was taken using a diverging reference beam.
Parameters: - is a holopy Xarray. It is the hologram to reconstruct. Must be square. (data) –
- pixel spacing must also be square. (The) –
- = distance from pinhole to reconstructed image, in meters (this is z in (d) –
- and Kreuzer) Must be a scalar. (Jericho) –
- = distance from screen to pinhole, in meters (L) –
- = [x,y] coodinates of beam center, in pixels (beam_c) –
- = size of output image and pixel spacing, default is the schema (out_schema) –
- data. (of) –
- Ip == True, returns Ip to be used on calculations in the stack (if) –
- Ip == False compute reconstructed image as normal (if) –
- Ip is an image, use this to speed up calculations (if) –
Returns: Return type: returns an image(volume) corresponding to the reconstruction at plane(s) d.
Notes
Propataion can be to one plane only. Only propagation through media with refractive index 1 is supported.
Based on the algorithm described in Manfred H. Jericho and H. Jurgen Kreuzer, “Point Source Digital In-Line Holographic Microscopy,” Chapter 1 of Coherent Light Microscopy, Springer, 2010. http://link.springer.com/chapter/10.1007%2F978-3-642-15813-1_1