Skip to main content

Routines for analysis of polarization

Project description

pypolar

PyPI GitHub Conda DOI

License Testing Status Documentation Download Count

Try Online

pypolar is a Python library for simulating, analyzing, and visualizing the polarization state of light as it propagates through optical systems. The package supports modeling with both Jones and Mueller calculus frameworks and includes functionality relevant to education, research, ellipsometry, and polarimetric system design.

The library provides computational tools, visualization utilities, and symbolic analysis support, making it suitable for laboratory instruction, computational optics coursework, and applied research in polarization optics.


Modules

pypolar is organized into several computational and symbolic components:

Numerical computation modules

  • pypolar.fresnel — Fresnel reflection and transmission calculations

  • pypolar.jones — Analysis of polarization using Jones calculus

  • pypolar.mueller — Polarization modeling using the Mueller calculus

  • pypolar.ellipsometry — Ellipsometry modeling tools

Visualization support

  • pypolar.visualization — Poincaré sphere and vector-based visualization routines

Symbolic computation

  • pypolar.sym_fresnel — Symbolic Fresnel reflection and transmission expressions

  • pypolar.sym_jones — Symbolic polarization modeling using Jones calculus

  • pypolar.sym_mueller — Symbolic Mueller matrix manipulation


Installation

pypolar may be installed via pip:

pip install pypolar

or using conda:

conda install -c conda-forge pypolar

Documentation and Examples

Comprehensive user documentation, theory notes, and executable Jupyter examples are available at:

📄 https://pypolar.readthedocs.io

or use immediately in your browser via the JupyterLite button below

Try Online


Example Usage

The following example demonstrates modeling an optical isolator using the Jones formalism.

Optical isolator schematic

Jones Matrix Example

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')
vis.draw_jones_poincare(J2, ax, label='  after polarizer', color='blue')
vis.draw_jones_poincare(J3, ax, label='  after QWP', color='blue')
vis.draw_jones_poincare(J4, ax, label='  after mirror', color='blue')
vis.draw_jones_poincare(J5, ax, label='  final', color='red')

plt.show()

Mueller Matrix Example

import numpy as np
import pypolar.mueller as mueller

A = mueller.stokes_right_circular()
B = mueller.op_linear_polarizer(np.pi/4)
C = mueller.op_quarter_wave_plate(0)
D = mueller.op_mirror()
E = mueller.op_quarter_wave_plate(0)
F = mueller.op_linear_polarizer(-np.pi/4)
F @ E @ D @ C @ B @ A

produces:

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

Citation

If you use pypolar in academic, instructional, or applied technical work, please cite:

Prahl, S. (2026). pypolar: A Python module for polarization using Jones and Mueller calculus (Version 1.0.2) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.8358111

BibTeX

@software{pypolar_prahl_2026,
  author    = {Scott Prahl},
  title     = {pypolar: A Python module for polarization using Jones and Mueller calculus},
  year      = {2026},
  version   = {1.0.2},
  doi       = {10.5281/zenodo.8358111},
  url       = {https://github.com/scottprahl/pypolar},
  publisher = {Zenodo}
}

License

pypolar is distributed 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

pypolar-1.1.0.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypolar-1.1.0-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file pypolar-1.1.0.tar.gz.

File metadata

  • Download URL: pypolar-1.1.0.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypolar-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fc89848539576334b6bb5974caed2e37812f8f3ca676f2ce6a2e2d619bba4561
MD5 8d7c1fe1826b11d8b70f0e00c182b806
BLAKE2b-256 489569d54b76623053bce3dd5b8f93791ef959d4466dfceed3449ef5b0b02775

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypolar-1.1.0.tar.gz:

Publisher: pypi.yaml on scottprahl/pypolar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypolar-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pypolar-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypolar-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45f75a7437df4fa69b8e5561509823ca466471dddc06047c55a6dde1e66c18c3
MD5 e24807f6564afabb086b656640a7d8c9
BLAKE2b-256 ed150f75606fb82a6091bd44eb48d8b51190df4cee7f51e0e1ddb57ae523c85d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypolar-1.1.0-py3-none-any.whl:

Publisher: pypi.yaml on scottprahl/pypolar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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