optisketch 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. optisketch-0.0.3/.copier-answers.yml +19 -0
  2. optisketch-0.0.3/.github/ISSUE_TEMPLATE.md +15 -0
  3. optisketch-0.0.3/.github/TEST_FAIL_TEMPLATE.md +12 -0
  4. optisketch-0.0.3/.github/dependabot.yml +10 -0
  5. optisketch-0.0.3/.github/workflows/ci.yml +108 -0
  6. optisketch-0.0.3/.gitignore +111 -0
  7. optisketch-0.0.3/.pre-commit-config.yaml +32 -0
  8. optisketch-0.0.3/LICENSE +28 -0
  9. optisketch-0.0.3/NOTICE +28 -0
  10. optisketch-0.0.3/PKG-INFO +68 -0
  11. optisketch-0.0.3/README.md +38 -0
  12. optisketch-0.0.3/examples/4f_interactive.py +404 -0
  13. optisketch-0.0.3/examples/4f_raytrace.py +180 -0
  14. optisketch-0.0.3/licenses/optiland_license.txt +21 -0
  15. optisketch-0.0.3/pyproject.toml +155 -0
  16. optisketch-0.0.3/scripts/golden/generate_ray_coords.py +206 -0
  17. optisketch-0.0.3/src/optisketch/__init__.py +46 -0
  18. optisketch-0.0.3/src/optisketch/analysis/__init__.py +22 -0
  19. optisketch-0.0.3/src/optisketch/analysis/image_sim.py +230 -0
  20. optisketch-0.0.3/src/optisketch/analysis/irradiance.py +79 -0
  21. optisketch-0.0.3/src/optisketch/analysis/psf.py +144 -0
  22. optisketch-0.0.3/src/optisketch/analysis/spot.py +129 -0
  23. optisketch-0.0.3/src/optisketch/backends/__init__.py +38 -0
  24. optisketch-0.0.3/src/optisketch/backends/_jax.py +604 -0
  25. optisketch-0.0.3/src/optisketch/backends/_numpy.py +637 -0
  26. optisketch-0.0.3/src/optisketch/backends/_protocol.py +593 -0
  27. optisketch-0.0.3/src/optisketch/fluorescence.py +121 -0
  28. optisketch-0.0.3/src/optisketch/kernels.py +617 -0
  29. optisketch-0.0.3/src/optisketch/lenses.py +312 -0
  30. optisketch-0.0.3/src/optisketch/optimize.py +223 -0
  31. optisketch-0.0.3/src/optisketch/py.typed +5 -0
  32. optisketch-0.0.3/src/optisketch/rays.py +317 -0
  33. optisketch-0.0.3/src/optisketch/sources.py +464 -0
  34. optisketch-0.0.3/src/optisketch/systems.py +438 -0
  35. optisketch-0.0.3/src/optisketch/viz.py +82 -0
  36. optisketch-0.0.3/tests/__init__.py +0 -0
  37. optisketch-0.0.3/tests/conftest.py +40 -0
  38. optisketch-0.0.3/tests/helpers.py +45 -0
  39. optisketch-0.0.3/tests/test_analysis.py +321 -0
  40. optisketch-0.0.3/tests/test_backends.py +306 -0
  41. optisketch-0.0.3/tests/test_fluorescence.py +78 -0
  42. optisketch-0.0.3/tests/test_image_sim.py +152 -0
  43. optisketch-0.0.3/tests/test_kernels.py +881 -0
  44. optisketch-0.0.3/tests/test_lenses.py +152 -0
  45. optisketch-0.0.3/tests/test_optimize.py +128 -0
  46. optisketch-0.0.3/tests/test_sources.py +222 -0
  47. optisketch-0.0.3/tests/test_systems.py +388 -0
  48. optisketch-0.0.3/tests/test_trace_and_spacing.py +149 -0
  49. optisketch-0.0.3/tests/test_viz.py +33 -0
@@ -0,0 +1,19 @@
1
+ # Do not edit - changes here will be overwritten by Copier
2
+ _commit: v1
3
+ _src_path: gh:pydev-guide/pyrepo-copier
4
+ author_email: kevin.yamauchi@gmail.com
5
+ author_name: Kevin Yamauchi
6
+ git_versioning: true
7
+ github_username: kevinyamauchi
8
+ minimum_python: 11
9
+ mode: customize
10
+ module_name: optisketch
11
+ project_license: BSD-3-Clause
12
+ project_name: trace-light
13
+ project_short_description: a light raytracing library
14
+ test_lowest_pinned_dependencies: true
15
+ test_pre_release: true
16
+ use_mypy: false
17
+ use_pre_commit: true
18
+ use_ruff: true
19
+
@@ -0,0 +1,15 @@
1
+ * trace-light version:
2
+ * Python version:
3
+ * Operating System:
4
+
5
+ ### Description
6
+
7
+ Describe what you were trying to get done.
8
+ Tell us what happened, what went wrong, and what you expected to happen.
9
+
10
+ ### What I Did
11
+
12
+ ```
13
+ Paste the command(s) you ran and the output.
14
+ If there was a crash, please include the traceback here.
15
+ ```
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: "{{ env.TITLE }}"
3
+ labels: [bug]
4
+ ---
5
+ The {{ workflow }} workflow failed on {{ date | date("YYYY-MM-DD HH:mm") }} UTC
6
+
7
+ The most recent failing test was on {{ env.PLATFORM }} py{{ env.PYTHON }}
8
+ with commit: {{ sha }}
9
+
10
+ Full run: https://github.com/{{ repo }}/actions/runs/{{ env.RUN_ID }}
11
+
12
+ (This post will be updated if another test fails, as long as this issue remains open.)
@@ -0,0 +1,10 @@
1
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2
+
3
+ version: 2
4
+ updates:
5
+ - package-ecosystem: "github-actions"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "weekly"
9
+ commit-message:
10
+ prefix: "ci(dependabot):"
@@ -0,0 +1,108 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: [v*]
7
+ pull_request:
8
+ workflow_dispatch:
9
+ schedule:
10
+ # run every week (for --pre release tests)
11
+ - cron: "0 0 * * 0"
12
+
13
+ # cancel in-progress runs that use the same workflow and branch
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ check-manifest:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - uses: actions/checkout@v6
23
+ - run: pipx run check-manifest
24
+
25
+ test:
26
+ name: ${{ matrix.platform }} (${{ matrix.python-version }}) [${{ matrix.resolution }}]
27
+ runs-on: ${{ matrix.platform }}
28
+ env:
29
+ UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }}
30
+ UV_RESOLUTION: ${{ matrix.resolution }}
31
+ PYTEST_ADDOPTS: ${{ matrix.resolution == 'lowest-direct' && '-W ignore' || '' }}
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
36
+ platform: [ubuntu-latest, macos-latest, windows-latest]
37
+ resolution: ["highest", "lowest-direct"]
38
+
39
+ steps:
40
+ - uses: actions/checkout@v6
41
+
42
+ - name: 🐍 Set up Python ${{ matrix.python-version }}
43
+ uses: astral-sh/setup-uv@v7
44
+ with:
45
+ python-version: ${{ matrix.python-version }}
46
+ enable-cache: true
47
+
48
+ - name: Install Dependencies
49
+ run: uv sync --no-dev --group test
50
+
51
+ - name: 🧪 Run Tests
52
+ run: uv run pytest --cov --cov-report=xml --cov-report=term-missing
53
+
54
+ # If something goes wrong with --pre tests, we can open an issue in the repo
55
+ - name: 📝 Report --pre Failures
56
+ if: failure() && github.event_name == 'schedule'
57
+ uses: JasonEtco/create-an-issue@v2
58
+ env:
59
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60
+ PLATFORM: ${{ matrix.platform }}
61
+ PYTHON: ${{ matrix.python-version }}
62
+ RUN_ID: ${{ github.run_id }}
63
+ TITLE: "[test-bot] pip install --pre is failing"
64
+ with:
65
+ filename: .github/TEST_FAIL_TEMPLATE.md
66
+ update_existing: true
67
+
68
+ - name: Coverage
69
+ uses: codecov/codecov-action@v6
70
+ # with:
71
+ # token: ${{ secrets.CODECOV_TOKEN }}
72
+
73
+ build-and-inspect-package:
74
+ name: Build & inspect package.
75
+ needs: test
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@v6
79
+ with:
80
+ fetch-depth: 0
81
+ - uses: hynek/build-and-inspect-python-package@v2
82
+
83
+ upload-to-pypi:
84
+ name: Upload package to PyPI
85
+ needs: build-and-inspect-package
86
+ if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
87
+ runs-on: ubuntu-latest
88
+ permissions:
89
+ # IMPORTANT: this permission is mandatory for trusted publishing on PyPi
90
+ # see https://docs.pypi.org/trusted-publishers/
91
+ id-token: write
92
+ # This permission allows writing releases
93
+ contents: write
94
+
95
+ steps:
96
+ - name: Download built artifact to dist/
97
+ uses: actions/download-artifact@v8
98
+ with:
99
+ name: Packages
100
+ path: dist
101
+ - name: 🚢 Publish to PyPI
102
+ uses: pypa/gh-action-pypi-publish@release/v1
103
+ with:
104
+ password: ${{ secrets.PYPI_API_TOKEN }}
105
+ - uses: softprops/action-gh-release@v2
106
+ with:
107
+ generate_release_notes: true
108
+ files: './dist/*'
@@ -0,0 +1,111 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ env/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+
28
+ .DS_Store
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ .hypothesis/
50
+ .pytest_cache/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Django stuff:
57
+ *.log
58
+ local_settings.py
59
+
60
+ # Flask stuff:
61
+ instance/
62
+ .webassets-cache
63
+
64
+ # Scrapy stuff:
65
+ .scrapy
66
+
67
+ # Sphinx documentation
68
+ docs/_build/
69
+
70
+ # PyBuilder
71
+ target/
72
+
73
+ # Jupyter Notebook
74
+ .ipynb_checkpoints
75
+
76
+ # pyenv
77
+ .python-version
78
+
79
+ # celery beat schedule file
80
+ celerybeat-schedule
81
+
82
+ # SageMath parsed files
83
+ *.sage.py
84
+
85
+ # dotenv
86
+ .env
87
+
88
+ # virtualenv
89
+ .venv
90
+ venv/
91
+ ENV/
92
+
93
+ # Spyder project settings
94
+ .spyderproject
95
+ .spyproject
96
+
97
+ # Rope project settings
98
+ .ropeproject
99
+
100
+ # mkdocs documentation
101
+ /site
102
+
103
+ # mypy
104
+ .mypy_cache/
105
+
106
+ # ruff
107
+ .ruff_cache/
108
+
109
+ # IDE settings
110
+ .vscode/
111
+ .idea/
@@ -0,0 +1,32 @@
1
+ # enable pre-commit.ci at https://pre-commit.ci/
2
+ # it adds:
3
+ # 1. auto fixing pull requests
4
+ # 2. auto updating the pre-commit configuration
5
+ ci:
6
+ autoupdate_schedule: monthly
7
+ autofix_commit_msg: "style(pre-commit.ci): auto fixes [...]"
8
+ autoupdate_commit_msg: "ci(pre-commit.ci): autoupdate"
9
+
10
+ repos:
11
+ - repo: https://github.com/abravalheri/validate-pyproject
12
+ rev: v0.24.1
13
+ hooks:
14
+ - id: validate-pyproject
15
+
16
+ - repo: https://github.com/rhysd/actionlint
17
+ rev: v1.7.7
18
+ hooks:
19
+ - id: actionlint
20
+
21
+ - repo: https://github.com/adhtruong/mirrors-typos
22
+ rev: v1.36.2
23
+ hooks:
24
+ - id: typos
25
+ args: [--force-exclude] # omitting --write-changes
26
+
27
+ - repo: https://github.com/astral-sh/ruff-pre-commit
28
+ rev: v0.13.0
29
+ hooks:
30
+ - id: ruff-check
31
+ args: [--fix] # may also add '--unsafe-fixes'
32
+ - id: ruff-format
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, Kevin Yamauchi
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,28 @@
1
+ trace-light
2
+ Copyright (c) 2023 Kevin Yamauchi
3
+
4
+ This product includes software derived from Optiland
5
+ (https://github.com/optiland/optiland), copyright (c) 2024 Kramer Harrison,
6
+ licensed under the MIT License. See licenses/optiland_license.txt for the
7
+ full license text.
8
+
9
+ This library is heavily inspired by Optiland and uses some of its source
10
+ code and architecture.
11
+
12
+ Derived source code:
13
+ src/trace_light/kernels.py is derived from:
14
+ optiland/geometries/standard.py (StandardGeometry.distance,
15
+ StandardGeometry.surface_normal)
16
+ optiland/geometries/plane.py (Plane.distance, Plane.surface_normal)
17
+ optiland/rays/real_rays.py (RealRays.refract, RealRays.reflect)
18
+
19
+ The hexapolar pupil sampling in src/trace_light/sources.py is derived from:
20
+ optiland/distribution.py (HexagonalDistribution)
21
+
22
+ Testing infrastructure:
23
+ The structure and conventions of the test suite are derived from Optiland's
24
+ test infrastructure at https://github.com/optiland/optiland/tree/master/tests.
25
+
26
+ Architecture:
27
+ The overall architecture and design of this library are heavily inspired by
28
+ Optiland.
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: optisketch
3
+ Version: 0.0.3
4
+ Summary: a light raytracing library
5
+ Project-URL: homepage, https://github.com/kevinyamauchi/optisketch
6
+ Project-URL: repository, https://github.com/kevinyamauchi/optisketch
7
+ Author-email: Kevin Yamauchi <kevin.yamauchi@gmail.com>
8
+ License-Expression: BSD-3-Clause
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ License-File: licenses/optiland_license.txt
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: anywidget>=0.11.0
22
+ Requires-Dist: marimo>=0.23.8
23
+ Requires-Dist: matplotlib>=3.10.9
24
+ Requires-Dist: numpy>=2.4.6
25
+ Requires-Dist: scipy>=1.17.1
26
+ Provides-Extra: jax
27
+ Requires-Dist: jax>=0.4.0; extra == 'jax'
28
+ Requires-Dist: jaxlib>=0.4.0; extra == 'jax'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # trace-light
32
+
33
+ [![License](https://img.shields.io/pypi/l/trace-light.svg?color=green)](https://github.com/kevinyamauchi/trace-light/raw/main/LICENSE)
34
+ [![PyPI](https://img.shields.io/pypi/v/trace-light.svg?color=green)](https://pypi.org/project/trace-light)
35
+ [![Python Version](https://img.shields.io/pypi/pyversions/trace-light.svg?color=green)](https://python.org)
36
+ [![CI](https://github.com/kevinyamauchi/trace-light/actions/workflows/ci.yml/badge.svg)](https://github.com/kevinyamauchi/trace-light/actions/workflows/ci.yml)
37
+ [![codecov](https://codecov.io/gh/kevinyamauchi/trace-light/branch/main/graph/badge.svg)](https://codecov.io/gh/kevinyamauchi/trace-light)
38
+
39
+ a light raytracing library
40
+
41
+ > This library is heavily inspired by and in part derived from
42
+ > [Optiland](https://github.com/optiland/optiland) (MIT License).
43
+ > See [NOTICE](NOTICE) for details.
44
+
45
+ ## Development
46
+
47
+ The easiest way to get started is to use the [github cli](https://cli.github.com)
48
+ and [uv](https://docs.astral.sh/uv/getting-started/installation/):
49
+
50
+ ```sh
51
+ gh repo fork kevinyamauchi/trace-light --clone
52
+ # or just
53
+ # gh repo clone kevinyamauchi/trace-light
54
+ cd trace-light
55
+ uv sync
56
+ ```
57
+
58
+ Run tests:
59
+
60
+ ```sh
61
+ uv run pytest
62
+ ```
63
+
64
+ Lint files:
65
+
66
+ ```sh
67
+ uv run pre-commit run --all-files
68
+ ```
@@ -0,0 +1,38 @@
1
+ # trace-light
2
+
3
+ [![License](https://img.shields.io/pypi/l/trace-light.svg?color=green)](https://github.com/kevinyamauchi/trace-light/raw/main/LICENSE)
4
+ [![PyPI](https://img.shields.io/pypi/v/trace-light.svg?color=green)](https://pypi.org/project/trace-light)
5
+ [![Python Version](https://img.shields.io/pypi/pyversions/trace-light.svg?color=green)](https://python.org)
6
+ [![CI](https://github.com/kevinyamauchi/trace-light/actions/workflows/ci.yml/badge.svg)](https://github.com/kevinyamauchi/trace-light/actions/workflows/ci.yml)
7
+ [![codecov](https://codecov.io/gh/kevinyamauchi/trace-light/branch/main/graph/badge.svg)](https://codecov.io/gh/kevinyamauchi/trace-light)
8
+
9
+ a light raytracing library
10
+
11
+ > This library is heavily inspired by and in part derived from
12
+ > [Optiland](https://github.com/optiland/optiland) (MIT License).
13
+ > See [NOTICE](NOTICE) for details.
14
+
15
+ ## Development
16
+
17
+ The easiest way to get started is to use the [github cli](https://cli.github.com)
18
+ and [uv](https://docs.astral.sh/uv/getting-started/installation/):
19
+
20
+ ```sh
21
+ gh repo fork kevinyamauchi/trace-light --clone
22
+ # or just
23
+ # gh repo clone kevinyamauchi/trace-light
24
+ cd trace-light
25
+ uv sync
26
+ ```
27
+
28
+ Run tests:
29
+
30
+ ```sh
31
+ uv run pytest
32
+ ```
33
+
34
+ Lint files:
35
+
36
+ ```sh
37
+ uv run pre-commit run --all-files
38
+ ```