RayCrafter 0.0.4__tar.gz → 0.0.5__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 (157) hide show
  1. raycrafter-0.0.5/AGENT_WORKFLOW.md +109 -0
  2. {raycrafter-0.0.4 → raycrafter-0.0.5}/CLAUDE.md +63 -18
  3. {raycrafter-0.0.4 → raycrafter-0.0.5}/Changelog.md +15 -0
  4. {raycrafter-0.0.4 → raycrafter-0.0.5}/PKG-INFO +20 -8
  5. {raycrafter-0.0.4 → raycrafter-0.0.5}/README.md +18 -7
  6. {raycrafter-0.0.4 → raycrafter-0.0.5}/RayCrafter.egg-info/PKG-INFO +20 -8
  7. raycrafter-0.0.5/RayCrafter.egg-info/SOURCES.txt +139 -0
  8. {raycrafter-0.0.4 → raycrafter-0.0.5}/RayCrafter.egg-info/requires.txt +1 -0
  9. raycrafter-0.0.5/RayCrafter.egg-info/scm_file_list.json +199 -0
  10. raycrafter-0.0.5/RayCrafter.egg-info/scm_version.json +8 -0
  11. raycrafter-0.0.5/agent_docs/README.md +136 -0
  12. raycrafter-0.0.5/agent_docs/analyses.md +66 -0
  13. raycrafter-0.0.5/agent_docs/bench.md +190 -0
  14. raycrafter-0.0.5/agent_docs/catalog.md +36 -0
  15. raycrafter-0.0.5/agent_docs/dev.md +82 -0
  16. raycrafter-0.0.5/agent_docs/files.md +81 -0
  17. raycrafter-0.0.5/agent_docs/gui.md +182 -0
  18. raycrafter-0.0.5/agent_docs/optics.md +116 -0
  19. raycrafter-0.0.5/agent_docs/report3d.md +44 -0
  20. raycrafter-0.0.5/agent_docs/scripting.md +63 -0
  21. raycrafter-0.0.5/log.md +9 -0
  22. {raycrafter-0.0.4 → raycrafter-0.0.5}/optiland_fix.md +19 -3
  23. {raycrafter-0.0.4 → raycrafter-0.0.5}/pyproject.toml +8 -6
  24. raycrafter-0.0.5/raycrafter/aperture_methods.py +84 -0
  25. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/api.py +273 -190
  26. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/assembly_methods.py +28 -27
  27. raycrafter-0.0.5/raycrafter/core/aiming.py +120 -0
  28. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/analysis.py +407 -86
  29. raycrafter-0.0.5/raycrafter/core/apertures.py +76 -0
  30. raycrafter-0.0.5/raycrafter/core/assemblies.py +190 -0
  31. raycrafter-0.0.5/raycrafter/core/detector.py +169 -0
  32. raycrafter-0.0.5/raycrafter/core/distortion.py +249 -0
  33. raycrafter-0.0.5/raycrafter/core/examples.py +71 -0
  34. raycrafter-0.0.5/raycrafter/core/field_colours.py +109 -0
  35. raycrafter-0.0.5/raycrafter/core/fields.py +150 -0
  36. raycrafter-0.0.5/raycrafter/core/gap_optimisation.py +521 -0
  37. raycrafter-0.0.5/raycrafter/core/gaps.py +296 -0
  38. raycrafter-0.0.5/raycrafter/core/key_planes.py +333 -0
  39. raycrafter-0.0.5/raycrafter/core/model.py +698 -0
  40. raycrafter-0.0.5/raycrafter/core/moving.py +330 -0
  41. raycrafter-0.0.5/raycrafter/core/optic_builder.py +348 -0
  42. raycrafter-0.0.5/raycrafter/core/placement.py +527 -0
  43. raycrafter-0.0.5/raycrafter/core/plossl.py +206 -0
  44. raycrafter-0.0.5/raycrafter/core/plot_geometry.py +329 -0
  45. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/project_file.py +324 -77
  46. raycrafter-0.0.5/raycrafter/core/ray_launch.py +683 -0
  47. raycrafter-0.0.5/raycrafter/core/replacement.py +240 -0
  48. raycrafter-0.0.5/raycrafter/core/scene.py +410 -0
  49. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/state.py +274 -38
  50. raycrafter-0.0.5/raycrafter/core/stop.py +112 -0
  51. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/user_parts.py +34 -33
  52. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/zmx_import.py +15 -16
  53. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/design_files.py +8 -4
  54. raycrafter-0.0.5/raycrafter/detector_methods.py +122 -0
  55. raycrafter-0.0.5/raycrafter/field_methods.py +221 -0
  56. raycrafter-0.0.5/raycrafter/gap_methods.py +231 -0
  57. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/agent_link.py +4 -0
  58. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/analysis_panels.py +172 -25
  59. raycrafter-0.0.5/raycrafter/gui/aperture_slider.py +85 -0
  60. raycrafter-0.0.5/raycrafter/gui/axis_glyph.py +97 -0
  61. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/bench_viewer.py +85 -62
  62. raycrafter-0.0.5/raycrafter/gui/context_bar.py +367 -0
  63. raycrafter-0.0.5/raycrafter/gui/current_first_combo.py +72 -0
  64. raycrafter-0.0.5/raycrafter/gui/detector_graphics.py +201 -0
  65. raycrafter-0.0.5/raycrafter/gui/detector_panel.py +104 -0
  66. raycrafter-0.0.5/raycrafter/gui/detector_settings.py +102 -0
  67. raycrafter-0.0.5/raycrafter/gui/field_editor.py +543 -0
  68. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/file_actions.py +21 -2
  69. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/gap_dimensions.py +5 -5
  70. raycrafter-0.0.5/raycrafter/gui/gap_optimiser.py +204 -0
  71. raycrafter-0.0.5/raycrafter/gui/hue_strip.py +105 -0
  72. raycrafter-0.0.5/raycrafter/gui/lens_browser.py +621 -0
  73. raycrafter-0.0.5/raycrafter/gui/lens_replacement.py +174 -0
  74. raycrafter-0.0.5/raycrafter/gui/lens_shapes.py +316 -0
  75. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/main_window.py +413 -301
  76. raycrafter-0.0.5/raycrafter/gui/move_to_menu.py +65 -0
  77. raycrafter-0.0.5/raycrafter/gui/plane_guide.py +237 -0
  78. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/range_slider.py +10 -4
  79. raycrafter-0.0.5/raycrafter/gui/ray_curves.py +59 -0
  80. raycrafter-0.0.5/raycrafter/gui/report_actions.py +88 -0
  81. raycrafter-0.0.5/raycrafter/gui/scaled_slider.py +213 -0
  82. raycrafter-0.0.5/raycrafter/gui/side_readouts.py +112 -0
  83. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/side_view.py +369 -248
  84. raycrafter-0.0.5/raycrafter/gui/stop_marker.py +56 -0
  85. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/style.py +76 -11
  86. raycrafter-0.0.5/raycrafter/gui/tag_labels.py +98 -0
  87. raycrafter-0.0.5/raycrafter/gui/tool_actions.py +370 -0
  88. raycrafter-0.0.5/raycrafter/gui/tool_icons.py +220 -0
  89. raycrafter-0.0.5/raycrafter/gui/tool_palette.py +134 -0
  90. raycrafter-0.0.5/raycrafter/gui/view_3d.py +184 -0
  91. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/lenscatalog/catalog.py +20 -0
  92. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/lenscatalog/selection.py +37 -16
  93. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/lenscatalog/thorlabs.py +11 -0
  94. raycrafter-0.0.5/raycrafter/mcp_server/detector_tools.py +72 -0
  95. raycrafter-0.0.5/raycrafter/mcp_server/plane_tools.py +75 -0
  96. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/mcp_server/server.py +4 -2
  97. raycrafter-0.0.5/raycrafter/mcp_server/stop_tools.py +79 -0
  98. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/mcp_server/tools.py +419 -130
  99. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/palette.py +37 -1
  100. raycrafter-0.0.5/raycrafter/plane_methods.py +87 -0
  101. raycrafter-0.0.5/raycrafter/report/__init__.py +5 -0
  102. raycrafter-0.0.5/raycrafter/report/assets/live.js +33 -0
  103. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/report/assets/report.css +17 -1
  104. raycrafter-0.0.5/raycrafter/report/assets/three/LICENSE +21 -0
  105. raycrafter-0.0.5/raycrafter/report/assets/three/OrbitControls.js +1417 -0
  106. raycrafter-0.0.5/raycrafter/report/assets/three/README.md +16 -0
  107. raycrafter-0.0.5/raycrafter/report/assets/three/three.module.min.js +6 -0
  108. raycrafter-0.0.5/raycrafter/report/assets/viewer3d.js +150 -0
  109. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/report/explanations.py +38 -0
  110. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/report/figures.py +154 -11
  111. raycrafter-0.0.5/raycrafter/report/html_report.py +362 -0
  112. raycrafter-0.0.5/raycrafter/report/live_report.py +144 -0
  113. raycrafter-0.0.5/raycrafter/report/live_server.py +156 -0
  114. raycrafter-0.0.5/raycrafter/report/report_process.py +116 -0
  115. raycrafter-0.0.5/raycrafter/report/viewer_3d.py +62 -0
  116. raycrafter-0.0.5/raycrafter/stop_methods.py +101 -0
  117. {raycrafter-0.0.4 → raycrafter-0.0.5}/uv.lock +11 -0
  118. raycrafter-0.0.4/RayCrafter.egg-info/SOURCES.txt +0 -73
  119. raycrafter-0.0.4/RayCrafter.egg-info/scm_file_list.json +0 -98
  120. raycrafter-0.0.4/RayCrafter.egg-info/scm_version.json +0 -8
  121. raycrafter-0.0.4/log.md +0 -310
  122. raycrafter-0.0.4/raycrafter/core/assemblies.py +0 -144
  123. raycrafter-0.0.4/raycrafter/core/gaps.py +0 -255
  124. raycrafter-0.0.4/raycrafter/core/model.py +0 -870
  125. raycrafter-0.0.4/raycrafter/core/optic_builder.py +0 -206
  126. raycrafter-0.0.4/raycrafter/core/plot_geometry.py +0 -144
  127. raycrafter-0.0.4/raycrafter/core/ray_launch.py +0 -158
  128. raycrafter-0.0.4/raycrafter/gap_methods.py +0 -146
  129. raycrafter-0.0.4/raycrafter/gui/field_editor.py +0 -341
  130. raycrafter-0.0.4/raycrafter/gui/lens_picker.py +0 -377
  131. raycrafter-0.0.4/raycrafter/gui/lens_shapes.py +0 -254
  132. raycrafter-0.0.4/raycrafter/report/__init__.py +0 -5
  133. raycrafter-0.0.4/raycrafter/report/html_report.py +0 -236
  134. {raycrafter-0.0.4 → raycrafter-0.0.5}/.github/workflows/test_and_deploy.yml +0 -0
  135. {raycrafter-0.0.4 → raycrafter-0.0.5}/.gitignore +0 -0
  136. {raycrafter-0.0.4 → raycrafter-0.0.5}/LICENSE +0 -0
  137. {raycrafter-0.0.4 → raycrafter-0.0.5}/MANIFEST.in +0 -0
  138. {raycrafter-0.0.4 → raycrafter-0.0.5}/RayCrafter.egg-info/dependency_links.txt +0 -0
  139. {raycrafter-0.0.4 → raycrafter-0.0.5}/RayCrafter.egg-info/entry_points.txt +0 -0
  140. {raycrafter-0.0.4 → raycrafter-0.0.5}/RayCrafter.egg-info/top_level.txt +0 -0
  141. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/__init__.py +0 -0
  142. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/__main__.py +0 -0
  143. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/__init__.py +0 -0
  144. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/history.py +0 -0
  145. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/core/prescription.py +0 -0
  146. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/__init__.py +0 -0
  147. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/about_dialog.py +0 -0
  148. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/app.py +0 -0
  149. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/compile_notice.py +0 -0
  150. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/gui/undo_keys.py +0 -0
  151. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/lenscatalog/__init__.py +0 -0
  152. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/lenscatalog/data/thorlabs.json.gz +0 -0
  153. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/mcp_server/__init__.py +0 -0
  154. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/mcp_server/link.py +0 -0
  155. {raycrafter-0.0.4 → raycrafter-0.0.5}/raycrafter/report/assets/report.js +0 -0
  156. {raycrafter-0.0.4 → raycrafter-0.0.5}/scripts/make_thorlabs_catalog.py +0 -0
  157. {raycrafter-0.0.4 → raycrafter-0.0.5}/setup.cfg +0 -0
@@ -0,0 +1,109 @@
1
+ # How coding agents work on RayCrafter
2
+
3
+ Most of RayCrafter's code is written by AI coding agents (such as Claude Code), working with the
4
+ project's developers. This page explains, for people, the notes the agents keep and how several
5
+ agents can work at the same time. The rules the agents themselves follow are in
6
+ [CLAUDE.md](CLAUDE.md), under "Agent workflow".
7
+
8
+
9
+ ## The problem
10
+
11
+ Each agent session starts with no memory of earlier ones. Without help, a new session spends
12
+ much of its time (and its limited context) re-reading the code to work out how it fits
13
+ together. Several agents working at once each pay that cost again, and can make clashing
14
+ changes.
15
+
16
+
17
+ ## The agent notes: `agent_docs/`
18
+
19
+ [`agent_docs/`](agent_docs/README.md) holds short notes for agents, one file per topic:
20
+
21
+ | File | Topic |
22
+ |---|---|
23
+ | `bench.md` | the bench state and every edit to it (placing, moving, gaps, assemblies, apertures, detector, undo) |
24
+ | `optics.md` | building the Optiland system, launching and tracing rays, fields |
25
+ | `analyses.md` | spot, through-focus, MTF, ray fan, field curvature, distortion, light on the detector |
26
+ | `catalog.md` | lens catalogues and user parts |
27
+ | `files.md` | project files and Zemax import and export |
28
+ | `gui.md` | the window |
29
+ | `report3d.md` | the HTML report, the live report and the 3D scene |
30
+ | `scripting.md` | the Python `Bench`, the MCP server and the link to the open window |
31
+ | `dev.md` | tooling, tests, CI, branches, releases |
32
+
33
+ Each file says which modules and tests the topic owns, gives a one-line map of each module, says
34
+ how to extend it and what to watch out for, and ends with the topic's **decision log**: the
35
+ significant decisions and why they were made. Every module belongs to exactly one topic; a test
36
+ (`tests/test_unit/test_agent_docs.py`) fails if a new module is not added to the notes.
37
+
38
+ `agent_docs/README.md` is read first. It lists the topics, which ones to read for common tasks,
39
+ a checklist for changes that cross topics, the conventions all topics share (units, numbering),
40
+ and the files most often changed.
41
+
42
+ The notes are written tersely, with abbreviations defined in the README (e.g. `OM` for
43
+ `OpticalModel`, dates as YYMMDD), because agents read them on every task. They are meant to be
44
+ read through an agent; they are not documentation for users. The detail stays in the code's
45
+ docstrings, which the notes point to rather than repeat. The decision log used to be a single
46
+ `log.md` in plain prose; that version is kept in git (`git show 3722753:log.md`).
47
+
48
+
49
+ ## What an agent does for each task
50
+
51
+ 1. Reads `agent_docs/README.md` and only the topic files the task needs.
52
+ 2. Proposes the change and the files it expects to touch.
53
+ 3. Reads the code it needs. Where the notes and the code disagree, the code is right and the
54
+ notes are fixed.
55
+ 4. Makes the change and runs the tests.
56
+ 5. Updates the topic's notes in the same commit, and adds to its log if a decision was made
57
+ (decisions Rob has not agreed to are asked about first).
58
+ 6. For substantial work, leaves a short handoff as a comment on the GitHub issue: what was done,
59
+ what was tried and rejected, what is left.
60
+
61
+
62
+ ## Working with several agents at once
63
+
64
+ Each agent needs its own copy of the files, or the agents overwrite each other's edits. Git
65
+ provides this with **worktrees**: extra folders, each with its own branch checked out, all
66
+ sharing one repository. So each parallel job is one worktree on one branch.
67
+
68
+ - Work in parallel only on topics that do not overlap. The files that most changes touch
69
+ (`main_window.py`, `model.py`, `side_view.py`, `mcp_server/tools.py`, `state.py`) are listed in
70
+ `agent_docs/README.md`; two jobs that both need to change one of them heavily, or that change
71
+ `OpticalState`, should be agreed first or done one after the other.
72
+ - **Keep worktrees out of Dropbox**, so that Dropbox does not sync several checkouts to every
73
+ machine. Claude Code's own worktree option may put them inside the repository folder, so make
74
+ them by hand.
75
+ - **Give each worktree its own virtual environment.** The editable install in a venv points at
76
+ one checkout, so a shared venv would test another worktree's code.
77
+
78
+ Starting a job (here called `fields-ui`), from the main checkout:
79
+
80
+ ```
81
+ git checkout dev && git pull
82
+ git worktree add ~/worktrees/raycrafter-fields-ui -b fields-ui dev
83
+ cd ~/worktrees/raycrafter-fields-ui
84
+ export UV_PROJECT_ENVIRONMENT=~/uv_venvs/raycrafter_fields-ui
85
+ uv sync --extra dev
86
+ claude
87
+ ```
88
+
89
+ Finishing it, back in the main checkout:
90
+
91
+ ```
92
+ git checkout dev
93
+ git merge fields-ui # then run the full tests on the combined code
94
+ git worktree remove ~/worktrees/raycrafter-fields-ui
95
+ git branch -d fields-ui
96
+ rm -rf ~/uv_venvs/raycrafter_fields-ui
97
+ ```
98
+
99
+ Someone (Rob, or one agent asked to do so) acts as coordinator: hands out the jobs, agrees any
100
+ change to shared interfaces before the work starts, merges the branches into `dev` one at a
101
+ time, and runs the tests after each merge.
102
+
103
+
104
+ ## Keeping or restarting a session
105
+
106
+ A session builds up useful understanding, so there is no need to restart one each time a piece
107
+ of work is done. Keep it for follow-up fixes, tests and closely related work in the same topic.
108
+ Start a fresh session for a different topic, or when a long session starts confusing old and
109
+ current code; ask for a handoff on the issue first, so nothing is lost.
@@ -9,7 +9,7 @@ little or no AI. If something would confuse a careful human reader, it is wrong.
9
9
  # Architecture rules
10
10
 
11
11
  - **`raycrafter.core` never imports Qt.** It holds the optical model and the analyses. The GUI,
12
- the HTML report, scripts and (later) an MCP server for AI agents all use the same core API.
12
+ the HTML report, scripts and the MCP server for AI agents all use the same core API.
13
13
  - **Model/view.** The GUI (`raycrafter.gui`) displays the core model and turns user actions into
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
@@ -20,8 +20,14 @@ little or no AI. If something would confuse a careful human reader, it is wrong.
20
20
  else goes on the slow path (after changes settle) or runs only once nothing is being
21
21
  dragged, as the f-number does (`MainWindow.is_dragging`). Measure what you add to the fast
22
22
  path; the side view shows the trace and draw times.
23
+ - **The model is a thin front.** `OpticalModel` (`core/model.py`) holds only what needs more
24
+ than the bench state: the catalogue, the user parts folder, undo and files. Any editing rule
25
+ or calculation goes in a topic module of `core` as a function of an `OpticalState`
26
+ (`placement`, `moving`, `gaps`, `assemblies`, `replacement`, `gap_optimisation`, ...), or in
27
+ a new module. The model method is then a one-line wrapper whose docstring says what it does
28
+ in one line and names that function; the details are documented there, not repeated.
23
29
  - **File size.** Aim for files under about 1000 lines. This is a soft limit: if a file has to be
24
- bigger, say why in `log.md`.
30
+ bigger, say why in its topic's log in `agent_docs/`.
25
31
  - **Optiland.** It is pinned to a tested minor version in `pyproject.toml`. Any workaround for an
26
32
  Optiland bug goes in one clearly marked place, with a comment that links to the upstream issue.
27
33
  Delete the workaround once the fix is released. When new versions of Optiland are released:
@@ -36,6 +42,8 @@ raycrafter/
36
42
  lenscatalog/ lens catalogues (JSON data plus loaders)
37
43
  report/ HTML report (matplotlib figures)
38
44
  gui/ PyQt6 + pyqtgraph application
45
+ mcp_server/ tools for AI agents (MCP), and the link to the open window
46
+ api.py the Python scripting interface, ``Bench`` (with the ``*_methods.py`` mixins)
39
47
  palette.py colours shared by the GUI and the report
40
48
  ```
41
49
 
@@ -55,6 +63,16 @@ raycrafter/
55
63
  - Once a feature is complete, remove any dead code.
56
64
 
57
65
 
66
+ # GUI conventions
67
+
68
+ - **Every drop-down**, anywhere in RayCrafter, opens with the currently selected entry at the
69
+ top, as the "Beams" drop-down of the field editor does. Otherwise the focus moves
70
+ distractingly when the user returns to the drop-down. Always make one with
71
+ `CurrentFirstComboBox` (`gui/current_first_combo.py`), never a plain `QComboBox` (a test
72
+ checks this), and read or set its choice by data (`currentData`, `findData`), as its rows
73
+ change order.
74
+
75
+
58
76
  # Tests
59
77
 
60
78
  - Run them with `uv run pytest`. Tests live in `tests/test_unit` (fast, no display) and
@@ -108,10 +126,17 @@ raycrafter/
108
126
  Only then start the adversarial code review below. Update the "last checked" date in
109
127
  `optiland_fix.md` even when there is no new release.
110
128
  - 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.
129
+ work down between now and the last release. The main tasks of the review will be to find
130
+ bugs that may have been introduced and check that there are no mistakes in the optical
131
+ principles underlying the work. You should also verify that the changes made
132
+ are in keeping with the design plan of the software. Before release you should ensure
133
+ that the agent_docs are all up to date and in sync with the code. Note that agents doing
134
+ the initial work may be running more simple models than that doing the adversarial review
135
+ and merge. Therefore at this point better ways of solving a problem may come to light.
136
+ It is acceptable for hunt for this and implement them at this stage. Ask the human
137
+ reviewer as needed when doing this. We want the best version of the approach going into
138
+ the release. Once any fixes have been applied after the review ends, it is OK to
139
+ increment the version and deploy the new release to PyPI.
115
140
  - Versions come from git tags via setuptools-scm, using semantic versioning. Pushing a
116
141
  `vX.Y.Z` tag publishes to PyPI. Always verify your proposed new version number with the
117
142
  human managing the project.
@@ -131,24 +156,44 @@ raycrafter/
131
156
  - `rm` and `mv` are aliased to interactive versions on Rob's machines, so use `rm -f` / `mv -f`.
132
157
 
133
158
 
134
- # Decision log (`log.md`)
159
+ # Agent workflow and `agent_docs/`
160
+
161
+ `agent_docs/` is a map of the code and its decision log, split into topics (bench, gui, optics,
162
+ ...), so an agent can start work without reading the whole code base. It is written tersely,
163
+ for agents only; `agent_docs/README.md` defines its abbreviations. `AGENT_WORKFLOW.md` explains
164
+ the scheme to humans. For every task:
165
+
166
+ 1. **Orient.** Read `agent_docs/README.md`, then only the topic files its "Typical tasks" table
167
+ names for the task. Do not read other topics' files or logs unless the task touches them.
168
+ 2. **Propose.** Say what you will change and which files you expect to touch (one line is
169
+ enough for a small fix). Changing `OpticalState`, a "hot file" listed in the README, or more
170
+ than one topic needs Rob's agreement before parallel work on those topics.
171
+ 3. **Read the code you need.** The code is the truth: if a topic file disagrees with it, fix
172
+ the topic file.
173
+ 4. **Change and test** as usual (tests, pre-commit).
174
+ 5. **Update the docs in the same commit.** Update the topic's map, "How to add" and "Rules"
175
+ sections if they changed. A new module goes in exactly one topic, in the README's table and
176
+ that topic's map (`tests/test_unit/test_agent_docs.py` checks this). If a decision was made,
177
+ append an entry to the topic's log.
178
+ 6. **Hand off.** At the end of substantial work, post a short comment on the issue: what was
179
+ done, what was tried and rejected (and why), what is left, and the test results.
135
180
 
136
- `log.md` records significant decisions and why they were made, so the history of the project
137
- can be traced later (e.g. for a paper). Keep it short so it stays cheap to search.
181
+ The decision log records significant decisions and why they were made, so the history of the
182
+ project can be traced later (e.g. for a paper).
138
183
 
139
- - **Before starting work**, search the log for the topic, e.g.
140
- `grep -n -i -A6 "catalog" log.md`. Read the matching entries only, not the whole file.
141
184
  - **Add an entry** for a decision someone might later ask "why?" about: architecture,
142
185
  dependencies, tooling, physics approximations, Optiland workarounds, or something tried and
143
186
  abandoned. Do not log routine changes or bug fixes; git and the issues record those.
144
- - **Append only.** Add new entries at the end and never rewrite old ones. If a decision is
145
- reversed, add a new entry that says which entry it supersedes.
146
- - **Format.** Each entry is at most about 8 lines:
187
+ - **Append only.** Add new entries at the end of the topic's log and never rewrite old ones. If a
188
+ decision is reversed, add a new entry whose `X:` line names the entry it supersedes.
189
+ - **Format**: at most about 5 lines, dates YYMMDD, terse (see `agent_docs/README.md`):
147
190
 
148
191
  ```
149
- ## YYYY-MM-DD: Short title
150
- **Decision:** what was decided.
151
- **Why:** the reason, including alternatives rejected.
152
- **Supersedes:** (optional) the date and title of the earlier entry.
192
+ ### YYMMDD Short title (#issue)
193
+ D: what was decided.
194
+ W: why, including alternatives rejected.
195
+ X: (optional) the date and title of the entry it supersedes.
153
196
  ```
154
197
  - Ask Rob before logging a decision that he has not made or agreed to.
198
+ - **Parallel agents** each work in their own git worktree on their own feature branch from
199
+ `dev`, outside Dropbox, with their own venv (see `AGENT_WORKFLOW.md`).
@@ -4,6 +4,21 @@ Each release also has a release message on
4
4
  [GitHub](https://github.com/raycrafter-optical-design/raycrafter/releases).
5
5
 
6
6
 
7
+ ## [0.0.5](https://github.com/raycrafter-optical-design/raycrafter/releases/tag/v0.0.5) (2026-11-29)
8
+
9
+ - New layout: a tool palette and a context bar, with the lens browser and field editor in the main window [#70](https://github.com/raycrafter-optical-design/raycrafter/issues/70).
10
+ - Variable apertures (irises), which can sit inside locked gaps and assemblies [#71](https://github.com/raycrafter-optical-design/raycrafter/issues/71).
11
+ - Choose the aperture stop, and let the fields fill it, with every ray aimed through it [#83](https://github.com/raycrafter-optical-design/raycrafter/issues/83).
12
+ - A detector on the image plane, and the share of each field's light that lands on it [#91](https://github.com/raycrafter-optical-design/raycrafter/issues/91).
13
+ - Focal points of lenses and assemblies are marked; elements snap to them or move there exactly [#77](https://github.com/raycrafter-optical-design/raycrafter/issues/77), [#107](https://github.com/raycrafter-optical-design/raycrafter/issues/107).
14
+ - Finite objects (object points), with grid distortion [#29](https://github.com/raycrafter-optical-design/raycrafter/issues/29), [#30](https://github.com/raycrafter-optical-design/raycrafter/issues/30).
15
+ - Field editor with sliders and colour rules; choose the number of rays drawn [#86](https://github.com/raycrafter-optical-design/raycrafter/issues/86), [#84](https://github.com/raycrafter-optical-design/raycrafter/issues/84).
16
+ - Optimise a gap to collimate or focus; replace a lens with one of the same focal length; Plossl pairs [#38](https://github.com/raycrafter-optical-design/raycrafter/issues/38), [#56](https://github.com/raycrafter-optical-design/raycrafter/issues/56), [#63](https://github.com/raycrafter-optical-design/raycrafter/issues/63), [#66](https://github.com/raycrafter-optical-design/raycrafter/issues/66).
17
+ - A 3D view, and a web report that updates live [#51](https://github.com/raycrafter-optical-design/raycrafter/issues/51), [#52](https://github.com/raycrafter-optical-design/raycrafter/issues/52), [#68](https://github.com/raycrafter-optical-design/raycrafter/issues/68).
18
+ - Elements may come within 1 mm of the start of the axis; plane labels stay readable [#80](https://github.com/raycrafter-optical-design/raycrafter/issues/80).
19
+ - Known problems: ZMX files do not carry the detector or the stop [#105](https://github.com/raycrafter-optical-design/raycrafter/issues/105), [#106](https://github.com/raycrafter-optical-design/raycrafter/issues/106).
20
+
21
+
7
22
  ## [0.0.4](https://github.com/raycrafter-optical-design/raycrafter/releases/tag/v0.0.4) (2026-11-26)
8
23
 
9
24
  Version 0.0.3 was skipped.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RayCrafter
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Raytracing GUI for simple optical systems using off-the-shelf lenses and Optiland
5
5
  Author-email: Rob Campbell <git@raacampbell.com>
6
6
  License-Expression: MIT
@@ -22,6 +22,7 @@ Requires-Dist: scipy
22
22
  Requires-Dist: matplotlib
23
23
  Requires-Dist: PyQt6>=6.8
24
24
  Requires-Dist: pyqtgraph>=0.14
25
+ Requires-Dist: pyopengl>=3.1.7
25
26
  Provides-Extra: mcp
26
27
  Requires-Dist: mcp<2.4,>=2.3; extra == "mcp"
27
28
  Provides-Extra: dev
@@ -48,12 +49,21 @@ Dynamic: license-file
48
49
 
49
50
  RayCrafter is an early proof of principle for a lens-level optical design tool. You place
50
51
  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.
52
+ through-focus curve, MTF, ray fan, field curvature and distortion update as you go. The ray
53
+ tracing is done by [Optiland](https://github.com/optiland/optiland).
54
+
55
+ - **Lenses:** the Thorlabs spherical lenses, achromats, air-spaced doublets, triplets and
56
+ matched pairs, plus ideal (paraxial) lenses.
57
+ - **Layout:** type the gaps between lenses and lock them; group lenses into assemblies (such
58
+ as Plossl pairs) and save them as your own parts.
59
+ - **Beams:** any number, each with its own width, angle, vergence, offset and wavelength.
60
+ - **3D view:** View > Show 3D View shows the lenses and rays in a window you can rotate.
61
+ - **Files:** save designs as RayCrafter project files, import and export Zemax `.zmx` files,
62
+ and open a report with a 3D view in your browser, which updates as you change the design
63
+ and can be saved as one file to send to others.
64
+ - **Scripting:** drive it from Python, or let an AI agent do so (see below).
65
+
66
+ [Documentation](https://raycrafter-optical-design.github.io/raycrafter-docs/)
57
67
 
58
68
  **Status:** pre-alpha. Expect anything to change, including the API.
59
69
 
@@ -163,4 +173,6 @@ coding.
163
173
 
164
174
  We nonetheless aim for well-designed, readable code that people who use little or no AI can
165
175
  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).
176
+ significant decisions, with their reasons, are recorded in the topic files of
177
+ [agent_docs/](agent_docs/README.md). How agents use those notes, and how to run several agents
178
+ at once, is explained in [AGENT_WORKFLOW.md](AGENT_WORKFLOW.md).
@@ -10,12 +10,21 @@
10
10
 
11
11
  RayCrafter is an early proof of principle for a lens-level optical design tool. You place
12
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.
13
+ through-focus curve, MTF, ray fan, field curvature and distortion update as you go. The ray
14
+ tracing is done by [Optiland](https://github.com/optiland/optiland).
15
+
16
+ - **Lenses:** the Thorlabs spherical lenses, achromats, air-spaced doublets, triplets and
17
+ matched pairs, plus ideal (paraxial) lenses.
18
+ - **Layout:** type the gaps between lenses and lock them; group lenses into assemblies (such
19
+ as Plossl pairs) and save them as your own parts.
20
+ - **Beams:** any number, each with its own width, angle, vergence, offset and wavelength.
21
+ - **3D view:** View > Show 3D View shows the lenses and rays in a window you can rotate.
22
+ - **Files:** save designs as RayCrafter project files, import and export Zemax `.zmx` files,
23
+ and open a report with a 3D view in your browser, which updates as you change the design
24
+ and can be saved as one file to send to others.
25
+ - **Scripting:** drive it from Python, or let an AI agent do so (see below).
26
+
27
+ [Documentation](https://raycrafter-optical-design.github.io/raycrafter-docs/)
19
28
 
20
29
  **Status:** pre-alpha. Expect anything to change, including the API.
21
30
 
@@ -125,4 +134,6 @@ coding.
125
134
 
126
135
  We nonetheless aim for well-designed, readable code that people who use little or no AI can
127
136
  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).
137
+ significant decisions, with their reasons, are recorded in the topic files of
138
+ [agent_docs/](agent_docs/README.md). How agents use those notes, and how to run several agents
139
+ at once, is explained in [AGENT_WORKFLOW.md](AGENT_WORKFLOW.md).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RayCrafter
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Raytracing GUI for simple optical systems using off-the-shelf lenses and Optiland
5
5
  Author-email: Rob Campbell <git@raacampbell.com>
6
6
  License-Expression: MIT
@@ -22,6 +22,7 @@ Requires-Dist: scipy
22
22
  Requires-Dist: matplotlib
23
23
  Requires-Dist: PyQt6>=6.8
24
24
  Requires-Dist: pyqtgraph>=0.14
25
+ Requires-Dist: pyopengl>=3.1.7
25
26
  Provides-Extra: mcp
26
27
  Requires-Dist: mcp<2.4,>=2.3; extra == "mcp"
27
28
  Provides-Extra: dev
@@ -48,12 +49,21 @@ Dynamic: license-file
48
49
 
49
50
  RayCrafter is an early proof of principle for a lens-level optical design tool. You place
50
51
  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.
52
+ through-focus curve, MTF, ray fan, field curvature and distortion update as you go. The ray
53
+ tracing is done by [Optiland](https://github.com/optiland/optiland).
54
+
55
+ - **Lenses:** the Thorlabs spherical lenses, achromats, air-spaced doublets, triplets and
56
+ matched pairs, plus ideal (paraxial) lenses.
57
+ - **Layout:** type the gaps between lenses and lock them; group lenses into assemblies (such
58
+ as Plossl pairs) and save them as your own parts.
59
+ - **Beams:** any number, each with its own width, angle, vergence, offset and wavelength.
60
+ - **3D view:** View > Show 3D View shows the lenses and rays in a window you can rotate.
61
+ - **Files:** save designs as RayCrafter project files, import and export Zemax `.zmx` files,
62
+ and open a report with a 3D view in your browser, which updates as you change the design
63
+ and can be saved as one file to send to others.
64
+ - **Scripting:** drive it from Python, or let an AI agent do so (see below).
65
+
66
+ [Documentation](https://raycrafter-optical-design.github.io/raycrafter-docs/)
57
67
 
58
68
  **Status:** pre-alpha. Expect anything to change, including the API.
59
69
 
@@ -163,4 +173,6 @@ coding.
163
173
 
164
174
  We nonetheless aim for well-designed, readable code that people who use little or no AI can
165
175
  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).
176
+ significant decisions, with their reasons, are recorded in the topic files of
177
+ [agent_docs/](agent_docs/README.md). How agents use those notes, and how to run several agents
178
+ at once, is explained in [AGENT_WORKFLOW.md](AGENT_WORKFLOW.md).
@@ -0,0 +1,139 @@
1
+ .gitignore
2
+ AGENT_WORKFLOW.md
3
+ CLAUDE.md
4
+ Changelog.md
5
+ LICENSE
6
+ MANIFEST.in
7
+ README.md
8
+ log.md
9
+ optiland_fix.md
10
+ pyproject.toml
11
+ uv.lock
12
+ .github/workflows/test_and_deploy.yml
13
+ RayCrafter.egg-info/PKG-INFO
14
+ RayCrafter.egg-info/SOURCES.txt
15
+ RayCrafter.egg-info/dependency_links.txt
16
+ RayCrafter.egg-info/entry_points.txt
17
+ RayCrafter.egg-info/requires.txt
18
+ RayCrafter.egg-info/scm_file_list.json
19
+ RayCrafter.egg-info/scm_version.json
20
+ RayCrafter.egg-info/top_level.txt
21
+ agent_docs/README.md
22
+ agent_docs/analyses.md
23
+ agent_docs/bench.md
24
+ agent_docs/catalog.md
25
+ agent_docs/dev.md
26
+ agent_docs/files.md
27
+ agent_docs/gui.md
28
+ agent_docs/optics.md
29
+ agent_docs/report3d.md
30
+ agent_docs/scripting.md
31
+ raycrafter/__init__.py
32
+ raycrafter/__main__.py
33
+ raycrafter/aperture_methods.py
34
+ raycrafter/api.py
35
+ raycrafter/assembly_methods.py
36
+ raycrafter/design_files.py
37
+ raycrafter/detector_methods.py
38
+ raycrafter/field_methods.py
39
+ raycrafter/gap_methods.py
40
+ raycrafter/palette.py
41
+ raycrafter/plane_methods.py
42
+ raycrafter/stop_methods.py
43
+ raycrafter/core/__init__.py
44
+ raycrafter/core/aiming.py
45
+ raycrafter/core/analysis.py
46
+ raycrafter/core/apertures.py
47
+ raycrafter/core/assemblies.py
48
+ raycrafter/core/detector.py
49
+ raycrafter/core/distortion.py
50
+ raycrafter/core/examples.py
51
+ raycrafter/core/field_colours.py
52
+ raycrafter/core/fields.py
53
+ raycrafter/core/gap_optimisation.py
54
+ raycrafter/core/gaps.py
55
+ raycrafter/core/history.py
56
+ raycrafter/core/key_planes.py
57
+ raycrafter/core/model.py
58
+ raycrafter/core/moving.py
59
+ raycrafter/core/optic_builder.py
60
+ raycrafter/core/placement.py
61
+ raycrafter/core/plossl.py
62
+ raycrafter/core/plot_geometry.py
63
+ raycrafter/core/prescription.py
64
+ raycrafter/core/project_file.py
65
+ raycrafter/core/ray_launch.py
66
+ raycrafter/core/replacement.py
67
+ raycrafter/core/scene.py
68
+ raycrafter/core/state.py
69
+ raycrafter/core/stop.py
70
+ raycrafter/core/user_parts.py
71
+ raycrafter/core/zmx_import.py
72
+ raycrafter/gui/__init__.py
73
+ raycrafter/gui/about_dialog.py
74
+ raycrafter/gui/agent_link.py
75
+ raycrafter/gui/analysis_panels.py
76
+ raycrafter/gui/aperture_slider.py
77
+ raycrafter/gui/app.py
78
+ raycrafter/gui/axis_glyph.py
79
+ raycrafter/gui/bench_viewer.py
80
+ raycrafter/gui/compile_notice.py
81
+ raycrafter/gui/context_bar.py
82
+ raycrafter/gui/current_first_combo.py
83
+ raycrafter/gui/detector_graphics.py
84
+ raycrafter/gui/detector_panel.py
85
+ raycrafter/gui/detector_settings.py
86
+ raycrafter/gui/field_editor.py
87
+ raycrafter/gui/file_actions.py
88
+ raycrafter/gui/gap_dimensions.py
89
+ raycrafter/gui/gap_optimiser.py
90
+ raycrafter/gui/hue_strip.py
91
+ raycrafter/gui/lens_browser.py
92
+ raycrafter/gui/lens_replacement.py
93
+ raycrafter/gui/lens_shapes.py
94
+ raycrafter/gui/main_window.py
95
+ raycrafter/gui/move_to_menu.py
96
+ raycrafter/gui/plane_guide.py
97
+ raycrafter/gui/range_slider.py
98
+ raycrafter/gui/ray_curves.py
99
+ raycrafter/gui/report_actions.py
100
+ raycrafter/gui/scaled_slider.py
101
+ raycrafter/gui/side_readouts.py
102
+ raycrafter/gui/side_view.py
103
+ raycrafter/gui/stop_marker.py
104
+ raycrafter/gui/style.py
105
+ raycrafter/gui/tag_labels.py
106
+ raycrafter/gui/tool_actions.py
107
+ raycrafter/gui/tool_icons.py
108
+ raycrafter/gui/tool_palette.py
109
+ raycrafter/gui/undo_keys.py
110
+ raycrafter/gui/view_3d.py
111
+ raycrafter/lenscatalog/__init__.py
112
+ raycrafter/lenscatalog/catalog.py
113
+ raycrafter/lenscatalog/selection.py
114
+ raycrafter/lenscatalog/thorlabs.py
115
+ raycrafter/lenscatalog/data/thorlabs.json.gz
116
+ raycrafter/mcp_server/__init__.py
117
+ raycrafter/mcp_server/detector_tools.py
118
+ raycrafter/mcp_server/link.py
119
+ raycrafter/mcp_server/plane_tools.py
120
+ raycrafter/mcp_server/server.py
121
+ raycrafter/mcp_server/stop_tools.py
122
+ raycrafter/mcp_server/tools.py
123
+ raycrafter/report/__init__.py
124
+ raycrafter/report/explanations.py
125
+ raycrafter/report/figures.py
126
+ raycrafter/report/html_report.py
127
+ raycrafter/report/live_report.py
128
+ raycrafter/report/live_server.py
129
+ raycrafter/report/report_process.py
130
+ raycrafter/report/viewer_3d.py
131
+ raycrafter/report/assets/live.js
132
+ raycrafter/report/assets/report.css
133
+ raycrafter/report/assets/report.js
134
+ raycrafter/report/assets/viewer3d.js
135
+ raycrafter/report/assets/three/LICENSE
136
+ raycrafter/report/assets/three/OrbitControls.js
137
+ raycrafter/report/assets/three/README.md
138
+ raycrafter/report/assets/three/three.module.min.js
139
+ scripts/make_thorlabs_catalog.py
@@ -4,6 +4,7 @@ scipy
4
4
  matplotlib
5
5
  PyQt6>=6.8
6
6
  pyqtgraph>=0.14
7
+ pyopengl>=3.1.7
7
8
 
8
9
  [dev]
9
10
  mcp<2.4,>=2.3