# BimSim

Figure: (left) The imaginary part of an EM field scattered by three spheres. (right) The field magnitude at the surface of each sphere shown as a 3D model.

### Description

BIM-Sim is a software package for simulating electromagnetic interactions with spherical scatterers. The software takes into account the entire imaging process, including (a) focusing optics used to produce an incident electromagnetic field, (b) the interaction of the incident field with multiple spheres, and (c) the focusing optics and detector used for imaging. The resulting electromagnetic field can be visualized in several ways, including color-mapped images and 3D surfaces.

BIM-Sim computes the electromagnetic field at the focal plane of the objective and at the image plane produced by the objective. This software can output images of the EM field in three ways: (a) collecting a slice of the field near the sample, (b) collecting a slice of the field at the image plane of the objective, and (c) collecting the signal measured by a detector placed at the image plane.

Input options for BIM-Sim can be found using:

>> bimsim --help

and I will discuss a few interesting examples below.

### Near-Field

The near-field is composed of three components: the incident field produced by a point source passing through focusing optics, the scattered field produced by spheres placed near the focal point, and the field inside each sphere. These three components are combined to form the resulting field for a single sphere:



where  is the near-field,  is the field inside a sphere,  is the focused field created by the source and focusing optics, and  is the field scattered by the sphere. The focused field  is computed analytically using Debye focusing. The scattered and internal fields are computed numerically using Monte-Carlo sampling.

One interesting problem that arises is determining the number of Monte-Carlo samples required to sufficiently resolve the scattered and incident fields. This can be estimated by creating a plane through a few spheres and looking at the interface between the internal and external fields. Since  is computed analytically, a discontinuity at the sphere surface can be seen if the number of Monte-Carlo samples is insufficient.

The above image was produced using 10, 100, and 1000 samples:

>> bimsim --sphere-file spheres.txt --samples 1000

### Far-Field

The field at the objective image plane is calculated by applying a band-pass filter to  based on the parameters of the objective. The following figure shows an image of a focused beam with two different settings for the condenser and objective. The first is a high-NA condenser and a low-NA objective, and the second is a Bessel beam produced by a condenser with a large central obscuration. The parameters specify the internal and external numerical aperatures of the condenser and objective. The internal (lower-case) NA is used to specify an obscuration as seen in a cassegrain or Schwartzchild objective:

>> bimsim -C 1.0 -O 0.7

>> bimsim -c 0.7 -C 0.9 -O 0.7

### Imaging and Extended Sources

The image measured by a detector is simulated by re-sampling the far-field based on the detector resolution. In addition, this allows the software to simulate extended (non-coherent) sources. Extended sources are created by simulating multiple point sources and integrating their intensity with the detector. In addition, this allows us to simulate transmittance  and absorbance  images by computing the ratio between the scattered and incident fields:





Here, the intensity image is calculated with  and without  the sample present.

In addition, an image of the extended source can be specified, allowing different sources (point, Gaussian, glowbar) to be simulated. The following figure shows an image of several spheres with different material properties imaged with an extended source specified by a JPEG image. The focusing and imaging optics are cassegrain objectives similar to what would be seen in a standard FT-IR imaging system.

>> bimsim -X einstein.jpg --materials 1.4 0.0 1.4 0.01 1.4 0.05 1.4 0.1 -S spheres.txt --samples 2000 -c 0.2 -C 0.6 -o 0.2 -O 0.6