Skip to main content

Mie scattering of a plane wave by a sphere

Project description

https://img.shields.io/pypi/v/miepython.svg https://colab.research.google.com/assets/colab-badge.svg https://img.shields.io/badge/readthedocs-latest-blue.svg https://img.shields.io/badge/github-code-green.svg https://img.shields.io/badge/MIT-license-yellow.svg https://github.com/scottprahl/miepython/actions/workflows/test.yml/badge.svg

miepython is a pure Python module to calculate light scattering by non-absorbing, partially-absorbing, or perfectly conducting spheres. Mie theory is used, following the procedure described by Wiscombe. This code has been validated against his results.

This code provides functions for calculating the extinction efficiency, scattering efficiency, backscattering, and scattering asymmetry. Moreover, a set of angles can be given to calculate the scattering for a sphere.

Pay Attention!

When comparing different Mie scattering codes, make sure that you’re aware of the conventions used by each code. miepython makes the following assumptions

  1. the imaginary part of the complex index of refraction for absorbing spheres is negative.

  2. the scattering phase function is normalized so it equals the single scattering albedo when integrated over 4π steradians.

Using miepython

  1. You can install locally using pip:

    pip install --user miepython
  2. or run this code in the cloud using Google Collaboratory by selecting the Jupyter notebook that interests you.

An example

The following code:

import miepython

m = 1.5-1j
x = 1
qext, qsca, qback, g = miepython.mie(m,x)

print("The extinction efficiency  is %.3f" % qext)
print("The scattering efficiency  is %.3f" % qsca)
print("The backscatter efficiency is %.3f" % qback)
print("The scattering anisotropy  is %.3f" % g)

should produce:

The extinction efficiency  is 2.336
The scattering efficiency  is 0.663
The backscatter efficiency is 0.573
The scattering anisotropy  is 0.192

Here are a few short scripts in the github repository.

Detailed documentation is available at <https://miepython.readthedocs.io>

License

miepython is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

miepython-2.1.0.tar.gz (15.4 kB view details)

Uploaded Source

File details

Details for the file miepython-2.1.0.tar.gz.

File metadata

  • Download URL: miepython-2.1.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.5

File hashes

Hashes for miepython-2.1.0.tar.gz
Algorithm Hash digest
SHA256 75659400a84010a30a898772a1b74dcd8db14453739354d0095f2af839551a65
MD5 4de255df9d165664ad74cf9731b2f696
BLAKE2b-256 16cad9b0a6b264c0540ca267d5959a6725bed93407229ccffe812d9107317337

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page