Gradient Index (GRIN) Lens Calculations
Project description
A basic collection of routines to ray trace through graded index (GRIN) lenses with a parabolic radial profile.
Example
Properties of a 0.25 pitch GRIN lens from an ancient Melles Griot Catalog:
import pygrin
n = 1.608
gradient = 0.339
length = 5.37
diameter = 1.8
pitch = pygrin.period(gradient, length)
ffl = pygrin.FFL(n,pitch,length)
efl = pygrin.EFL(n,pitch,length)
na = pygrin.NA(n,pitch,length,diameter)
angle = pygrin.max_angle(n,pitch,length,diameter)
print('expected pitch = 0.29, calculated %.2f' % pitch)
print('expected FFL = 0.46 mm, calculated %.2f' % ffl)
print('expected NA = 0.46, calculated %.2f' % na)
print('expected full accept angle = 55°, calculated %.0f°' % (2*angle*180/np.pi))
print('working distance = %.2f mm'%(efl-ffl))
Produces:
expected pitch = 0.29, calculated 0.29 expected FFL = 0.46, calculated 0.47 expected NA = 0.46, calculated 0.46 expected full accept angle = 55°, calculated 55° working distance = 1.43 mm
But the real utility of this module is creating plots that show the path of rays through a GRIN lens. For examples, see <https://pygrin.readthedocs.io>
Installation
Use pip:
pip install pygrin
or conda:
conda install -c conda-forge pygrin
or use immediately in your browser via the JupyterLite button below
Citation
If you use pygrin in academic or technical work, please cite:
Prahl, S. (2025). pygrin: A Python module for ray tracing through gradient-index (GRIN) lenses (Version 0.6.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.8370821
BibTeX
@software{pygrin_prahl_2025,
author = {Scott Prahl},
title = {pygrin: A Python module for ray tracing through gradient-index (GRIN) lenses},
year = {2025},
version = {0.6.0},
doi = {10.5281/zenodo.8370821},
url = {https://github.com/scottprahl/pygrin},
publisher = {Zenodo}
}
License
pygrin is licensed 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 pygrin-0.6.1.tar.gz.
File metadata
- Download URL: pygrin-0.6.1.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2f4ed7b899cb204945fbbcd4f6d4b11e05d1266dbbc043474877be7f0728245
|
|
| MD5 |
910b47fe5f83847e2e1821f35f452529
|
|
| BLAKE2b-256 |
972f6993605bfdda31984f5df7d261cadd00b2e7977231aa121921e25964a100
|
Provenance
The following attestation bundles were made for pygrin-0.6.1.tar.gz:
Publisher:
pypi.yaml on scottprahl/pygrin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygrin-0.6.1.tar.gz -
Subject digest:
b2f4ed7b899cb204945fbbcd4f6d4b11e05d1266dbbc043474877be7f0728245 - Sigstore transparency entry: 795100732
- Sigstore integration time:
-
Permalink:
scottprahl/pygrin@1d3bb83d3f2454588f71f82e685c587f14997d6d -
Branch / Tag:
refs/tags/0.6.1 - Owner: https://github.com/scottprahl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@1d3bb83d3f2454588f71f82e685c587f14997d6d -
Trigger Event:
release
-
Statement type:
File details
Details for the file pygrin-0.6.1-py3-none-any.whl.
File metadata
- Download URL: pygrin-0.6.1-py3-none-any.whl
- Upload date:
- Size: 7.2 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 |
bb790d8236a1e8ea73ab628da41863375d2fe3d073ff34de6ede7778d28e49f5
|
|
| MD5 |
d814118a5bb0c205ea84de22b986d3ec
|
|
| BLAKE2b-256 |
9f64133769be6559c3a7f97ab8dfc24dc4bb08082568fc7cd792e748e27e3796
|
Provenance
The following attestation bundles were made for pygrin-0.6.1-py3-none-any.whl:
Publisher:
pypi.yaml on scottprahl/pygrin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygrin-0.6.1-py3-none-any.whl -
Subject digest:
bb790d8236a1e8ea73ab628da41863375d2fe3d073ff34de6ede7778d28e49f5 - Sigstore transparency entry: 795100795
- Sigstore integration time:
-
Permalink:
scottprahl/pygrin@1d3bb83d3f2454588f71f82e685c587f14997d6d -
Branch / Tag:
refs/tags/0.6.1 - Owner: https://github.com/scottprahl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@1d3bb83d3f2454588f71f82e685c587f14997d6d -
Trigger Event:
release
-
Statement type: