3. Basic Usage

biobeam makes use of highly parallelized propagation of light fields through biological media. What biobeam is unique for is the simulation of the image formation-process in tissue microscopy. For this, the user is free not to care about the details of how different simulations are combined to result in the final 3D images.

Nevertheless, the basic, GPU accelerated wave-optical routines of biobeam remain individually accessible as documented here.

3.1. GPU accelerated beam propagation

biobeam uses a GPU compatible beam propagation implementation with the precise, spherical propagator. Most fundamentally the associated routines are accessible by the Bpm3d class.

import biobeam

dn = ...
m = Bpm3d(dn = dn, units = (0.1,)*3, lam = 0.5)

# propagate a plane wave and return the intensity
u = m.propagate()

# propagate a bessel beam
u = m.propagate(u0 = m.u0_beam(NA = (.4,.42)))
class biobeam.Bpm3d(size=None, shape=None, units=None, dn=None, lam=0.5, n0=1.0, simul_xy=None, simul_z=1, n_volumes=1, enforce_subsampled=False, fftplan_kwargs={})

the main class for gpu accelerated bpm propagation

__init__(size=None, shape=None, units=None, dn=None, lam=0.5, n0=1.0, simul_xy=None, simul_z=1, n_volumes=1, enforce_subsampled=False, fftplan_kwargs={})
Parameters:
  • size ((Sx,Sy,Sz)) – the size of the geometry in microns (Sx,Sy,Sz)
  • shape ((Nx,Ny,Nz)) – the shape of the geometry in pixels (Nx,Ny,Nz)
  • units ((dx,dy,dz)) – the voxelsizes in microns (dx,dy,dz)
  • dn (ndarray (float32|complex64)) – refractive index distribution, dn.shape != (Nz,Ny,Nx)
  • lam (float) – the wavelength in microns
  • n0 (float) – the refractive index of the surrounding media
  • simul_xy ((Nx,Ny,Nz), optional) – the shape of the 2d computational geometry in pixels (Nx,Ny) (e.g. subsampling in xy)
  • simul_z (int, optional) – the subsampling factor along z
  • n_volumes (int) – splits the domain into chunks if GPU memory is not large enough (will be set automatically)

Example

>>> m = Bpm3d(size = (10,10,10),shape = (256,256,256),units = (0.1,0.1,0.1),lam = 0.488,n0 = 1.33)
aberr_at(NA=0.4, center=(0, 0, 0), n_zern=20, n_integration_steps=200, prop_kwargs={})

c = (cx,cy,cz) in relative pixel coordinates wrt the center

returns phi, zern

aberr_field_grid(NA, cxs, cys, cz, n_zern=20, n_integration_steps=200)

cxs, cys are equally spaced 1d arrays defining the grid

propagate(u0=None, offset=0, return_comp='field', return_shape='full', free_prop=False, dn_mean_method='none', **kwargs)
kwargs:
return_comp in [“field”, “intens”] return_shape in [“last”, “full”] free_prop = False | True dn_mean_method = “none”, “global”, “local”
u0_lattice(center=(0, 0), zfoc=None, NA1=0.4, NA2=0.5, sigma=0.1, kpoints=6, n_integration_steps=300)

see help for biobeam.focus_field_lattice_plane