manoharan-lab / holopy

Hologram processing and light scattering in python
GNU General Public License v3.0
136 stars 50 forks source link

Problems about Scattering Calculations for large distance #417

Open BnM-BnM opened 1 year ago

BnM-BnM commented 1 year ago

I am trying to use HoloPy code and change the distance of the particle from, for example, (50,50, 1000) to (50, 50, 1500); for the first case, the scattering pattern is totally fine and correct, but for the second case (50, 50, 1500) the code is running and gives me a pattern, but I think it is not correct anymore. I wondered if anyone has encountered this problem and if there is a convergence factor or any factor I could change to fix this problem. The first figure is correct which you can see below: z1000_s1

As you can see this plot is not consistent anymore and the intensity is way different. z1500_s1

vnmanoharan commented 1 year ago

What is the wavelength? And can you post the code used to calculate the scattering in both cases?

BnM-BnM commented 1 year ago

The wavelength I am using is 465 nm for a sphere with a radius 7.5 micrometres. I used this code to simulate scattering pattern just I changed the z parameter in both cases:

import holopy as hp from holopy.scattering import calc_holo, Sphere from holopy.scattering import Mie import matplotlib.pyplot as plt

sphere = Sphere(n=1.6, r=7.5, center=(100.0, 100.0, 1000.0))## (Refractive index, Radius in microns, Position in micron)

medium_index = 1.33 illum_wavelen = 0.465 illum_polarization = (1.0, 1.0) detector = hp.detector_grid(shape=200, spacing=1.0)

Create the scattering theory object

mie = Mie()

holo = calc_holo(detector, sphere, medium_index, illum_wavelen, illum_polarization, theory='auto') hp.show(holo)

vnmanoharan commented 10 months ago

@BnM-BnM sorry for the late reply. Because you're calculating the hologram at a distance many times the wavelength, you can use the far-field approximations to the Mie solutions to calculate the hologram, which will avoid the numerical issues you're seeing, and save time and computational effort.

import holopy as hp
from holopy.scattering import calc_holo, Sphere
from holopy.scattering import Mie
import matplotlib.pyplot as plt

sphere = Sphere(n=1.6, r=7.5, center=(100.0, 100.0, 1500.0))## (Refractive index, Radius in microns, Position in micron)

medium_index = 1.33
illum_wavelen = 0.465
illum_polarization = (1.0, 1.0)
detector = hp.detector_grid(shape=200, spacing=1.0)

# use far-field solutions
far_field_mie = Mie(compute_escat_radial=False, full_radial_dependence=False)

# make sure to specify the far-field theory; don't use 'auto' here
holo = calc_holo(detector, sphere, medium_index, illum_wavelen,illum_polarization, theory=far_field_mie)

hp.show(holo)
vnmanoharan commented 10 months ago

Leaving issue open because documentation should be updated to reflect this advice.