Skip to main content

Optics Tool Kit

Project description

otk - optics toolkit

Toolkit for doing optics in Python

Features include

  • 3D engine based on sphere tracing for simple robust implicit surfaces and constructive solid geometry,
  • nonsequential ray tracing engine,
  • programmatic lookup of full RefractiveIndex.INFO database,
  • import of lenses and glass catalogs from Zemax.

Installation

Installation methods include:

  • Clone repository and interact with it using Poetry e.g. poetry run view-zmx <zemax-file> or poetry shell.
  • Install in development mode with pip: pip install -e <path-to-local-repo>.
  • Install from package repository (e.g. PyPi) with pip: pip install otk.
  • Development mode with [: poetry add <path-to-local-repo>.
  • From package repository (e.g. PyPi) with Poetry: poetry add otk.

Getting started

  1. Check out the scripts in examples.
  2. View one of the lenses in designs with the command line tool view-zmx.

Documentation

(Yep, this is it at the moment.)

Command line tools

view-zmx <zemaxfile> launches a viewer of a Zemax lens.

Packages

  • otk.sdb - Geometry library based on signed distance bounds.
  • otk.rt1 - First attempt at ray tracing package. Superseded by otk.rt2.
  • otk.rt2 - Ray tracing package with flexible geometry based on otk.sdb. See also otk.rt2_scalar_qt.
  • otk.asbp - Angular spectrum beam propagation.
  • otk.abcd - 1D ray transfer matrix ("ABCD matrices") tools.
  • otk.rtm4 - abstractions for 1D ray transfer matrices, building upon otk.abcd.
  • otk.pgb - parabasal Gaussian routines for doing wave optical calculations with ray tracing results. Builds upon otk.rt1.
  • otk.h4t - homogeneous 4x4 transformation matrices.
  • otk.paraxial - basic paraxial optics calculations.
  • otk.math - various optics-specific math functions.
  • otk.pov - tools for generating POV-Ray scenes of optical setups.
  • otk.pov - for calculating properties of prisms.
  • otk.qt - Qt-related utilities
  • otk.ri - refractive index tools.
  • otk.trains - axially symmetric optical systems
  • otk.v3 - operations on homogeneous vectors in 2D
  • otk.v4 - operations on homogeneous vectors in 3D
  • otk.v4b - broadcasting operations on homogeneous vectors in 3D
  • otk.zemax - reading Zemax files

Folder contents

  • otk - the Python package itself.
  • examples - example scripts.
  • properties - material properties databases.
  • notes - miscellaneous notes including derivations.

Package management

otk uses Poetry for package management. This means that dependencies, version, entry points etc are all defined in pyproject.toml. setup.py is generated using dephell deps convert to support pip development mode installation.

Using PyPi test instance

To setup, add test.pypi.org to your Poetry configuration with poetry config repositories.test https://test.pypi.org/legacy/. Note the trailing slash.

To publish (after poetry build), poetry publish -r test.

To test that it installs properly,

  1. create and activate a virtual environment, and
  2. per instructions, pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple otk.

However, I was unable to re-upload the same version (i.e. to correct a mistake) to test.pypi.org (even after logging in to the website and deleting the release).

Testing

Test framework is pytest and tox.

Contributing

Please do.

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

otk-0.1.0.tar.gz (206.2 kB view details)

Uploaded Source

Built Distribution

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

otk-0.1.0-py3-none-any.whl (245.0 kB view details)

Uploaded Python 3

File details

Details for the file otk-0.1.0.tar.gz.

File metadata

  • Download URL: otk-0.1.0.tar.gz
  • Upload date:
  • Size: 206.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Darwin/18.7.0

File hashes

Hashes for otk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f4117f06258c36653557b5e896cd9d2b40e04a13c9714993fc0b11cc783ab6c0
MD5 e0dd4b036b156c615ac0252c6d2cf0ad
BLAKE2b-256 b1f5553b89f773dea462d578c42a7f7850bc25b0e2ae7733cde83d254404f195

See more details on using hashes here.

File details

Details for the file otk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: otk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 245.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Darwin/18.7.0

File hashes

Hashes for otk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5827bf3003623f9ab5ceca4bc8f6b28fcd71088dbba198b1cf5d10ae049c7320
MD5 f676fd5e72ecf653a05a155d59c1fa8a
BLAKE2b-256 8be3239a64f8600fdf81140025f53e6806a97d7a03c9295b6c640e4ca71b3e4b

See more details on using hashes here.

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