pypolar

Python modules for polarization changes using Jones or Mueller calculus

https://github.com/scottprahl/pypolar

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Python modules for polarization changes using Jones or Mueller calculus

Basic Info
  • Host: GitHub
  • Owner: scottprahl
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 36.6 MB
Statistics
  • Stars: 39
  • Watchers: 4
  • Forks: 9
  • Open Issues: 3
  • Releases: 6
Created almost 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation

README.rst

.. |pypi| image:: https://img.shields.io/pypi/v/pypolar?color=68CA66
   :target: https://pypi.org/project/pypolar/
   :alt: pypi

.. |github| image:: https://img.shields.io/github/v/tag/scottprahl/pypolar?label=github&color=v
   :target: https://github.com/scottprahl/pypolar
   :alt: github

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

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

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

.. |test| image:: https://github.com/scottprahl/pypolar/actions/workflows/test.yaml/badge.svg
   :target: https://github.com/scottprahl/pypolar/actions/workflows/test.yaml
   :alt: testing

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

.. |down| image:: https://img.shields.io/pypi/dm/pypolar?color=68CA66
   :target: https://pypi.org/project/pypolar/
   :alt: Downloads

pypolar
=======

by Scott Prahl

|pypi| |github| |conda| |doi|

|license| |test| |docs| |down|

``pypolar`` is a python module to model and visualize the polarization state of light as it travels through polarizers and birefringent elements. Some ellipsometry support is also included.

There are four numeric modules:

* `pypolar.fresnel` - reflection and transmission calculations
* `pypolar.jones` - management of polarization using the Jones calculus
* `pypolar.mueller` - management of polarization using the Mueller calculus
* `pypolar.ellipsometry` - ellipsometry support

A module for visualization:

* `pypolar.visualization` - Routines to support visualization

and three modules that support symbolic algebra:

* `pypolar.sym_fresnel` - Fresnel reflection and transmission
* `pypolar.sym_jones` - Jones calculus
* `pypolar.sym_mueller` - Mueller calculus

Detailed documentation is available at `Read the Docs `_.

Installation
============

Use ``pip``::

    pip install pypolar

or ``conda``::

    conda install -c conda-forge pypolar

Usage
=====

Consider modeling an optical isolator.

.. image:: https://raw.githubusercontent.com/scottprahl/pypolar/main/docs/isolator.png
  :width: 700px
  :alt: optical isolator diagram

Jones Matrix version
--------------------

.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt
    import pypolar.jones as jones
    import pypolar.visualization as vis
    
    J1 = jones.field_elliptical(np.pi/6,np.pi/6)
    J2 = jones.op_linear_polarizer(0) @ J1
    J3 = jones.op_quarter_wave_plate(np.pi/4) @ J2
    J4 = jones.op_mirror() @ J3
    J5 = jones.op_quarter_wave_plate(-np.pi/4) @ J4
    
    fig = plt.figure(figsize=(8, 8))
    ax = fig.add_subplot(111, projection='3d')
    vis.draw_empty_sphere(ax)
    
    vis.draw_jones_poincare(J1, ax, label='  start', color='red', va='center')
    vis.draw_jones_poincare(J2, ax, label='  after Polarizer', color='blue', va='center')
    vis.draw_jones_poincare(J3, ax, label='  after QWP', color='blue', va='center')
    vis.draw_jones_poincare(J4, ax, label='  after mirror', color='blue', va='center')
    vis.draw_jones_poincare(J5, ax, label='  final', color='red', va='center')
    
    vis.join_jones_poincare(J1, J2, ax, color='blue', lw=2, linestyle=':')
    vis.join_jones_poincare(J2, J3, ax, color='blue', lw=2, linestyle=':')
    vis.join_jones_poincare(J3, J4, ax, color='blue', lw=2, linestyle=':')
    vis.join_jones_poincare(J4, J5, ax, color='blue', lw=2, linestyle=':')
    plt.show()

will produce

.. image:: https://raw.githubusercontent.com/scottprahl/pypolar/main/docs/poincare1.svg
  :width: 700px

Mueller Matrix version
----------------------

.. code-block:: python

    import numpy as np
    import pypolar.mueller as mueller
    
    A = mueller.stokes_right_circular()       # incident light
    B = mueller.op_linear_polarizer(np.pi/4)  # polarizer at 45°
    C = mueller.op_quarter_wave_plate(0)      # QWP with fast axis horizontal
    D = mueller.op_mirror()                   # first surface mirror
    E = mueller.op_quarter_wave_plate(0)      # QWP still has fast axis horizontal
    F = mueller.op_linear_polarizer(-np.pi/4) # blocks at -45° travelling backwards
    F @ E @ D @ C @ B @ A
    
produces

.. code-block:: python

    array([0., 0., 0., 0.])

License
-------

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

Owner

  • Name: Scott Prahl
  • Login: scottprahl
  • Kind: user
  • Location: Portland, Oregon
  • Company: Oregon Institute of Technology

Citation (CITATION.cff)

authors:
- family-names: Prahl
  given-names: Scott
  orcid: https://orcid.org/0000-0003-1468-6851
cff-version: 1.2.0
date-released: '2023-09-19'
doi: 10.5281/zenodo.8358112
message: If you use this software, please cite it as below.
title: 'pypolar: a python module for polarization using Jones or Mueller calculus'
url: https://zenodo.org/badge/latestdoi/99259684
version: 0.9.3

GitHub Events

Total
  • Issues event: 1
  • Watch event: 5
  • Issue comment event: 2
Last Year
  • Issues event: 1
  • Watch event: 5
  • Issue comment event: 2

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 224
  • Total Committers: 2
  • Avg Commits per committer: 112.0
  • Development Distribution Score (DDS): 0.152
Top Committers
Name Email Commits
Scott Prahl s****t@p****m 190
Work Prahl p****l@b****u 34
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 4
  • Total pull requests: 0
  • Average time to close issues: 11 months
  • Average time to close pull requests: N/A
  • Total issue authors: 3
  • Total pull request authors: 0
  • Average comments per issue: 4.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • gapster (2)
  • gyger (1)
  • KrystofJasensky (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 123 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 12
  • Total maintainers: 1
pypi.org: pypolar

Routines for analysis of polarization

  • Versions: 12
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 123 Last month
Rankings
Dependent packages count: 9.8%
Forks count: 12.0%
Stargazers count: 12.7%
Average: 14.7%
Downloads: 17.0%
Dependent repos count: 21.8%
Maintainers (1)
Last synced: 7 months ago