prysm

prysm: A Python optics module - Published in JOSS (2019)

https://github.com/brandondube/prysm

Science Score: 95.0%

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

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    7 of 12 committers (58.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

4d diffraction forbes-polynomial gpu-computing modeling mtf mtf-mapper optics phase-retrieval phasecam propagation psf python q-polynomial raytracing trioptics wavefront wavefront-sensing zernike zygo

Scientific Fields

Earth and Environmental Sciences Physical Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

physical optics: integrated modeling, phase retrieval, segmented systems, polynomials and fitting, sequential raytracing...

Basic Info
Statistics
  • Stars: 307
  • Watchers: 19
  • Forks: 52
  • Open Issues: 18
  • Releases: 16
Topics
4d diffraction forbes-polynomial gpu-computing modeling mtf mtf-mapper optics phase-retrieval phasecam propagation psf python q-polynomial raytracing trioptics wavefront wavefront-sensing zernike zygo
Created almost 8 years ago · Last pushed 12 months ago
Metadata Files
Readme License

README.md

Prysm

CircleCI Documentation Status Coverage Status DOI

Prysm is a python 3.6+ library for numerical optics. Its features are a superset of those in both POPPY and PROPER, not limited to physical optics, thin lens, thin film, and detector modeling. There is also a submodule that can replace the software that comes with an interferometer for data analysis.

Prysm is believed to be by significant margin the fastest package in the world at what it does. On CPU, end-to-end calculation is more than 100x as fast as the above for like-for-like calculations. On GPU, prysm is more than 1,000x faster than its competition. The lowfssim model can run at over 2kHz in real-time and is all prysm under the hood.

Prysm can be used for everything from forward modeling of optical systems from camera lenses to coronographs to reverse modeling and phase retrieval. Due to its composable structure, it plays well with others and can be substituted in or out of other code easily. Of special note is prysm's interchangeable backend system, which allows the user to freely exchange numpy for cupy, enabling use of a GPU for all computations, or other similar exchanges, such as pytorch for algorithmic differentiation.

Installation

prysm is on pypi: pip install prysm

prysm requires only numpy, and scipy.

Optional Dependencies

Prysm uses numpy for array operations or any compatible library. To use GPUs, you may install cupy and use it as the backend at runtime. Plotting uses matplotlib. Images are read and written with imageio. Some MTF utilities utilize pandas and seaborn. Reading of Zygo datx files requires h5py.

Features

Propagation

  • Pupil-to-Focus
  • Focus-to-Pupil
  • Free space ("plane to plane" or "angular spectrum")
  • FFTs, Matrix DFTs, Chirp C Transforms
  • Thin Lens Phase Screens

Polynomials

  • Zernike
  • Legendre
  • Chebyshev (1st, 2nd, 3rd, 4th kind)
  • Jacobi
  • 2D-Q, Qbfs, Qcon
  • Hopkins
  • Hermite (Probablist's and Physicist's)
  • Dickson
  • fitting
  • projection

All of these polynomials provide highly optimized GPU-compatible implementations, as well as derivatives.

Pupil Masks

  • circles, binary and anti-aliased
  • ellipses
  • rectangles
  • N-sided regular convex polygons
  • N-vaned spiders

Segmented systems

  • parametrized pupil mask generation
  • per-segment errors based on any polynomial basis expansion

Image Simulation

  • Convolution
  • Smear
  • Jitter
  • in-the-box targets
  • - Siemens' Star
  • - Slanted Edge
  • - BMW Target (crossed edges)
  • - Pinhole
  • - Slit
  • - Tilted Square

Metrics

  • Strehl
  • Encircled Energy
  • RMS, PV, Sa, Std, Var
  • Centroid
  • FWHM, 1/e, 1/e^2
  • PSD
  • MTF / PTF / OTF
  • PSD (and parametric fit, synthesis from parameters)
  • slope / gradient
  • Total integrated scatter
  • Bandlimited RMS

Detectors

  • fully integrated noise model (shot, read, prnu, etc)
  • arbitrary pixel apertures (square, oblong, purely numerical)
  • optical low pass filters
  • Bayer compositing, demosaicing

Thin Films

  • r, t parameters, even over spatially varying extent with high performance
  • Brewster's angle
  • Critical Angle
  • Snell's law

Refractive Index

  • Cauchy's equation
  • Sellmeier's equation

Thin Lenses

  • Defocus to delta z at the image and reverse
  • object/image distance relation
  • image/object distances and magnification
  • image/object distances and NA/F#
  • magnification and working F/#
  • two lens BFL, EFL (thick lenses)

Tilted Planes and other surfaces

  • forward or reverse projection of surfaces

Deformable Mirrors

  • surface synthesis in or out of beam normal based on arbitrary influence function with arbitrary sampling
  • DM surface misalignment / registration errors

Interferometry

  • PSD
  • Low/High/Bandpass/Bandreject filtering
  • spike clipping
  • polynomial fitting and projection
  • statistical evaluation (PV, RMS, PVr, Sa, bandlimited RMS...)
  • total integrated scatter
  • synthetic fringe maps with extra tilt fringes
  • synthesize map from PSD spec

Tutorials, How-Tos

See the documentation on each

Contributing

If you find an issue with prysm, please open an issue or pull request. Prysm has some usage of f-strings, so any code contributed is only expected to work on python 3.6+, and is licensed under the MIT license.

Issue tracking, roadmaps, and project planning are done on Zenhub. Contact Brandon for an invite if you would like to participate; all are welcome.

Heritage

  • prysm was used to perform phase retrieval used to focus Nav and Hazcam, enhanced engineering cameras used to operate the Mars2020 Perserverence rover.

  • prysm is used to build the official model of LOWFS, the Low Order Wavefront Sensing and Control system for the Roman coronoagraph instrument. In this application, it has been used to validate dynamics of a hardware testbed to 35 picometers, or 0.08% of the injected dynamics. The model runs at over 2kHz, faster than the real-time control system, at the same fidelity used to achieve 35 pm model agreement in hardware experiments.

  • prysm is used by several FFRDCs in the US, as well as their equivalent organizations abroad

  • prysm is used by multiple ultra precision optics manufactures as part of their metrology data processing workflow

  • prysm is used by multiple interferometer vendors to cross validate their own software offerings

  • prysm is used at multiple universities to model optics both in a generic capacity and laboratory systems

  • your name here(?)

Owner

  • Name: Brandon Dube
  • Login: brandondube
  • Kind: user
  • Location: Pasadena, CA
  • Company: @NASA-JPL

Make numerical optics fast and accessible

JOSS Publication

prysm: A Python optics module
Published
May 09, 2019
Volume 4, Issue 37, Page 1352
Authors
Brandon Dube ORCID
Retro Refractions, LLC
Editor
Juanjo Bazán ORCID
Tags
optics imaging image simulation diffraction convolution wavefront interferogram

GitHub Events

Total
  • Issues event: 8
  • Watch event: 39
  • Issue comment event: 7
  • Push event: 9
  • Pull request event: 4
  • Fork event: 3
Last Year
  • Issues event: 8
  • Watch event: 39
  • Issue comment event: 7
  • Push event: 9
  • Pull request event: 4
  • Fork event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,607
  • Total Committers: 12
  • Avg Commits per committer: 133.917
  • Development Distribution Score (DDS): 0.019
Past Year
  • Commits: 77
  • Committers: 1
  • Avg Commits per committer: 77.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Brandon Dube b****e@g****m 1,577
Jaren Ashcraft j****t@e****u 15
Work w****k@d****u 3
u-yuta u****a 2
Work w****k@d****u 2
Jashcraf j****t@a****u 2
Matthew Petroff g****b@m****t 1
Erik e****y@g****m 1
samkberry T****z 1
Work w****k@d****u 1
Work w****k@d****u 1
Work w****k@J****n 1

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 91
  • Total pull requests: 13
  • Average time to close issues: 8 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 19
  • Total pull request authors: 8
  • Average comments per issue: 2.11
  • Average comments per pull request: 1.77
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 3
  • Pull requests: 1
  • Average time to close issues: 5 months
  • Average time to close pull requests: N/A
  • Issue authors: 3
  • Pull request authors: 1
  • Average comments per issue: 1.67
  • Average comments per pull request: 1.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • brandondube (66)
  • Jashcraf (5)
  • diplodocuslongus (2)
  • ira7bar (2)
  • JakobSilbermann (2)
  • egemenimre (2)
  • Nireil (1)
  • asebian (1)
  • jonathanabishop (1)
  • AlistairSymonds (1)
  • jerbrown-optics (1)
  • farrukhazfar (1)
  • ammichalko (1)
  • usryokousha (1)
  • julesfowler (1)
Pull Request Authors
  • Jashcraf (8)
  • deisenroth (2)
  • ListNoncomprehension (2)
  • egemenimre (1)
  • tealtortoise (1)
  • dependabot[bot] (1)
  • JulesScholler (1)
  • erik-bu (1)
  • mpetroff (1)
Top Labels
Issue Labels
enhancement (25) good first issue (16) help wanted (15) bug (7) Epic (6) Documentation (4) Performance (2) question (1)
Pull Request Labels
dependencies (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 393 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 26
  • Total maintainers: 1
pypi.org: prysm

a python optics module

  • Versions: 26
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 393 Last month
Rankings
Dependent packages count: 10.1%
Average: 16.1%
Downloads: 16.5%
Dependent repos count: 21.6%
Maintainers (1)
Last synced: 4 months ago

Dependencies

docs/requirements.txt pypi
  • imageio ==2.21.1
  • ipykernel *
  • matplotlib ==3.5.3
  • nbconvert ==6.5.3
  • nbsphinx ==0.8.9
  • pydata-sphinx-theme ==0.9.0
  • scikit-image ==0.19.3
  • setuptools ==64.0.3
  • sphinx ==5.1.1
setup.py pypi