miepython


Namemiepython JSON
Version 2.5.4 PyPI version JSON
download
home_pagehttps://github.com/scottprahl/miepython
SummaryMie scattering of a plane wave by a sphere
upload_time2024-05-07 23:40:16
maintainerNone
docs_urlNone
authorScott Prahl
requires_python>=3.7
licenseMIT
keywords mie scattering rainbow droplet backscatter sphere nanoparticle sphere cloud phase function efficiency rayleigh backscattering
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. |pypi-badge| image:: https://img.shields.io/pypi/v/miepython?color=68CA66
   :target: https://pypi.org/project/miepython/
   :alt: pypi

.. |github-badge| image:: https://img.shields.io/github/v/tag/scottprahl/miepython?label=github&color=68CA66
   :target: https://github.com/scottprahl/miepython
   :alt: github

.. |conda-badge| image:: https://img.shields.io/conda/vn/conda-forge/miepython?label=conda&color=68CA66
   :target: https://github.com/conda-forge/miepython-feedstock
   :alt: conda

.. |doi-badge| image:: https://zenodo.org/badge/99259684.svg
   :target: https://zenodo.org/badge/latestdoi/99259684
   :alt: doi

.. |license-badge| image:: https://img.shields.io/github/license/scottprahl/miepython?color=68CA66
   :target: https://github.com/scottprahl/miepython/blob/master/LICENSE.txt
   :alt: License

.. |testing-badge| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yml/badge.svg
   :target: https://github.com/scottprahl/miepython/actions/workflows/test.yml
   :alt: Testing

.. |docs-badge| image:: https://readthedocs.org/projects/miepython/badge?color=68CA66
   :target: https://miepython.readthedocs.io
   :alt: Docs

.. |downloads-badge| image:: https://img.shields.io/pypi/dm/miepython?color=68CA66
   :target: https://pypi.org/project/miepython/
   :alt: Downloads

miepython
=========

by Scott Prahl

|pypi-badge| |github-badge| |conda-badge| |doi-badge|

|license-badge| |testing-badge| |docs-badge| |downloads-badge|


``miepython`` is a pure Python module to calculate light scattering for
non-absorbing, partially-absorbing, or perfectly-conducting spheres. Mie
theory is used, following `the procedure described by Wiscombe
<http://opensky.ucar.edu/islandora/object/technotes:232>`_. This code has
been validated against his work. 

.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/mie-diagram2.svg
   :width: 700px
   :alt: scattering diagram

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 at various
angles for a sphere.

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

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

* the scattering phase function is normalized so it equals the *single scattering albedo* when integrated over 4π steradians by default.  This normalization can be changed (see the normalization notebook for details).

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 at each of those
angles.

Full documentation at <https://miepython.readthedocs.io>

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

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

#. the scattering phase function is normalized so it equals the *single scattering albedo* when integrated over 4π steradians.  As of version 2.3, this can be changed.


Installation
---------------

Use ``pip``::

    pip install miepython

or ``conda``::

    conda install -c conda-forge miepython

Or `run this code in the cloud using Google Collaboratory <https://colab.research.google.com/github/scottprahl/miepython/blob/master>`_ by selecting the Jupyter notebook that interests you.

Usage for those that don't do Jupyter
--------------------------------------

Basic Mie Calculations
^^^^^^^^^^^^^^^^^^^^^^^

    from miepython import mie
    
    complex_refractive_index = 1.5-1j    # convention is negative imaginary part
    size_parameter = 1                   # 2𝜋(radius)/λ
    qext, qsca, qback, g = mie(complex_refractive_index, size_parameter)

    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


Simple Dielectric
^^^^^^^^^^^^^^^^^^

The script `01_dielectric.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/01_dielectric.py>`_

.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/01_plot.svg

Glass Spheres
^^^^^^^^^^^^^^

The script `02_glass.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/02_glass.py>`_

.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/02_plot.svg

Water Droplets
^^^^^^^^^^^^^^^

The script `03_droplets.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/03_droplets.py>`_

.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/03_plot.svg

Small Gold Spheres
^^^^^^^^^^^^^^^^^^^

The script `04_gold.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/04_gold.py>`_

.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/04_plot.svg


Usage for those that use Jupyter
---------------------------------

All the Jupyter notebooks are available in the docs directory and they are all viewable at <https://miepython.readthedocs.io>


Script Examples for those that don't do Jupyter
-----------------------------------------------

All the Jupyter notebooks are in the docs directory and shown at <https://miepython.readthedocs.io>

You can also use a Jupyter notebook immediately (well, you do have wait a bit for everything to get uploaded) by clicking the Google Colaboratory button below

.. image:: https://colab.research.google.com/assets/colab-badge.svg
  :target: https://colab.research.google.com/github/scottprahl/miepython/blob/master
  :alt: Colab


License
-------

``miepython`` is licensed under the terms of the MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/scottprahl/miepython",
    "name": "miepython",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "mie, scattering, rainbow, droplet, backscatter, sphere, nanoparticle, sphere, cloud, phase function, efficiency, rayleigh, backscattering",
    "author": "Scott Prahl",
    "author_email": "scott.prahl@oit.edu",
    "download_url": "https://files.pythonhosted.org/packages/35/45/3996a34c1e642f17f31abc05291cd8e8fc893014a8daf6ec2acf4c2b1a25/miepython-2.5.4.tar.gz",
    "platform": null,
    "description": ".. |pypi-badge| image:: https://img.shields.io/pypi/v/miepython?color=68CA66\n   :target: https://pypi.org/project/miepython/\n   :alt: pypi\n\n.. |github-badge| image:: https://img.shields.io/github/v/tag/scottprahl/miepython?label=github&color=68CA66\n   :target: https://github.com/scottprahl/miepython\n   :alt: github\n\n.. |conda-badge| image:: https://img.shields.io/conda/vn/conda-forge/miepython?label=conda&color=68CA66\n   :target: https://github.com/conda-forge/miepython-feedstock\n   :alt: conda\n\n.. |doi-badge| image:: https://zenodo.org/badge/99259684.svg\n   :target: https://zenodo.org/badge/latestdoi/99259684\n   :alt: doi\n\n.. |license-badge| image:: https://img.shields.io/github/license/scottprahl/miepython?color=68CA66\n   :target: https://github.com/scottprahl/miepython/blob/master/LICENSE.txt\n   :alt: License\n\n.. |testing-badge| image:: https://github.com/scottprahl/miepython/actions/workflows/test.yml/badge.svg\n   :target: https://github.com/scottprahl/miepython/actions/workflows/test.yml\n   :alt: Testing\n\n.. |docs-badge| image:: https://readthedocs.org/projects/miepython/badge?color=68CA66\n   :target: https://miepython.readthedocs.io\n   :alt: Docs\n\n.. |downloads-badge| image:: https://img.shields.io/pypi/dm/miepython?color=68CA66\n   :target: https://pypi.org/project/miepython/\n   :alt: Downloads\n\nmiepython\n=========\n\nby Scott Prahl\n\n|pypi-badge| |github-badge| |conda-badge| |doi-badge|\n\n|license-badge| |testing-badge| |docs-badge| |downloads-badge|\n\n\n``miepython`` is a pure Python module to calculate light scattering for\nnon-absorbing, partially-absorbing, or perfectly-conducting spheres. Mie\ntheory is used, following `the procedure described by Wiscombe\n<http://opensky.ucar.edu/islandora/object/technotes:232>`_. This code has\nbeen validated against his work. \n\n.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/mie-diagram2.svg\n   :width: 700px\n   :alt: scattering diagram\n\nThis code provides functions for calculating the extinction efficiency,\nscattering efficiency, backscattering, and scattering asymmetry.\nMoreover, a set of angles can be given to calculate the scattering at various\nangles for a sphere.\n\nWhen comparing different Mie scattering codes, make sure that you're\naware of the conventions used by each code.  ``miepython`` makes the\nfollowing assumptions\n\n* the imaginary part of the complex index of refraction for absorbing spheres is *negative*.\n\n* the scattering phase function is normalized so it equals the *single scattering albedo* when integrated over 4\u03c0 steradians by default.  This normalization can be changed (see the normalization notebook for details).\n\nThis 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 at each of those\nangles.\n\nFull documentation at <https://miepython.readthedocs.io>\n\nPay Attention!\n--------------\n\nWhen comparing different Mie scattering codes, make sure that you're aware of the conventions used by each code.  ``miepython`` makes the following assumptions\n\n#. the imaginary part of the complex index of refraction for absorbing spheres is *negative*.  \n\n#. the scattering phase function is normalized so it equals the *single scattering albedo* when integrated over 4\u03c0 steradians.  As of version 2.3, this can be changed.\n\n\nInstallation\n---------------\n\nUse ``pip``::\n\n    pip install miepython\n\nor ``conda``::\n\n    conda install -c conda-forge miepython\n\nOr `run this code in the cloud using Google Collaboratory <https://colab.research.google.com/github/scottprahl/miepython/blob/master>`_ by selecting the Jupyter notebook that interests you.\n\nUsage for those that don't do Jupyter\n--------------------------------------\n\nBasic Mie Calculations\n^^^^^^^^^^^^^^^^^^^^^^^\n\n    from miepython import mie\n    \n    complex_refractive_index = 1.5-1j    # convention is negative imaginary part\n    size_parameter = 1                   # 2\ud835\udf0b(radius)/\u03bb\n    qext, qsca, qback, g = mie(complex_refractive_index, size_parameter)\n\n    print(\"The extinction efficiency  is %.3f\" % qext)\n    print(\"The scattering efficiency  is %.3f\" % qsca)\n    print(\"The backscatter efficiency is %.3f\" % qback)\n    print(\"The scattering anisotropy  is %.3f\" % g)\n\nshould produce::\n\n    The extinction efficiency  is 2.336\n    The scattering efficiency  is 0.663\n    The backscatter efficiency is 0.573\n    The scattering anisotropy  is 0.192\n\n\nSimple Dielectric\n^^^^^^^^^^^^^^^^^^\n\nThe script `01_dielectric.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/01_dielectric.py>`_\n\n.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/01_plot.svg\n\nGlass Spheres\n^^^^^^^^^^^^^^\n\nThe script `02_glass.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/02_glass.py>`_\n\n.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/02_plot.svg\n\nWater Droplets\n^^^^^^^^^^^^^^^\n\nThe script `03_droplets.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/03_droplets.py>`_\n\n.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/03_plot.svg\n\nSmall Gold Spheres\n^^^^^^^^^^^^^^^^^^^\n\nThe script `04_gold.py <https://raw.githubusercontent.com/scottprahl/miepython/master/miepython/examples/04_gold.py>`_\n\n.. image:: https://raw.githubusercontent.com/scottprahl/miepython/master/docs/04_plot.svg\n\n\nUsage for those that use Jupyter\n---------------------------------\n\nAll the Jupyter notebooks are available in the docs directory and they are all viewable at <https://miepython.readthedocs.io>\n\n\nScript Examples for those that don't do Jupyter\n-----------------------------------------------\n\nAll the Jupyter notebooks are in the docs directory and shown at <https://miepython.readthedocs.io>\n\nYou can also use a Jupyter notebook immediately (well, you do have wait a bit for everything to get uploaded) by clicking the Google Colaboratory button below\n\n.. image:: https://colab.research.google.com/assets/colab-badge.svg\n  :target: https://colab.research.google.com/github/scottprahl/miepython/blob/master\n  :alt: Colab\n\n\nLicense\n-------\n\n``miepython`` is licensed under the terms of the MIT license.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Mie scattering of a plane wave by a sphere",
    "version": "2.5.4",
    "project_urls": {
        "Homepage": "https://github.com/scottprahl/miepython"
    },
    "split_keywords": [
        "mie",
        " scattering",
        " rainbow",
        " droplet",
        " backscatter",
        " sphere",
        " nanoparticle",
        " sphere",
        " cloud",
        " phase function",
        " efficiency",
        " rayleigh",
        " backscattering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a965c5b91da544c1c4b0dd0caf23ff5c58d552089f7f4e890348f848f75f3373",
                "md5": "2f73afa29fdeeeef51477450128ae7bc",
                "sha256": "f40b52404ec42bc0d31c0e3f07d9e836893f2acc2ad909314407e613881ee0cc"
            },
            "downloads": -1,
            "filename": "miepython-2.5.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2f73afa29fdeeeef51477450128ae7bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 30750,
            "upload_time": "2024-05-07T23:40:13",
            "upload_time_iso_8601": "2024-05-07T23:40:13.623042Z",
            "url": "https://files.pythonhosted.org/packages/a9/65/c5b91da544c1c4b0dd0caf23ff5c58d552089f7f4e890348f848f75f3373/miepython-2.5.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35453996a34c1e642f17f31abc05291cd8e8fc893014a8daf6ec2acf4c2b1a25",
                "md5": "6e26c51f964256435e1a7c4fa90e46e5",
                "sha256": "1f948529fe4f65eca39758bf7c5c2453a83c77094979a2ccdaf4b0e3e6d298d8"
            },
            "downloads": -1,
            "filename": "miepython-2.5.4.tar.gz",
            "has_sig": false,
            "md5_digest": "6e26c51f964256435e1a7c4fa90e46e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 37725,
            "upload_time": "2024-05-07T23:40:16",
            "upload_time_iso_8601": "2024-05-07T23:40:16.803953Z",
            "url": "https://files.pythonhosted.org/packages/35/45/3996a34c1e642f17f31abc05291cd8e8fc893014a8daf6ec2acf4c2b1a25/miepython-2.5.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-07 23:40:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "scottprahl",
    "github_project": "miepython",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "miepython"
}
        
Elapsed time: 0.28914s