def test_ps(): imagepath = get_example_data_path('ps_image01.jpg') bgpath = get_example_data_path('ps_bg01.jpg') L = 0.0407 # distance from light source to screen cam_spacing = 12e-6 # linear size of camera pixels mag = 9.0 # magnification npix_out = 1020 # linear size of output image (pixels) zstack = [1.08e-3, 1.18e-3] # distances from camera to reconstruct holo = load_image(imagepath, spacing=cam_spacing, illum_wavelen=406e-9, medium_index=1) # load hologram bg = load_image(bgpath, spacing=cam_spacing) # load background image holo = bg_correct(holo, bg+1, bg) # subtract background holo = subimage(holo,[250,500],300) beam_c = center_of_mass(bg.values.squeeze()) # get beam center simplefilter('ignore') recons = ps_propagate(holo, zstack, L, beam_c) # do propagation verify(recons, 'ps_recon')
from holopy.core.io import get_example_data_path, load_average from holopy.core.process import bg_correct from scipy.ndimage import measurements from holopy.scattering import Spheres from holopy.scattering import calc_holo, Sphere imagepath = get_example_data_path('image01.jpg') raw_holo = hp.load_image( imagepath, spacing=0.0851, medium_index=1.33, illum_wavelen=0.66, ) bgpath = get_example_data_path(['bg01.jpg', 'bg02.jpg', 'bg03.jpg']) bg = load_average(bgpath, refimg=raw_holo) holo = bg_correct(raw_holo, bg) z = [17.5, 20, 27] x = np.linspace(1, 512, 1000) p1 = np.angle(np.e**(-1j * 2 * np.pi * z[0] / (0.66 / 1.33))) p2 = np.angle(np.e**(-1j * 2 * np.pi * z[1] / (0.66 / 1.33))) p3 = np.angle(np.e**(-1j * 2 * np.pi * z[2] / (0.66 / 1.33))) rec_vol1 = hp.propagate(holo, z[0]) rec_vol2 = hp.propagate(holo, z[1]) rec_vol3 = hp.propagate(holo, z[2]) amp1 = np.abs(rec_vol1[:, 253, :]) amp2 = np.abs(rec_vol2[:, 253, :]) amp3 = np.abs(rec_vol3[:, 253, :])
import numpy as np import holopy as hp from holopy.core.io import get_example_data_path, load_average from holopy.core.process import bg_correct imagepath = get_example_data_path('image01.jpg') raw_holo = hp.load_image(imagepath, spacing = 0.0851, medium_index = 1.33, illum_wavelen = 0.66, ) bgpath = get_example_data_path(['bg01.jpg','bg02.jpg','bg03.jpg']) bg = load_average(bgpath, refimg = raw_holo) holo = bg_correct(raw_holo, bg) zstack = np.linspace(0, 20, 11) rec_vol = hp.propagate(holo, zstack) hp.show(rec_vol)