Skip to main content

by Scott Prahl

pypi conda doi

License Testing Docs Downloads

iadpython will be a pure Python module to do forward and inverse multiple light scattering (radiative transport) in layered materials. Calculations are done using van de Hulst’s adding-doubling technique.

The original adding-doubling algorithm was developed by van de Hulst to model light propagation through layered media. I extended it to handle Fresnel reflection at boundaries as well as interactions with integrating spheres.

Finally, the code was further extended to handle lost light using Monte Carlo techniques for inverse calculations.

Version v0.4.0 started the migration to a pure-python implementation. This version includes the ability to do forward calculations of light transport through layered 1D structures.

The long-term goal is rewrite the integrating sphere, inverse algorithm, and lost light calculations in pure python so that one can do inverse calculations (i.e., reflection and transmission measurements to intrinsic absorption and scattering properties).

Both inverse and forward calculations are currently possible using the iadc framework. This is a python interface to the inverse adding-doubling package written in C by Scott Prahl <https://github.com/scottprahl/iad>. This works now but is a nuisance to install and maintain because of its dependence on compiling and installing a C library.

See <https://iadpython.readthedocs.io> for full documentation of iadpython.

Usage

The following will do a forward calculation:

import iadpython as iad

mu_s = 10  # scattering coefficient [1/mm]
mu_a = 0.1 # absorption coefficient [1/mm]
g = 0.9    # scattering anisotropy
d = 1      # thickness mm

a = mu_s/(mu_a+mu_s)
b = mu_s/(mu_a+mu_s) * d

# air / glass / sample / glass / air
s = iadpython.Sample(a=a, b=b, g=g, n=1.4, n_above=1.5, n_below=1.5)
ur1, ut1, uru, utu = s.rt()

print('Collimated light incident perpendicular to sample')
print('  total reflection = %.5f' % ur1)
print('  total transmission = %.5f' % ut1)

print('Diffuse light incident on sample')
print('  total reflection = %.5f' % uru)
print('  total transmission = %.5f' % utu)

Installation

Use pip:

pip install iadpython

If you just want to do forward calculations then you’re done.

If you want to do inverse calculations, then you’ll need to build and install the libiad library:

git clone https://github.com/scottprahl/iad.git
cd iad
# edit Makefile as needed
make install-lib

Dependencies

Required Python modules: numpy, matplotlib, ctypes, scipy

License

iadpython is licensed under the terms of the MIT license.

Release files for iadpython 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iadpython 0.5.3
File Size Uploaded
iadpython-0.5.3.tar.gz 2.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for iadpython 0.5.3
File Interpreter ABI Platform
iadpython-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 2.6 MB

Release files / iadpython-0.5.3.tar.gz

Download URL iadpython-0.5.3.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
9efa69677a22450c140c4d13bd30b4f066a3158731c3a4497a7a989bac1dbc4a
BLAKE2b-256 checksum
How to use checksums
8ca9bd81ac773ea970cd640a1f85d774b1f6eed0a2173e5664adb5d06a6360e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / iadpython-0.5.3-py3-none-any.whl

Download URL iadpython-0.5.3-py3-none-any.whl
Size 40.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d6065e43ffc2b2819be926ad84b696f3f135a1e39bfd9c66027a1c26e5016a6
BLAKE2b-256 checksum
How to use checksums
c6ce0059cce71767ff796bda53aad8767a1f9b7b159a2542e1cb19312f68c13c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page