Skip to main content

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.

pypi github conda doi

License Testing Docs Downloads

Try Online

full pitch lens

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 by clicking the Google Colaboratory button below

Colab

Citation

If you use pygrin in academic or technical work, please cite:

Prahl, S. (2023). pygrin: A Python module for ray tracing through gradient-index (GRIN) lenses (Version 0.5.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.8370822

BibTeX

@software{pygrin_prahl_2023,
  author    = {Scott Prahl},
  title     = {pygrin: A Python module for ray tracing through gradient-index (GRIN) lenses},
  year      = {2023},
  version   = {0.5.1},
  doi       = {10.5281/zenodo.8370822},
  url       = {https://github.com/scottprahl/pygrin},
  publisher = {Zenodo}
}

License

pygrin is licensed 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

pygrin-0.6.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

pygrin-0.6.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pygrin-0.6.0.tar.gz.

File metadata

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

File hashes

Hashes for pygrin-0.6.0.tar.gz
Algorithm Hash digest
SHA256 ca562d090603577e1c9125fcd902bf3a5fbe93dec389d940b3d14534d0959ad9
MD5 df7453b27dde5b11bbce9e9d45e72060
BLAKE2b-256 ee248b241f5f40104a3299d8dbb415e78c74dd2108116f888abf7da622552a1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrin-0.6.0.tar.gz:

Publisher: pypi.yaml on scottprahl/pygrin

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

File details

Details for the file pygrin-0.6.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pygrin-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 474562bd1bf46b058424f8b6482306ce6c35f6d59d13d020a192974cac666ffc
MD5 cf076dbfd97dabde18c391bab7580d39
BLAKE2b-256 9cea73c3ee74967f2cb59c3ebe3d8d1854a7b8421585799fd6f8a423751b8acd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygrin-0.6.0-py3-none-any.whl:

Publisher: pypi.yaml on scottprahl/pygrin

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