Codedapertures
a python package for generating coded aperture patterns
Install / Use
/learn @bpops/CodedaperturesREADME
CodedApertures
a python package for generating coded apertures
CodedApertures is a python package that allows one to easily generate and display common coded aperture patterns. Coded apertures are a spatial encoding technique for straight-line optics, wherein traditional lensing (e.g., visible light) is not possible. Even wherein tradiational lensing is possible, there may be other advantages (infinite depth of field). Coded apertures may be used for hard x-ray and gamma-ray imaging for astrophysics, medical imaging, industrial, and homeland security applications.
New to coded apertures? Here's a beginner article.
Want to dive deeper? Here's a dissertation.
Usage
Install from PyPI with PIP:
pip install codedapertures
Coded patterns that this package can generate:
| class | coded aperture | |---|---| | randa1d | random array (1D) | | randa2d | random array (2D) | | ura | uniformly redundant array | | mura | modified uniformly redundant array | | pnp | pseudo-noise product array | | fzp | fresnel zone plate | | randahex | random array (hexagonal) | | shura | skew-hadamard uniformly redundant array | | hura | hexagonal uniformly redundant array |
Note that for consistency with relevant decoding algorithms, we define the binary meaning as such | val | mask pixel | |---|---| | 1 | open/transparent | | 0 | closed/opaque |
See demo.ipynb for examples of use.
Read the documentation for detailed information.
Build Documentation
cd docs
sphinx-build -M html source build
References
URA pattern: E. E. Fenimore and T. M. Cannon, "Coded aperture imaging with uniformly redundant arrays," Appl. Opt. 17, 337-347 (1978).
MURA pattern: E.E. Fenimore and S. R. Gottesman, "New family of binary arrays for coded aperture imaging" Appl. Opt. 28 (20): 4344-4352 (1989).
SHURA and HURA pattern: M.H. Finger and T.A. Prince, "Hexagonal Uniformly Redundant Arrays for Coded-Aperture Imaging," Proc. 19th Int. Cosmic Ray Conf., 3: 295-298 (1985).
PNP pattern: "PNP - A new class of coded aperture arrays," S. Gottesman and E. Schneid, IEEE Trans. Nucl. Sci., 33(1): 745-749 (1986).
Pseudo-Random Sequences and Primitive Polynomials: F.J. MacWilliams and N.J.A. Sloane, "Pseudo-Random Sequences and Arrays", Proc. of the IEEE, 64, 1715 (1976).
Fresnel Zone Plates: L. Mertz and N.O. Young, "Fresnel Transformation of Images", Proc. Int. Conf. Opt. Instr. & Tech., Chapman and Hall, Londa, 305 (1961).
This package uses an axial coordinate system for the hexagonal grids. It follows the concept outlined excellently at https://www.redblobgames.com/grids/hexagons/#map-storage.
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
107.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
346.8kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
