RayCrafter 0.0.1__tar.gz → 0.0.4__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.
- {raycrafter-0.0.1 → raycrafter-0.0.4}/.github/workflows/test_and_deploy.yml +13 -1
- {raycrafter-0.0.1 → raycrafter-0.0.4}/CLAUDE.md +55 -11
- raycrafter-0.0.4/Changelog.md +34 -0
- raycrafter-0.0.4/PKG-INFO +166 -0
- raycrafter-0.0.4/README.md +128 -0
- raycrafter-0.0.4/RayCrafter.egg-info/PKG-INFO +166 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/RayCrafter.egg-info/SOURCES.txt +31 -2
- {raycrafter-0.0.1 → raycrafter-0.0.4}/RayCrafter.egg-info/entry_points.txt +1 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/RayCrafter.egg-info/requires.txt +5 -1
- raycrafter-0.0.4/RayCrafter.egg-info/scm_file_list.json +98 -0
- raycrafter-0.0.4/RayCrafter.egg-info/scm_version.json +8 -0
- raycrafter-0.0.4/log.md +310 -0
- raycrafter-0.0.4/optiland_fix.md +47 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/pyproject.toml +12 -9
- raycrafter-0.0.4/raycrafter/__init__.py +28 -0
- raycrafter-0.0.4/raycrafter/api.py +901 -0
- raycrafter-0.0.4/raycrafter/assembly_methods.py +145 -0
- raycrafter-0.0.4/raycrafter/core/analysis.py +598 -0
- raycrafter-0.0.4/raycrafter/core/assemblies.py +144 -0
- raycrafter-0.0.4/raycrafter/core/gaps.py +255 -0
- raycrafter-0.0.4/raycrafter/core/history.py +156 -0
- raycrafter-0.0.4/raycrafter/core/model.py +870 -0
- raycrafter-0.0.4/raycrafter/core/optic_builder.py +206 -0
- raycrafter-0.0.4/raycrafter/core/plot_geometry.py +144 -0
- raycrafter-0.0.4/raycrafter/core/project_file.py +562 -0
- raycrafter-0.0.4/raycrafter/core/ray_launch.py +158 -0
- raycrafter-0.0.4/raycrafter/core/state.py +366 -0
- raycrafter-0.0.4/raycrafter/core/user_parts.py +183 -0
- raycrafter-0.0.4/raycrafter/core/zmx_import.py +789 -0
- raycrafter-0.0.4/raycrafter/design_files.py +149 -0
- raycrafter-0.0.4/raycrafter/gap_methods.py +146 -0
- raycrafter-0.0.4/raycrafter/gui/about_dialog.py +48 -0
- raycrafter-0.0.4/raycrafter/gui/agent_link.py +106 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/gui/analysis_panels.py +71 -52
- raycrafter-0.0.4/raycrafter/gui/app.py +54 -0
- raycrafter-0.0.4/raycrafter/gui/bench_viewer.py +270 -0
- raycrafter-0.0.4/raycrafter/gui/compile_notice.py +38 -0
- raycrafter-0.0.4/raycrafter/gui/field_editor.py +341 -0
- raycrafter-0.0.4/raycrafter/gui/file_actions.py +304 -0
- raycrafter-0.0.4/raycrafter/gui/gap_dimensions.py +252 -0
- raycrafter-0.0.4/raycrafter/gui/lens_picker.py +377 -0
- raycrafter-0.0.4/raycrafter/gui/lens_shapes.py +254 -0
- raycrafter-0.0.4/raycrafter/gui/main_window.py +867 -0
- raycrafter-0.0.4/raycrafter/gui/range_slider.py +130 -0
- raycrafter-0.0.4/raycrafter/gui/side_view.py +846 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/gui/style.py +39 -2
- raycrafter-0.0.4/raycrafter/gui/undo_keys.py +37 -0
- raycrafter-0.0.4/raycrafter/lenscatalog/catalog.py +100 -0
- raycrafter-0.0.4/raycrafter/lenscatalog/data/thorlabs.json.gz +0 -0
- raycrafter-0.0.4/raycrafter/lenscatalog/selection.py +195 -0
- raycrafter-0.0.4/raycrafter/lenscatalog/thorlabs.py +132 -0
- raycrafter-0.0.4/raycrafter/mcp_server/__init__.py +6 -0
- raycrafter-0.0.4/raycrafter/mcp_server/link.py +195 -0
- raycrafter-0.0.4/raycrafter/mcp_server/server.py +120 -0
- raycrafter-0.0.4/raycrafter/mcp_server/tools.py +699 -0
- raycrafter-0.0.4/raycrafter/palette.py +99 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/report/explanations.py +3 -3
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/report/figures.py +123 -48
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/report/html_report.py +50 -23
- raycrafter-0.0.4/scripts/make_thorlabs_catalog.py +70 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/uv.lock +694 -451
- raycrafter-0.0.1/PKG-INFO +0 -68
- raycrafter-0.0.1/README.md +0 -32
- raycrafter-0.0.1/RayCrafter.egg-info/PKG-INFO +0 -68
- raycrafter-0.0.1/RayCrafter.egg-info/scm_file_list.json +0 -51
- raycrafter-0.0.1/RayCrafter.egg-info/scm_version.json +0 -8
- raycrafter-0.0.1/log.md +0 -88
- raycrafter-0.0.1/raycrafter/__init__.py +0 -7
- raycrafter-0.0.1/raycrafter/core/analysis.py +0 -420
- raycrafter-0.0.1/raycrafter/core/model.py +0 -306
- raycrafter-0.0.1/raycrafter/core/optic_builder.py +0 -110
- raycrafter-0.0.1/raycrafter/core/plot_geometry.py +0 -93
- raycrafter-0.0.1/raycrafter/core/state.py +0 -111
- raycrafter-0.0.1/raycrafter/gui/app.py +0 -24
- raycrafter-0.0.1/raycrafter/gui/main_window.py +0 -483
- raycrafter-0.0.1/raycrafter/gui/side_view.py +0 -468
- raycrafter-0.0.1/raycrafter/lenscatalog/catalog.py +0 -103
- raycrafter-0.0.1/raycrafter/lenscatalog/data/thorlabs_achromats.json +0 -544
- raycrafter-0.0.1/raycrafter/lenscatalog/thorlabs.py +0 -85
- raycrafter-0.0.1/raycrafter/palette.py +0 -22
- raycrafter-0.0.1/scripts/make_thorlabs_subset.py +0 -59
- {raycrafter-0.0.1 → raycrafter-0.0.4}/.gitignore +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/LICENSE +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/MANIFEST.in +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/RayCrafter.egg-info/dependency_links.txt +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/RayCrafter.egg-info/top_level.txt +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/__main__.py +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/core/__init__.py +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/core/prescription.py +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/gui/__init__.py +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/lenscatalog/__init__.py +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/report/__init__.py +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/report/assets/report.css +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/raycrafter/report/assets/report.js +0 -0
- {raycrafter-0.0.1 → raycrafter-0.0.4}/setup.cfg +0 -0
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
name: tests
|
|
2
2
|
|
|
3
|
+
# Run on pushes to main (including merges into it), on every pull request (before it is
|
|
4
|
+
# merged), on tags (which also publish to PyPI), and by hand from the Actions tab. Pushes to
|
|
5
|
+
# other branches, such as dev, are not tested here; run the tests locally or open a PR.
|
|
3
6
|
on:
|
|
4
7
|
push:
|
|
5
8
|
branches:
|
|
6
|
-
-
|
|
9
|
+
- main
|
|
7
10
|
tags:
|
|
8
11
|
- '*'
|
|
9
12
|
pull_request:
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
# A newer push to the same branch or PR cancels the run still going for the older one.
|
|
16
|
+
# Release (tag) runs are never cancelled.
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
19
|
+
cancel-in-progress: ${{ github.ref_type != 'tag' }}
|
|
10
20
|
|
|
11
21
|
jobs:
|
|
12
22
|
linting:
|
|
@@ -44,6 +54,8 @@ jobs:
|
|
|
44
54
|
- uses: neuroinformatics-unit/actions/test@v2
|
|
45
55
|
with:
|
|
46
56
|
python-version: ${{ matrix.python-version }}
|
|
57
|
+
# Needed to upload the coverage report to codecov.io (see the README badge).
|
|
58
|
+
secret-codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
|
47
59
|
|
|
48
60
|
build_sdist_wheels:
|
|
49
61
|
name: Build source distribution
|
|
@@ -14,12 +14,19 @@ little or no AI. If something would confuse a careful human reader, it is wrong.
|
|
|
14
14
|
calls on it. It holds no optical state of its own beyond what it needs to draw.
|
|
15
15
|
- **Object-oriented, modular.** One clear responsibility per module. Subpackages must be usable
|
|
16
16
|
on their own, e.g. `from raycrafter.lenscatalog import thorlabs` must not pull in Qt or the GUI.
|
|
17
|
+
- **Responsiveness first.** The GUI must respond immediately, on slow machines too (Optiland
|
|
18
|
+
is noticeably slower on some). Be very careful about what is calculated on every change
|
|
19
|
+
(each drag event or slider tick): only what the user is watching while they drag. Anything
|
|
20
|
+
else goes on the slow path (after changes settle) or runs only once nothing is being
|
|
21
|
+
dragged, as the f-number does (`MainWindow.is_dragging`). Measure what you add to the fast
|
|
22
|
+
path; the side view shows the trace and draw times.
|
|
17
23
|
- **File size.** Aim for files under about 1000 lines. This is a soft limit: if a file has to be
|
|
18
24
|
bigger, say why in `log.md`.
|
|
19
25
|
- **Optiland.** It is pinned to a tested minor version in `pyproject.toml`. Any workaround for an
|
|
20
26
|
Optiland bug goes in one clearly marked place, with a comment that links to the upstream issue.
|
|
21
27
|
Delete the workaround once the fix is released. When new versions of Optiland are released:
|
|
22
|
-
test them and upgrade as soon as possible.
|
|
28
|
+
test them and upgrade as soon as possible. Every workaround, and every upstream fix we are
|
|
29
|
+
waiting for, is recorded in `optiland_fix.md` (see Releases for the check at each release).
|
|
23
30
|
|
|
24
31
|
Package layout:
|
|
25
32
|
|
|
@@ -59,24 +66,61 @@ raycrafter/
|
|
|
59
66
|
|
|
60
67
|
# Workflow
|
|
61
68
|
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
- **Branches.** Small, self-contained changes go straight onto `main`. A longer job that
|
|
70
|
+
will take a series of commits is done on the long-lived `dev` branch; once it is complete
|
|
71
|
+
and the local tests pass, `dev` is merged into `main`. Before starting on `dev`, merge
|
|
72
|
+
`main` into it so it has any small fixes made there. A feature branch is used only for
|
|
73
|
+
risky or experimental work: it branches from `dev`, merges back into `dev`, and is then
|
|
74
|
+
deleted. Pull requests (from forks or feature branches) target `dev`, never `main`.
|
|
75
|
+
- **CI** runs on pushes to `main`, on every pull request, on tags, and by hand from the
|
|
76
|
+
Actions tab. Pushes to `dev` or feature branches are not tested by CI, so the local checks
|
|
77
|
+
below are what stand between them and `main`.
|
|
65
78
|
- Use GitHub issues for substantial bugs, features and design questions, so there is a public
|
|
66
79
|
record of what was done and why. Reference the issue in commits and PRs.
|
|
80
|
+
- **Known problems.** For now, while the project is young, a feature is done when it does
|
|
81
|
+
what its issue asks, even if not all of its ramifications are resolved. Each significant
|
|
82
|
+
ramification left unsolved (e.g. something a file format cannot store, or an analysis that
|
|
83
|
+
ignores a new setting) gets its own issue with the `known problem` label. The feature's
|
|
84
|
+
issue is then closed with a comment linking to those known problems. This lets us move
|
|
85
|
+
forward quickly. We will review this choice as the project develops: later we may be
|
|
86
|
+
stricter and keep a feature's issue open until all its ramifications are resolved.
|
|
67
87
|
- Before committing, run `uv run pre-commit run --all-files` and `uv run pytest`.
|
|
68
|
-
- Agents may create or comment on issues, and
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
approval from Rob.
|
|
73
|
-
- Versions come from git tags via setuptools-scm, using semantic versioning. Pushing a
|
|
74
|
-
`vX.Y.Z` tag publishes to PyPI.
|
|
88
|
+
- Agents may create or comment on issues, push `dev` and feature branches, and open pull
|
|
89
|
+
requests into `dev`.
|
|
90
|
+
- Small changes on `main` may be committed and pushed without asking. Merging `dev` into
|
|
91
|
+
`main`, tagging and releasing need explicit approval from Rob.
|
|
75
92
|
- Stop and ask at natural check-points rather than finishing large pieces of work in one go.
|
|
76
93
|
- Expect that people may have changed files you recently worked on or are working on now.
|
|
77
94
|
Re-read a file before modifying it; otherwise you risk reverting a human developer's saved
|
|
78
95
|
changes.
|
|
79
96
|
|
|
97
|
+
## Releases
|
|
98
|
+
|
|
99
|
+
- **Optiland check, before the code review.** When a release is being prepared, first check
|
|
100
|
+
whether Optiland has a new release (`gh release list --repo optiland/optiland`). If it has:
|
|
101
|
+
1. Switch to it (update the pin in `pyproject.toml` and `uv.lock`).
|
|
102
|
+
2. Go through `optiland_fix.md` and remove every workaround the new release makes
|
|
103
|
+
unnecessary. Move its entry to "Retired".
|
|
104
|
+
3. Re-patch anything that is still broken, and make sure each remaining workaround is in
|
|
105
|
+
`optiland_fix.md` with its upstream issue link (file an issue if there is none; ask Rob
|
|
106
|
+
before filing, and search existing issues first).
|
|
107
|
+
4. Run the full tests and pre-commit hooks.
|
|
108
|
+
Only then start the adversarial code review below. Update the "last checked" date in
|
|
109
|
+
`optiland_fix.md` even when there is no new release.
|
|
110
|
+
- When it is time for a new release, you will first conduct an adversarial code review of
|
|
111
|
+
work down between now and the last release. The main task of the review will be to find
|
|
112
|
+
bugs that may have been introduced. However, you should also verify that the changes made
|
|
113
|
+
are in keeping with the design plan of the software. Once any fixes have been applied
|
|
114
|
+
after the review ends, it is OK to increment the version and deploy the new release.
|
|
115
|
+
- Versions come from git tags via setuptools-scm, using semantic versioning. Pushing a
|
|
116
|
+
`vX.Y.Z` tag publishes to PyPI. Always verify your proposed new version number with the
|
|
117
|
+
human managing the project.
|
|
118
|
+
- You will write a release message that succinctly summarises the changes in the release.
|
|
119
|
+
This will be placed in the release message on GitHub. You will also maintain a Changelog.md
|
|
120
|
+
that is designed to be read by a human who wishes to see the evolution of the project.
|
|
121
|
+
The changelog must be very succinct and orderly. You have a tendency to be over-complete.
|
|
122
|
+
Do not do this. Place links to issues and links to release messages for people who may
|
|
123
|
+
wish more information.
|
|
80
124
|
|
|
81
125
|
# Environment
|
|
82
126
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Each release also has a release message on
|
|
4
|
+
[GitHub](https://github.com/raycrafter-optical-design/raycrafter/releases).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## [0.0.4](https://github.com/raycrafter-optical-design/raycrafter/releases/tag/v0.0.4) (2026-11-26)
|
|
8
|
+
|
|
9
|
+
Version 0.0.3 was skipped.
|
|
10
|
+
|
|
11
|
+
- Project files (`.raycrafter`) keep the whole design, and the Zemax file it was imported from ([#40](https://github.com/raycrafter-optical-design/raycrafter/issues/40)).
|
|
12
|
+
- Undo and redo ([#37](https://github.com/raycrafter-optical-design/raycrafter/issues/37)).
|
|
13
|
+
- Gaps between lenses are shown, can be typed and locked ([#35](https://github.com/raycrafter-optical-design/raycrafter/issues/35), [#36](https://github.com/raycrafter-optical-design/raycrafter/issues/36)).
|
|
14
|
+
- Assemblies: group lenses, flip them as one, save them as user parts. Plossl pairs are assemblies ([#43](https://github.com/raycrafter-optical-design/raycrafter/issues/43)).
|
|
15
|
+
- Fields are defined at a source plane with its own position ([#41](https://github.com/raycrafter-optical-design/raycrafter/issues/41)).
|
|
16
|
+
- Python scripting API, `raycrafter.Bench` ([#31](https://github.com/raycrafter-optical-design/raycrafter/issues/31)).
|
|
17
|
+
- MCP server for AI agents, which can also drive the open window ([#26](https://github.com/raycrafter-optical-design/raycrafter/issues/26), [#28](https://github.com/raycrafter-optical-design/raycrafter/issues/28)).
|
|
18
|
+
- Bench viewer and part metadata ([#34](https://github.com/raycrafter-optical-design/raycrafter/issues/34), [#42](https://github.com/raycrafter-optical-design/raycrafter/issues/42)).
|
|
19
|
+
- Zemax import aims fields through the stop and reads apertures properly; the side view fits the design ([#17](https://github.com/raycrafter-optical-design/raycrafter/issues/17)–[#21](https://github.com/raycrafter-optical-design/raycrafter/issues/21)).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.0.2](https://github.com/raycrafter-optical-design/raycrafter/releases/tag/v0.0.2) (2026-11-24)
|
|
23
|
+
|
|
24
|
+
- Lens picker dialog and the full Thorlabs catalogue ([#1](https://github.com/raycrafter-optical-design/raycrafter/issues/1)).
|
|
25
|
+
- Rays outside a lens's clear aperture are blocked; slow analyses wait until a drag ends ([#3](https://github.com/raycrafter-optical-design/raycrafter/issues/3)).
|
|
26
|
+
- Paraxial (ideal thin) lenses ([#6](https://github.com/raycrafter-optical-design/raycrafter/issues/6)).
|
|
27
|
+
- Several fields (beams), edited live in a field window ([#7](https://github.com/raycrafter-optical-design/raycrafter/issues/7)).
|
|
28
|
+
- File menu: new, save and load Zemax `.zmx` files ([#8](https://github.com/raycrafter-optical-design/raycrafter/issues/8)).
|
|
29
|
+
- Requires Python 3.12+ and PyQt6 6.8+.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## 0.0.1 (2026-11-23)
|
|
33
|
+
|
|
34
|
+
First preview release.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RayCrafter
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Raytracing GUI for simple optical systems using off-the-shelf lenses and Optiland
|
|
5
|
+
Author-email: Rob Campbell <git@raacampbell.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Source Code, https://github.com/raycrafter-optical-design/raycrafter
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/raycrafter-optical-design/raycrafter/issues
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
16
|
+
Requires-Python: >=3.12.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: optiland<0.7,>=0.6.3
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: PyQt6>=6.8
|
|
24
|
+
Requires-Dist: pyqtgraph>=0.14
|
|
25
|
+
Provides-Extra: mcp
|
|
26
|
+
Requires-Dist: mcp<2.4,>=2.3; extra == "mcp"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mcp<2.4,>=2.3; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
31
|
+
Requires-Dist: coverage; extra == "dev"
|
|
32
|
+
Requires-Dist: tox; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff; extra == "dev"
|
|
36
|
+
Requires-Dist: setuptools-scm; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# RayCrafter
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/raycrafter)
|
|
42
|
+
[](https://pypi.org/project/raycrafter)
|
|
43
|
+
[](https://github.com/raycrafter-optical-design/raycrafter/blob/main/LICENSE)
|
|
44
|
+
[](https://github.com/raycrafter-optical-design/raycrafter/actions/workflows/test_and_deploy.yml)
|
|
45
|
+
[](https://github.com/astral-sh/ruff)
|
|
46
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
47
|
+
[](https://codecov.io/gh/raycrafter-optical-design/raycrafter)
|
|
48
|
+
|
|
49
|
+
RayCrafter is an early proof of principle for a lens-level optical design tool. You place
|
|
50
|
+
off-the-shelf lenses on an optical axis, drag them around, and see the spot diagram,
|
|
51
|
+
through-focus curve, MTF, ray fan and field curvature update as you go. The ray tracing is
|
|
52
|
+
done by [Optiland](https://github.com/HarrisonKramer/optiland).
|
|
53
|
+
|
|
54
|
+
At present it offers the Thorlabs spherical lenses and ideal (paraxial) lenses, and any number
|
|
55
|
+
of beams, each with its own width, angle, vergence, offset and wavelength. It can export the
|
|
56
|
+
system as a Zemax `.zmx` file and write an HTML report.
|
|
57
|
+
|
|
58
|
+
**Status:** pre-alpha. Expect anything to change, including the API.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Install and run
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
pip install raycrafter
|
|
65
|
+
raycrafter
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or, with [uv](https://docs.astral.sh/uv/): `uvx raycrafter`.
|
|
69
|
+
|
|
70
|
+
To run the current development version from the `main` branch on GitHub, use uv directly
|
|
71
|
+
(no clone or install step needed):
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
uvx --from git+https://github.com/raycrafter-optical-design/raycrafter@main raycrafter
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The MCP server from `main` can be run the same way (see below):
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
uvx --from "raycrafter[mcp] @ git+https://github.com/raycrafter-optical-design/raycrafter@main" raycrafter-mcp
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`main` may contain changes not yet in the PyPI release, so behaviour may differ from
|
|
84
|
+
`pip install raycrafter`.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Use it from Python
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from raycrafter import Bench
|
|
91
|
+
|
|
92
|
+
bench = Bench(empty=True) # or Bench.connect() to drive the open window
|
|
93
|
+
bench.add_lens("AC254-100-A")
|
|
94
|
+
bench.add_lens("AC254-050-A", front_z_mm=150)
|
|
95
|
+
bench.autofocus()
|
|
96
|
+
print(bench.summary())
|
|
97
|
+
bench.plot("spot_diagram").savefig("spot.png")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Every method is documented, with examples, in `raycrafter/api.py`.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## Use it from an AI agent
|
|
104
|
+
|
|
105
|
+
RayCrafter includes an [MCP](https://modelcontextprotocol.io) server, so an AI agent such as
|
|
106
|
+
Claude can search for lenses, build and edit a design, and read back the optics.
|
|
107
|
+
|
|
108
|
+
If a RayCrafter window is open, the agent controls that window: you watch its changes happen,
|
|
109
|
+
and you can also move lenses yourself and ask the agent about the result. (The window listens
|
|
110
|
+
only on your own computer, and writes a private file in `~/.raycrafter` so the server can find
|
|
111
|
+
it. Start with `raycrafter --no-agent-link` to turn this off.) If no window is open, the server
|
|
112
|
+
works on a design of its own, with no picture. Every result says which one it came from.
|
|
113
|
+
|
|
114
|
+
**1. Install the MCP extra.**
|
|
115
|
+
|
|
116
|
+
- With pip: `pip install "raycrafter[mcp]"`. This installs the `raycrafter-mcp` command.
|
|
117
|
+
- With [uv](https://docs.astral.sh/uv/): `uv tool install "raycrafter[mcp]"` installs both
|
|
118
|
+
`raycrafter` and `raycrafter-mcp`. Or install nothing and let uv fetch it on demand; see the
|
|
119
|
+
`uvx` setting below.
|
|
120
|
+
|
|
121
|
+
**2. Tell your MCP client where it is.** In the Claude desktop app, open Settings, then
|
|
122
|
+
Developer, then Edit Config. This opens the file `claude_desktop_config.json`, which is at
|
|
123
|
+
`~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows. Add
|
|
124
|
+
RayCrafter under `mcpServers`, then quit and reopen the app:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"raycrafter": {
|
|
130
|
+
"command": "/full/path/to/raycrafter-mcp"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The path must be written out in full: the app does not expand `~`, and it may not see the same
|
|
137
|
+
`PATH` as your terminal. Find the path with `which raycrafter-mcp` (macOS, Linux) or
|
|
138
|
+
`where raycrafter-mcp` (Windows).
|
|
139
|
+
|
|
140
|
+
If you use uv and installed nothing, run RayCrafter through `uvx` instead (find its path with
|
|
141
|
+
`which uvx`):
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"raycrafter": {
|
|
147
|
+
"command": "/full/path/to/uvx",
|
|
148
|
+
"args": ["--from", "raycrafter[mcp]", "raycrafter-mcp"]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Other MCP clients (for example Claude Code: `claude mcp add raycrafter -- raycrafter-mcp`) take
|
|
155
|
+
the same command.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## An agent-generated project
|
|
159
|
+
|
|
160
|
+
The code in this repository is written by AI coding agents, working with the project's
|
|
161
|
+
developers. Due to time constraints, the project is only possible because of agentic
|
|
162
|
+
coding.
|
|
163
|
+
|
|
164
|
+
We nonetheless aim for well-designed, readable code that people who use little or no AI can
|
|
165
|
+
understand and contribute to. The rules the agents follow are in [CLAUDE.md](CLAUDE.md), and
|
|
166
|
+
significant decisions, with their reasons, are recorded in [log.md](log.md).
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# RayCrafter
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/raycrafter)
|
|
4
|
+
[](https://pypi.org/project/raycrafter)
|
|
5
|
+
[](https://github.com/raycrafter-optical-design/raycrafter/blob/main/LICENSE)
|
|
6
|
+
[](https://github.com/raycrafter-optical-design/raycrafter/actions/workflows/test_and_deploy.yml)
|
|
7
|
+
[](https://github.com/astral-sh/ruff)
|
|
8
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
9
|
+
[](https://codecov.io/gh/raycrafter-optical-design/raycrafter)
|
|
10
|
+
|
|
11
|
+
RayCrafter is an early proof of principle for a lens-level optical design tool. You place
|
|
12
|
+
off-the-shelf lenses on an optical axis, drag them around, and see the spot diagram,
|
|
13
|
+
through-focus curve, MTF, ray fan and field curvature update as you go. The ray tracing is
|
|
14
|
+
done by [Optiland](https://github.com/HarrisonKramer/optiland).
|
|
15
|
+
|
|
16
|
+
At present it offers the Thorlabs spherical lenses and ideal (paraxial) lenses, and any number
|
|
17
|
+
of beams, each with its own width, angle, vergence, offset and wavelength. It can export the
|
|
18
|
+
system as a Zemax `.zmx` file and write an HTML report.
|
|
19
|
+
|
|
20
|
+
**Status:** pre-alpha. Expect anything to change, including the API.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Install and run
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pip install raycrafter
|
|
27
|
+
raycrafter
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or, with [uv](https://docs.astral.sh/uv/): `uvx raycrafter`.
|
|
31
|
+
|
|
32
|
+
To run the current development version from the `main` branch on GitHub, use uv directly
|
|
33
|
+
(no clone or install step needed):
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
uvx --from git+https://github.com/raycrafter-optical-design/raycrafter@main raycrafter
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The MCP server from `main` can be run the same way (see below):
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
uvx --from "raycrafter[mcp] @ git+https://github.com/raycrafter-optical-design/raycrafter@main" raycrafter-mcp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`main` may contain changes not yet in the PyPI release, so behaviour may differ from
|
|
46
|
+
`pip install raycrafter`.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Use it from Python
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from raycrafter import Bench
|
|
53
|
+
|
|
54
|
+
bench = Bench(empty=True) # or Bench.connect() to drive the open window
|
|
55
|
+
bench.add_lens("AC254-100-A")
|
|
56
|
+
bench.add_lens("AC254-050-A", front_z_mm=150)
|
|
57
|
+
bench.autofocus()
|
|
58
|
+
print(bench.summary())
|
|
59
|
+
bench.plot("spot_diagram").savefig("spot.png")
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Every method is documented, with examples, in `raycrafter/api.py`.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Use it from an AI agent
|
|
66
|
+
|
|
67
|
+
RayCrafter includes an [MCP](https://modelcontextprotocol.io) server, so an AI agent such as
|
|
68
|
+
Claude can search for lenses, build and edit a design, and read back the optics.
|
|
69
|
+
|
|
70
|
+
If a RayCrafter window is open, the agent controls that window: you watch its changes happen,
|
|
71
|
+
and you can also move lenses yourself and ask the agent about the result. (The window listens
|
|
72
|
+
only on your own computer, and writes a private file in `~/.raycrafter` so the server can find
|
|
73
|
+
it. Start with `raycrafter --no-agent-link` to turn this off.) If no window is open, the server
|
|
74
|
+
works on a design of its own, with no picture. Every result says which one it came from.
|
|
75
|
+
|
|
76
|
+
**1. Install the MCP extra.**
|
|
77
|
+
|
|
78
|
+
- With pip: `pip install "raycrafter[mcp]"`. This installs the `raycrafter-mcp` command.
|
|
79
|
+
- With [uv](https://docs.astral.sh/uv/): `uv tool install "raycrafter[mcp]"` installs both
|
|
80
|
+
`raycrafter` and `raycrafter-mcp`. Or install nothing and let uv fetch it on demand; see the
|
|
81
|
+
`uvx` setting below.
|
|
82
|
+
|
|
83
|
+
**2. Tell your MCP client where it is.** In the Claude desktop app, open Settings, then
|
|
84
|
+
Developer, then Edit Config. This opens the file `claude_desktop_config.json`, which is at
|
|
85
|
+
`~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows. Add
|
|
86
|
+
RayCrafter under `mcpServers`, then quit and reopen the app:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"raycrafter": {
|
|
92
|
+
"command": "/full/path/to/raycrafter-mcp"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The path must be written out in full: the app does not expand `~`, and it may not see the same
|
|
99
|
+
`PATH` as your terminal. Find the path with `which raycrafter-mcp` (macOS, Linux) or
|
|
100
|
+
`where raycrafter-mcp` (Windows).
|
|
101
|
+
|
|
102
|
+
If you use uv and installed nothing, run RayCrafter through `uvx` instead (find its path with
|
|
103
|
+
`which uvx`):
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"mcpServers": {
|
|
108
|
+
"raycrafter": {
|
|
109
|
+
"command": "/full/path/to/uvx",
|
|
110
|
+
"args": ["--from", "raycrafter[mcp]", "raycrafter-mcp"]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Other MCP clients (for example Claude Code: `claude mcp add raycrafter -- raycrafter-mcp`) take
|
|
117
|
+
the same command.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## An agent-generated project
|
|
121
|
+
|
|
122
|
+
The code in this repository is written by AI coding agents, working with the project's
|
|
123
|
+
developers. Due to time constraints, the project is only possible because of agentic
|
|
124
|
+
coding.
|
|
125
|
+
|
|
126
|
+
We nonetheless aim for well-designed, readable code that people who use little or no AI can
|
|
127
|
+
understand and contribute to. The rules the agents follow are in [CLAUDE.md](CLAUDE.md), and
|
|
128
|
+
significant decisions, with their reasons, are recorded in [log.md](log.md).
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: RayCrafter
|
|
3
|
+
Version: 0.0.4
|
|
4
|
+
Summary: Raytracing GUI for simple optical systems using off-the-shelf lenses and Optiland
|
|
5
|
+
Author-email: Rob Campbell <git@raacampbell.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Source Code, https://github.com/raycrafter-optical-design/raycrafter
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/raycrafter-optical-design/raycrafter/issues
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
16
|
+
Requires-Python: >=3.12.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: optiland<0.7,>=0.6.3
|
|
20
|
+
Requires-Dist: numpy
|
|
21
|
+
Requires-Dist: scipy
|
|
22
|
+
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: PyQt6>=6.8
|
|
24
|
+
Requires-Dist: pyqtgraph>=0.14
|
|
25
|
+
Provides-Extra: mcp
|
|
26
|
+
Requires-Dist: mcp<2.4,>=2.3; extra == "mcp"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mcp<2.4,>=2.3; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
31
|
+
Requires-Dist: coverage; extra == "dev"
|
|
32
|
+
Requires-Dist: tox; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff; extra == "dev"
|
|
36
|
+
Requires-Dist: setuptools-scm; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# RayCrafter
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/raycrafter)
|
|
42
|
+
[](https://pypi.org/project/raycrafter)
|
|
43
|
+
[](https://github.com/raycrafter-optical-design/raycrafter/blob/main/LICENSE)
|
|
44
|
+
[](https://github.com/raycrafter-optical-design/raycrafter/actions/workflows/test_and_deploy.yml)
|
|
45
|
+
[](https://github.com/astral-sh/ruff)
|
|
46
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
47
|
+
[](https://codecov.io/gh/raycrafter-optical-design/raycrafter)
|
|
48
|
+
|
|
49
|
+
RayCrafter is an early proof of principle for a lens-level optical design tool. You place
|
|
50
|
+
off-the-shelf lenses on an optical axis, drag them around, and see the spot diagram,
|
|
51
|
+
through-focus curve, MTF, ray fan and field curvature update as you go. The ray tracing is
|
|
52
|
+
done by [Optiland](https://github.com/HarrisonKramer/optiland).
|
|
53
|
+
|
|
54
|
+
At present it offers the Thorlabs spherical lenses and ideal (paraxial) lenses, and any number
|
|
55
|
+
of beams, each with its own width, angle, vergence, offset and wavelength. It can export the
|
|
56
|
+
system as a Zemax `.zmx` file and write an HTML report.
|
|
57
|
+
|
|
58
|
+
**Status:** pre-alpha. Expect anything to change, including the API.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Install and run
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
pip install raycrafter
|
|
65
|
+
raycrafter
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or, with [uv](https://docs.astral.sh/uv/): `uvx raycrafter`.
|
|
69
|
+
|
|
70
|
+
To run the current development version from the `main` branch on GitHub, use uv directly
|
|
71
|
+
(no clone or install step needed):
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
uvx --from git+https://github.com/raycrafter-optical-design/raycrafter@main raycrafter
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The MCP server from `main` can be run the same way (see below):
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
uvx --from "raycrafter[mcp] @ git+https://github.com/raycrafter-optical-design/raycrafter@main" raycrafter-mcp
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`main` may contain changes not yet in the PyPI release, so behaviour may differ from
|
|
84
|
+
`pip install raycrafter`.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Use it from Python
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from raycrafter import Bench
|
|
91
|
+
|
|
92
|
+
bench = Bench(empty=True) # or Bench.connect() to drive the open window
|
|
93
|
+
bench.add_lens("AC254-100-A")
|
|
94
|
+
bench.add_lens("AC254-050-A", front_z_mm=150)
|
|
95
|
+
bench.autofocus()
|
|
96
|
+
print(bench.summary())
|
|
97
|
+
bench.plot("spot_diagram").savefig("spot.png")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Every method is documented, with examples, in `raycrafter/api.py`.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
## Use it from an AI agent
|
|
104
|
+
|
|
105
|
+
RayCrafter includes an [MCP](https://modelcontextprotocol.io) server, so an AI agent such as
|
|
106
|
+
Claude can search for lenses, build and edit a design, and read back the optics.
|
|
107
|
+
|
|
108
|
+
If a RayCrafter window is open, the agent controls that window: you watch its changes happen,
|
|
109
|
+
and you can also move lenses yourself and ask the agent about the result. (The window listens
|
|
110
|
+
only on your own computer, and writes a private file in `~/.raycrafter` so the server can find
|
|
111
|
+
it. Start with `raycrafter --no-agent-link` to turn this off.) If no window is open, the server
|
|
112
|
+
works on a design of its own, with no picture. Every result says which one it came from.
|
|
113
|
+
|
|
114
|
+
**1. Install the MCP extra.**
|
|
115
|
+
|
|
116
|
+
- With pip: `pip install "raycrafter[mcp]"`. This installs the `raycrafter-mcp` command.
|
|
117
|
+
- With [uv](https://docs.astral.sh/uv/): `uv tool install "raycrafter[mcp]"` installs both
|
|
118
|
+
`raycrafter` and `raycrafter-mcp`. Or install nothing and let uv fetch it on demand; see the
|
|
119
|
+
`uvx` setting below.
|
|
120
|
+
|
|
121
|
+
**2. Tell your MCP client where it is.** In the Claude desktop app, open Settings, then
|
|
122
|
+
Developer, then Edit Config. This opens the file `claude_desktop_config.json`, which is at
|
|
123
|
+
`~/Library/Application Support/Claude/` on macOS and `%APPDATA%\Claude\` on Windows. Add
|
|
124
|
+
RayCrafter under `mcpServers`, then quit and reopen the app:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"raycrafter": {
|
|
130
|
+
"command": "/full/path/to/raycrafter-mcp"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The path must be written out in full: the app does not expand `~`, and it may not see the same
|
|
137
|
+
`PATH` as your terminal. Find the path with `which raycrafter-mcp` (macOS, Linux) or
|
|
138
|
+
`where raycrafter-mcp` (Windows).
|
|
139
|
+
|
|
140
|
+
If you use uv and installed nothing, run RayCrafter through `uvx` instead (find its path with
|
|
141
|
+
`which uvx`):
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"raycrafter": {
|
|
147
|
+
"command": "/full/path/to/uvx",
|
|
148
|
+
"args": ["--from", "raycrafter[mcp]", "raycrafter-mcp"]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Other MCP clients (for example Claude Code: `claude mcp add raycrafter -- raycrafter-mcp`) take
|
|
155
|
+
the same command.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## An agent-generated project
|
|
159
|
+
|
|
160
|
+
The code in this repository is written by AI coding agents, working with the project's
|
|
161
|
+
developers. Due to time constraints, the project is only possible because of agentic
|
|
162
|
+
coding.
|
|
163
|
+
|
|
164
|
+
We nonetheless aim for well-designed, readable code that people who use little or no AI can
|
|
165
|
+
understand and contribute to. The rules the agents follow are in [CLAUDE.md](CLAUDE.md), and
|
|
166
|
+
significant decisions, with their reasons, are recorded in [log.md](log.md).
|