def feature_extent(sphere, config, nfringes=20): '''Radius of holographic feature in pixels''' s = Sphere() s.a_p = sphere.a_p s.n_p = sphere.n_p s.z_p = sphere.z_p h = LMHologram(coordinates=np.arange(300)) h.instrument.properties = config['instrument'] h.particle = sphere # roughly estimate radii of zero crossings b = h.hologram() - 1. ndx = np.where(np.diff(np.sign(b)))[0] + 1 return float(ndx[nfringes])
from pylorenzmie.theory.Instrument import Instrument from pylorenzmie.theory.Sphere import Sphere import matplotlib.pyplot as plt # Create coordinate grid for image x = np.arange(0, 201) y = np.arange(0, 201) xv, yv = np.meshgrid(x, y) xv = xv.flatten() yv = yv.flatten() zv = np.zeros_like(xv) coordinates = np.stack((xv, yv, zv)) # Place a sphere in the field of view, above the focal plane particle = Sphere() particle.r_p = [125, 75, 100] particle.a_p = 0.5 particle.n_p = 1.45 # Form image with default instrument instrument = Instrument() instrument.magnification = 0.135 instrument.wavelength = 0.447 instrument.n_m = 1.335 k = instrument.wavenumber() # Use Generalized Lorenz-Mie theory to compute field kernel = CudaGeneralizedLorenzMie(coordinates=coordinates, particle=particle, instrument=instrument) field = kernel.field() # Compute hologram from field and show it field *= np.complex64(np.exp(-1.j * k * particle.z_p)) field[0, :] += 1.