Problem 1: Simulating Optical Density Measurements¶


Assume bacteria are shaped like spheres of a certain radius $r > 0$. Further, assume that if light hits a bacteria, it is scattered into a random direction.

a) Write code that allows you to:

  1. Initalize a certain number of non-overlapping particles (spheres) in a 2D volume of size $1 \times 1$. Make sure that spheres do not overlap.
  2. Simulate scattering of light by following ray traces emitted form the left in parallel. You can assume that they scatter in a random direction upon hitting a particle.
  3. Simulate capturing ray traces through a hole of size $h > 0$ within distance $\ell > 0$ to the testing volume.
Show hint
You can use Python libraries for this, but we suggest to code it directly.

b) Plot the OD that you measure as a function of the number of spheres. What happens if you change the size of the hole.

Show hint
The OD is the log of the captured intensity. The curve will likely flatten off due to multiple scattering effects.

License: © 2025 Matthias Függer and Thomas Nowak. Licensed under CC BY-NC-SA 4.0.