Routines for analysis of polarization
Project description
pypolar
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
Example Usage
The following example demonstrates modeling an optical isolator using the Jones formalism.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc89848539576334b6bb5974caed2e37812f8f3ca676f2ce6a2e2d619bba4561
|
|
| MD5 |
8d7c1fe1826b11d8b70f0e00c182b806
|
|
| BLAKE2b-256 |
489569d54b76623053bce3dd5b8f93791ef959d4466dfceed3449ef5b0b02775
|
Provenance
The following attestation bundles were made for pypolar-1.1.0.tar.gz:
Publisher:
pypi.yaml on scottprahl/pypolar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypolar-1.1.0.tar.gz -
Subject digest:
fc89848539576334b6bb5974caed2e37812f8f3ca676f2ce6a2e2d619bba4561 - Sigstore transparency entry: 931962558
- Sigstore integration time:
-
Permalink:
scottprahl/pypolar@9bc7226d2b9e96dd4897dc50d491029fa219e0dd -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/scottprahl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@9bc7226d2b9e96dd4897dc50d491029fa219e0dd -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45f75a7437df4fa69b8e5561509823ca466471dddc06047c55a6dde1e66c18c3
|
|
| MD5 |
e24807f6564afabb086b656640a7d8c9
|
|
| BLAKE2b-256 |
ed150f75606fb82a6091bd44eb48d8b51190df4cee7f51e0e1ddb57ae523c85d
|
Provenance
The following attestation bundles were made for pypolar-1.1.0-py3-none-any.whl:
Publisher:
pypi.yaml on scottprahl/pypolar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypolar-1.1.0-py3-none-any.whl -
Subject digest:
45f75a7437df4fa69b8e5561509823ca466471dddc06047c55a6dde1e66c18c3 - Sigstore transparency entry: 931962614
- Sigstore integration time:
-
Permalink:
scottprahl/pypolar@9bc7226d2b9e96dd4897dc50d491029fa219e0dd -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/scottprahl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@9bc7226d2b9e96dd4897dc50d491029fa219e0dd -
Trigger Event:
release
-
Statement type: