os-optics-kit 0.1.0__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 (205) hide show
  1. os_optics_kit-0.1.0/.gitignore +20 -0
  2. os_optics_kit-0.1.0/AGENT_GUIDE.md +79 -0
  3. os_optics_kit-0.1.0/CONTRIBUTING.md +120 -0
  4. os_optics_kit-0.1.0/LICENSE +21 -0
  5. os_optics_kit-0.1.0/PKG-INFO +140 -0
  6. os_optics_kit-0.1.0/README.md +112 -0
  7. os_optics_kit-0.1.0/README.zh-CN.md +106 -0
  8. os_optics_kit-0.1.0/alignment-checks.json +377 -0
  9. os_optics_kit-0.1.0/baseline.json +16 -0
  10. os_optics_kit-0.1.0/cases/beam-expander/CASE.md +52 -0
  11. os_optics_kit-0.1.0/cases/beam-expander/README.md +38 -0
  12. os_optics_kit-0.1.0/cases/beam-expander/README.zh-CN.md +36 -0
  13. os_optics_kit-0.1.0/cases/beam-expander/expected.json +10 -0
  14. os_optics_kit-0.1.0/cases/beam-expander/images/iso.png +0 -0
  15. os_optics_kit-0.1.0/cases/beam-expander/images/section.png +0 -0
  16. os_optics_kit-0.1.0/cases/beam-expander/project.json +160 -0
  17. os_optics_kit-0.1.0/cases/beam-expander/studies/beam_expander_l2_sweep.json +61 -0
  18. os_optics_kit-0.1.0/cases/beam-expander/studies/beam_expander_move_l2.json +22 -0
  19. os_optics_kit-0.1.0/cases/beam-expander/studies/beam_expander_swap_l2.json +22 -0
  20. os_optics_kit-0.1.0/cases/detector-measurements/CASE.md +56 -0
  21. os_optics_kit-0.1.0/cases/detector-measurements/README.md +37 -0
  22. os_optics_kit-0.1.0/cases/detector-measurements/README.zh-CN.md +35 -0
  23. os_optics_kit-0.1.0/cases/detector-measurements/data/README.md +60 -0
  24. os_optics_kit-0.1.0/cases/detector-measurements/data/detector_response.csv +11 -0
  25. os_optics_kit-0.1.0/cases/detector-measurements/data/reference_drift.csv +14 -0
  26. os_optics_kit-0.1.0/cases/detector-measurements/expected.json +13 -0
  27. os_optics_kit-0.1.0/cases/detector-measurements/images/top.png +0 -0
  28. os_optics_kit-0.1.0/cases/detector-measurements/project.json +234 -0
  29. os_optics_kit-0.1.0/cases/expansion-focus/CASE.md +55 -0
  30. os_optics_kit-0.1.0/cases/expansion-focus/README.md +38 -0
  31. os_optics_kit-0.1.0/cases/expansion-focus/README.zh-CN.md +37 -0
  32. os_optics_kit-0.1.0/cases/expansion-focus/expected.json +12 -0
  33. os_optics_kit-0.1.0/cases/expansion-focus/images/iso.png +0 -0
  34. os_optics_kit-0.1.0/cases/expansion-focus/images/section.png +0 -0
  35. os_optics_kit-0.1.0/cases/expansion-focus/project.json +278 -0
  36. os_optics_kit-0.1.0/cases/expansion-focus/studies/compute_budget_default.json +1 -0
  37. os_optics_kit-0.1.0/cases/expansion-focus/studies/compute_budget_limited.json +1 -0
  38. os_optics_kit-0.1.0/cases/expansion-focus/studies/sensitivity_expander.json +21 -0
  39. os_optics_kit-0.1.0/cases/expansion-focus/studies/sensitivity_expander_band_edge.json +65 -0
  40. os_optics_kit-0.1.0/cases/expansion-focus/studies/tolerance_expander.json +89 -0
  41. os_optics_kit-0.1.0/cases/expansion-focus/workflow.py +84 -0
  42. os_optics_kit-0.1.0/cases/ideal-lens-focus/CASE.md +49 -0
  43. os_optics_kit-0.1.0/cases/ideal-lens-focus/README.md +28 -0
  44. os_optics_kit-0.1.0/cases/ideal-lens-focus/README.zh-CN.md +27 -0
  45. os_optics_kit-0.1.0/cases/ideal-lens-focus/expected.json +10 -0
  46. os_optics_kit-0.1.0/cases/ideal-lens-focus/ideal_lens_focus.py +76 -0
  47. os_optics_kit-0.1.0/cases/ideal-lens-focus/images/section.png +0 -0
  48. os_optics_kit-0.1.0/cases/ideal-lens-focus/project.json +133 -0
  49. os_optics_kit-0.1.0/cases/interop-diffraction/CASE.md +58 -0
  50. os_optics_kit-0.1.0/cases/interop-diffraction/README.md +38 -0
  51. os_optics_kit-0.1.0/cases/interop-diffraction/README.zh-CN.md +35 -0
  52. os_optics_kit-0.1.0/cases/interop-diffraction/expected.json +10 -0
  53. os_optics_kit-0.1.0/cases/interop-diffraction/external_focus.py +349 -0
  54. os_optics_kit-0.1.0/cases/interop-diffraction/hankel_reference.py +59 -0
  55. os_optics_kit-0.1.0/cases/interop-diffraction/images/section.png +0 -0
  56. os_optics_kit-0.1.0/cases/interop-diffraction/images/stop.png +0 -0
  57. os_optics_kit-0.1.0/cases/interop-diffraction/opensci_handoff.py +201 -0
  58. os_optics_kit-0.1.0/cases/interop-diffraction/project.json +215 -0
  59. os_optics_kit-0.1.0/cases/interop-diffraction/requirements-diffractio.txt +9 -0
  60. os_optics_kit-0.1.0/cases/interop-diffraction/requirements-diffraction.txt +13 -0
  61. os_optics_kit-0.1.0/cases/interop-diffraction/tem00_field.py +62 -0
  62. os_optics_kit-0.1.0/cases/interop-metasurface/CASE.md +57 -0
  63. os_optics_kit-0.1.0/cases/interop-metasurface/README.md +38 -0
  64. os_optics_kit-0.1.0/cases/interop-metasurface/README.zh-CN.md +37 -0
  65. os_optics_kit-0.1.0/cases/interop-metasurface/expected.json +10 -0
  66. os_optics_kit-0.1.0/cases/interop-metasurface/images/section.png +0 -0
  67. os_optics_kit-0.1.0/cases/interop-metasurface/project.json +228 -0
  68. os_optics_kit-0.1.0/cases/interop-metasurface/requirements-metasurface.txt +8 -0
  69. os_optics_kit-0.1.0/cases/interop-metasurface/step1_unit_cells.py +113 -0
  70. os_optics_kit-0.1.0/cases/interop-metasurface/step2_focusing.py +155 -0
  71. os_optics_kit-0.1.0/cases/interop-metasurface/step3_fit_model.py +377 -0
  72. os_optics_kit-0.1.0/cases/interop-metasurface/step4_engine_check.py +319 -0
  73. os_optics_kit-0.1.0/cases/interop-optimization/CASE.md +52 -0
  74. os_optics_kit-0.1.0/cases/interop-optimization/README.md +33 -0
  75. os_optics_kit-0.1.0/cases/interop-optimization/README.zh-CN.md +31 -0
  76. os_optics_kit-0.1.0/cases/interop-optimization/expected.json +10 -0
  77. os_optics_kit-0.1.0/cases/interop-optimization/images/section.png +0 -0
  78. os_optics_kit-0.1.0/cases/interop-optimization/optimize_expander.py +327 -0
  79. os_optics_kit-0.1.0/cases/interop-optimization/project.json +168 -0
  80. os_optics_kit-0.1.0/cases/interop-optimization/requirements-optimization.txt +8 -0
  81. os_optics_kit-0.1.0/cases/interop-quantum/CASE.md +52 -0
  82. os_optics_kit-0.1.0/cases/interop-quantum/README.md +35 -0
  83. os_optics_kit-0.1.0/cases/interop-quantum/README.zh-CN.md +34 -0
  84. os_optics_kit-0.1.0/cases/interop-quantum/build_layouts.py +188 -0
  85. os_optics_kit-0.1.0/cases/interop-quantum/expected.json +11 -0
  86. os_optics_kit-0.1.0/cases/interop-quantum/images/top.png +0 -0
  87. os_optics_kit-0.1.0/cases/interop-quantum/network_io.py +278 -0
  88. os_optics_kit-0.1.0/cases/interop-quantum/project.json +253 -0
  89. os_optics_kit-0.1.0/cases/interop-quantum/quantum_inputs.json +64 -0
  90. os_optics_kit-0.1.0/cases/interop-quantum/reference.py +110 -0
  91. os_optics_kit-0.1.0/cases/interop-quantum/requirements-quantum.txt +12 -0
  92. os_optics_kit-0.1.0/cases/interop-quantum/run_quantum.py +278 -0
  93. os_optics_kit-0.1.0/cases/mirror-alignment/CASE.md +54 -0
  94. os_optics_kit-0.1.0/cases/mirror-alignment/README.md +32 -0
  95. os_optics_kit-0.1.0/cases/mirror-alignment/README.zh-CN.md +31 -0
  96. os_optics_kit-0.1.0/cases/mirror-alignment/expected.json +15 -0
  97. os_optics_kit-0.1.0/cases/mirror-alignment/images/iso.png +0 -0
  98. os_optics_kit-0.1.0/cases/mirror-alignment/images/top.png +0 -0
  99. os_optics_kit-0.1.0/cases/mirror-alignment/project.json +252 -0
  100. os_optics_kit-0.1.0/cases/mirror-alignment/studies/sensitivity_alignment.json +126 -0
  101. os_optics_kit-0.1.0/cases/mirror-alignment/studies/tolerance_alignment.json +138 -0
  102. os_optics_kit-0.1.0/cases/mirror-alignment/workflow.py +272 -0
  103. os_optics_kit-0.1.0/cases/polarization-control/CASE.md +54 -0
  104. os_optics_kit-0.1.0/cases/polarization-control/README.md +34 -0
  105. os_optics_kit-0.1.0/cases/polarization-control/README.zh-CN.md +32 -0
  106. os_optics_kit-0.1.0/cases/polarization-control/expected.json +11 -0
  107. os_optics_kit-0.1.0/cases/polarization-control/images/iso.png +0 -0
  108. os_optics_kit-0.1.0/cases/polarization-control/project.json +265 -0
  109. os_optics_kit-0.1.0/cases/polarization-control/studies/polarization_hwp_wavelength_sweep.json +75 -0
  110. os_optics_kit-0.1.0/cases/polarization-control/studies/polarization_threshold.json +15 -0
  111. os_optics_kit-0.1.0/cases/polarization-control/studies/sensitivity_polarization.json +98 -0
  112. os_optics_kit-0.1.0/cases/polarization-control/studies/tolerance_polarization.json +102 -0
  113. os_optics_kit-0.1.0/cases/polarization-control/workflow.py +107 -0
  114. os_optics_kit-0.1.0/cases.json +348 -0
  115. os_optics_kit-0.1.0/docs/agent-recipes.md +134 -0
  116. os_optics_kit-0.1.0/docs/case-format.md +113 -0
  117. os_optics_kit-0.1.0/docs/contributing-with-an-agent.md +69 -0
  118. os_optics_kit-0.1.0/docs/en/interop-prompts.md +130 -0
  119. os_optics_kit-0.1.0/docs/en/interop.md +326 -0
  120. os_optics_kit-0.1.0/docs/en/measurements.md +150 -0
  121. os_optics_kit-0.1.0/docs/en/workflows.md +318 -0
  122. os_optics_kit-0.1.0/docs/engine-alignment.md +150 -0
  123. os_optics_kit-0.1.0/docs/workflow-recipes.md +418 -0
  124. os_optics_kit-0.1.0/docs/zh-CN/interop-prompts.md +90 -0
  125. os_optics_kit-0.1.0/docs/zh-CN/interop.md +162 -0
  126. os_optics_kit-0.1.0/docs/zh-CN/measurements.md +130 -0
  127. os_optics_kit-0.1.0/docs/zh-CN/workflows.md +297 -0
  128. os_optics_kit-0.1.0/pyproject.toml +120 -0
  129. os_optics_kit-0.1.0/scripts/changed_cases.py +56 -0
  130. os_optics_kit-0.1.0/scripts/check_alignment.py +871 -0
  131. os_optics_kit-0.1.0/scripts/check_dco.py +90 -0
  132. os_optics_kit-0.1.0/scripts/check_dist.py +143 -0
  133. os_optics_kit-0.1.0/scripts/check_repo.py +393 -0
  134. os_optics_kit-0.1.0/scripts/engine_release.py +101 -0
  135. os_optics_kit-0.1.0/scripts/report_alignment.py +323 -0
  136. os_optics_kit-0.1.0/scripts/requirements-alignment.txt +3 -0
  137. os_optics_kit-0.1.0/skills/candidates/SKILL.md +52 -0
  138. os_optics_kit-0.1.0/skills/compare/SKILL.md +58 -0
  139. os_optics_kit-0.1.0/skills/contrib-case/SKILL.md +66 -0
  140. os_optics_kit-0.1.0/skills/contrib-tool/SKILL.md +65 -0
  141. os_optics_kit-0.1.0/skills/edit/SKILL.md +66 -0
  142. os_optics_kit-0.1.0/skills/measurements/SKILL.md +65 -0
  143. os_optics_kit-0.1.0/skills/plot/SKILL.md +56 -0
  144. os_optics_kit-0.1.0/skills/report/SKILL.md +53 -0
  145. os_optics_kit-0.1.0/skills/run-case/SKILL.md +60 -0
  146. os_optics_kit-0.1.0/skills/sensitivity/SKILL.md +66 -0
  147. os_optics_kit-0.1.0/skills/summary/SKILL.md +55 -0
  148. os_optics_kit-0.1.0/skills/sweep/SKILL.md +66 -0
  149. os_optics_kit-0.1.0/skills/tolerance/SKILL.md +68 -0
  150. os_optics_kit-0.1.0/skills.json +156 -0
  151. os_optics_kit-0.1.0/templates/CASE.md +50 -0
  152. os_optics_kit-0.1.0/templates/README.case.md +27 -0
  153. os_optics_kit-0.1.0/templates/SKILL.md +56 -0
  154. os_optics_kit-0.1.0/tests/check_beam_summary.py +104 -0
  155. os_optics_kit-0.1.0/tests/test_alignment_check.py +777 -0
  156. os_optics_kit-0.1.0/tests/test_alignment_reporting.py +345 -0
  157. os_optics_kit-0.1.0/tests/test_cases.py +362 -0
  158. os_optics_kit-0.1.0/tests/test_cli.py +195 -0
  159. os_optics_kit-0.1.0/tests/test_contrib.py +589 -0
  160. os_optics_kit-0.1.0/tests/test_contrib_engine.py +185 -0
  161. os_optics_kit-0.1.0/tests/test_interop.py +477 -0
  162. os_optics_kit-0.1.0/tests/test_measurements.py +223 -0
  163. os_optics_kit-0.1.0/tests/test_optical_designs.py +384 -0
  164. os_optics_kit-0.1.0/tests/test_plot_bars_layout.py +41 -0
  165. os_optics_kit-0.1.0/tests/test_repo_checks.py +348 -0
  166. os_optics_kit-0.1.0/tests/test_result_summary.py +269 -0
  167. os_optics_kit-0.1.0/tests/test_sensitivity_tolerance.py +483 -0
  168. os_optics_kit-0.1.0/tests/test_skills.py +341 -0
  169. os_optics_kit-0.1.0/tests/test_workflow_common.py +41 -0
  170. os_optics_kit-0.1.0/tests/test_workflow_controls.py +140 -0
  171. os_optics_kit-0.1.0/tests/test_workflow_diagnostics.py +658 -0
  172. os_optics_kit-0.1.0/tests/test_workflow_edit.py +346 -0
  173. os_optics_kit-0.1.0/tests/test_workflow_examples.py +520 -0
  174. os_optics_kit-0.1.0/tests/test_workflow_outcomes.py +56 -0
  175. os_optics_kit-0.1.0/tests/test_workflow_postprocess.py +288 -0
  176. os_optics_kit-0.1.0/tests/test_workflow_sweep.py +174 -0
  177. os_optics_kit-0.1.0/tests/workflow_fixtures.py +138 -0
  178. os_optics_kit-0.1.0/tools/os_optics_kit/__init__.py +9 -0
  179. os_optics_kit-0.1.0/tools/os_optics_kit/__main__.py +3 -0
  180. os_optics_kit-0.1.0/tools/os_optics_kit/_engine.py +148 -0
  181. os_optics_kit-0.1.0/tools/os_optics_kit/_frontmatter.py +110 -0
  182. os_optics_kit-0.1.0/tools/os_optics_kit/_resources.py +37 -0
  183. os_optics_kit-0.1.0/tools/os_optics_kit/_version.py +3 -0
  184. os_optics_kit-0.1.0/tools/os_optics_kit/analyze_measurements.py +362 -0
  185. os_optics_kit-0.1.0/tools/os_optics_kit/build_report.py +354 -0
  186. os_optics_kit-0.1.0/tools/os_optics_kit/cases.py +640 -0
  187. os_optics_kit-0.1.0/tools/os_optics_kit/catalog_candidates.py +207 -0
  188. os_optics_kit-0.1.0/tools/os_optics_kit/cli.py +74 -0
  189. os_optics_kit-0.1.0/tools/os_optics_kit/compare_runs.py +361 -0
  190. os_optics_kit-0.1.0/tools/os_optics_kit/contrib/__init__.py +44 -0
  191. os_optics_kit-0.1.0/tools/os_optics_kit/contrib/_common.py +433 -0
  192. os_optics_kit-0.1.0/tools/os_optics_kit/contrib/_templates.py +114 -0
  193. os_optics_kit-0.1.0/tools/os_optics_kit/contrib/case.py +648 -0
  194. os_optics_kit-0.1.0/tools/os_optics_kit/contrib/tool.py +444 -0
  195. os_optics_kit-0.1.0/tools/os_optics_kit/design_workflow.py +607 -0
  196. os_optics_kit-0.1.0/tools/os_optics_kit/edit_project.py +481 -0
  197. os_optics_kit-0.1.0/tools/os_optics_kit/interop.py +162 -0
  198. os_optics_kit-0.1.0/tools/os_optics_kit/optical_designs.py +861 -0
  199. os_optics_kit-0.1.0/tools/os_optics_kit/plot_results.py +362 -0
  200. os_optics_kit-0.1.0/tools/os_optics_kit/result_summary.py +172 -0
  201. os_optics_kit-0.1.0/tools/os_optics_kit/sensitivity_analysis.py +913 -0
  202. os_optics_kit-0.1.0/tools/os_optics_kit/skills.py +382 -0
  203. os_optics_kit-0.1.0/tools/os_optics_kit/sweep_parameters.py +556 -0
  204. os_optics_kit-0.1.0/tools/os_optics_kit/tolerance_study.py +594 -0
  205. os_optics_kit-0.1.0/tools/os_optics_kit/workflow_common.py +557 -0
@@ -0,0 +1,20 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ # Local runs and outputs (cases keep their project.json; generated runs stay out of Git)
11
+ /run*/
12
+ /run*-arrivals.csv
13
+ /shots/
14
+ /view.html
15
+ /project.json
16
+ /arrivals.csv
17
+ /rays.jsonl
18
+ cases/*/run*/
19
+ cases/*/out/
20
+ .DS_Store
@@ -0,0 +1,79 @@
1
+ # Agent guide
2
+
3
+ os-optics-kit: tools, engine-reproducible cases and skills for the OS Optics engine (`os-optics`).
4
+ Install with `python -m pip install "os-optics[protected]" os-optics-kit` (Python 3.11+); kit 0.1.x
5
+ requires `os-optics>=0.12,<0.13`. Engine guide:
6
+ [os-optics AGENT_GUIDE](https://github.com/JunLin615/os-optics/blob/main/AGENT_GUIDE.md).
7
+
8
+ ## Load the skills
9
+
10
+ ```bash
11
+ os-optics-kit skills list
12
+ os-optics-kit skills show NAME
13
+ os-optics-kit skills install --dest DIR
14
+ ```
15
+
16
+ `skills list` prints the index (name, description, command, requirement) as compact JSON. Read one
17
+ skill before using its command. `skills install` copies the skill directories and `skills.json` into
18
+ DIR, the skills directory of your agent host; it never overwrites a different file without `--force`.
19
+
20
+ ## Route by task
21
+
22
+ | Task | Skill / command |
23
+ | --- | --- |
24
+ | Start from a worked design | `run-case`: `os-optics-kit cases list`, `cases copy NAME --dest .`, `cases verify NAME` |
25
+ | Read a run before deciding | `summary RUN` |
26
+ | Discover IDs, units, axes; edit by ID | `edit P.json --describe --ids ID`; `edit P.json --edits OPS.json --out NEW.json --run RUN` |
27
+ | Explore one or two parameters | `sweep SPEC.json --base P.json --out STUDY` |
28
+ | Explain what an edit changed | `compare RUN_A RUN_B --project CURRENT.json --out CMP` |
29
+ | Plots and a report | `plot sweep STUDY --y target:ID`; `report STUDY --project CURRENT.json` |
30
+ | Sensitivity, tolerance | `sensitivity SPEC.json --out DIR`; `tolerance SPEC.json --out DIR` |
31
+ | Catalog parts | `candidates --category ... --wavelength-nm ...` |
32
+ | Detector CSV data | `measurements DATA.csv --x ... --signal ... --out DIR` |
33
+ | Share a design or helper | `contrib-case`, `contrib-tool` |
34
+
35
+ Each command is `os-optics-kit <command>`; `--help` holds its full specification.
36
+ [Workflow recipes](docs/workflow-recipes.md) give spec keys, outputs and error codes.
37
+ Cases `expansion-focus`, `polarization-control` and `mirror-alignment` include a parameterized
38
+ `workflow.py` (`--list-parameters`, unit-bearing inputs such as `--gap-error-mm 250um`,
39
+ `--study NAME=START..STOP:COUNT`, `--no-studies`).
40
+
41
+ ## Interpret before deciding
42
+
43
+ Read computation completion, quantity validity, target assessment and freshness separately. Engine
44
+ assessments are `MET`, `UNMET`, `INDETERMINATE` or `NOT_APPLICABLE`. A bounded quantity is an
45
+ interval; an unrelated unavailable quantity does not invalidate every result. No configured target
46
+ means no requirement was assessed.
47
+
48
+ Study `PASS`/`FAIL` classes summarize the selected targets. Keep
49
+ every sample, including invalid, partial and indeterminate ones. Objective validity and feasibility
50
+ are separate; report `NO_FEASIBLE` when no sample meets the constraints. Fractions state their
51
+ denominator; a tolerance fraction describes simulated samples under the declared distributions.
52
+
53
+ Saved results keep their identities after edits. `compare` and `os-optics results freshness RUN
54
+ --project P` report `CURRENT`, `HISTORICAL` or `UNDETERMINED` with reasons (`PHYSICS_CHANGED`,
55
+ `TARGETS_CHANGED`, ...). A historical result describes the earlier design; rerun when the task needs
56
+ the edited one.
57
+
58
+ Exit codes: 0 completed or PASS; 1 FAIL, `NO_FEASIBLE`, `NO_MATCH` or a case mismatch; 2 UNKNOWN or
59
+ `INCOMPLETE`; 3 OUT_OF_MODEL; 4 refused input, with a JSON error on stderr. Stdout is compact JSON;
60
+ details stay in files.
61
+
62
+ ## Inputs and recovery
63
+
64
+ Establish wavelength (nm), power (W), Gaussian 1/e² intensity radius and positions (mm), object IDs,
65
+ poses and the user's actual target bounds. Coordinates are right-handed; quaternions are
66
+ `[w, x, y, z]`. Read `local_axes` before moving along a local axis.
67
+
68
+ Inputs are never modified; an existing output is refused (`OUTPUT_EXISTS`) unless `--overwrite`.
69
+ Invalid edits are refused atomically. Repeating an identical `edit` returns `already_applied`;
70
+ `--expect-base-hash` refuses a changed base. Set both a study's `max_evaluations` and the Project's
71
+ compute budget, and inspect limited or partial results before raising a limit. Report commands,
72
+ versions, units, selected assessments, freshness and artifact paths.
73
+
74
+ ## Contribute
75
+
76
+ `os-optics-kit skills show contrib-case` or `contrib-tool`, then `os-optics-kit contrib case
77
+ P.json --name NAME --dry-run`. The user's own GitHub account opens the pull request (`--open-pr`);
78
+ without it the command leaves a bundle with the patch. See
79
+ [contributing with an agent](docs/contributing-with-an-agent.md).
@@ -0,0 +1,120 @@
1
+ # Contributing to os-optics-kit
2
+
3
+ os-optics-kit collects tools, engine-reproducible cases and agent skills for
4
+ [OS Optics](https://github.com/JunLin615/os-optics). Contributions are welcome as pull requests to this
5
+ repository. You open them from your own fork with your own GitHub account, by hand or through your agent.
6
+
7
+ Engine problems (the `os-optics` commands, simulation results, the optical catalog) go to the
8
+ [os-optics issue tracker](https://github.com/JunLin615/os-optics/issues).
9
+
10
+ ## What you can contribute
11
+
12
+ | Contribution | Lives in | Starts from |
13
+ | --- | --- | --- |
14
+ | Case: a design that runs on the verified engine and catalog, with its expected outcomes | `cases/<name>/` | `os-optics-kit contrib case` or [the case format](docs/case-format.md) |
15
+ | Tool: a shared helper, exposed as an `os-optics-kit` command | `tools/os_optics_kit/` | `os-optics-kit contrib tool` |
16
+ | Skill: the page an agent reads to use a tool or follow a workflow | `skills/<name>/SKILL.md` | `templates/SKILL.md` |
17
+ | Documentation, fixes, CI | anywhere | an issue or a pull request |
18
+
19
+ A helper that only one case uses stays in that case's directory; tools never depend on cases.
20
+
21
+ ## With an agent
22
+
23
+ The contribution commands do the preparation for you or your agent:
24
+
25
+ ```bash
26
+ os-optics-kit contrib case my_design.json --name my-case --dry-run # check and preview locally
27
+ os-optics-kit contrib case my_design.json --name my-case --open-pr # fork, push and open the pull request
28
+ os-optics-kit contrib tool my_helper.py --name my-tool --dry-run
29
+ ```
30
+
31
+ `contrib case` normalizes the Project, pins the engine and catalog versions, runs `project check`, `project run`
32
+ and `results targets`, renders the images, writes `CASE.md`, `README.md` and `expected.json`, and produces a
33
+ patch with a pull-request description. `--open-pr` uses your own `gh` login; without it you get a bundle directory
34
+ with the patch, which you can apply and push yourself. Step-by-step instructions, including what to tell your
35
+ agent, are in [Contributing with an agent](docs/contributing-with-an-agent.md).
36
+
37
+ ## By hand
38
+
39
+ 1. Fork the repository and create a branch.
40
+ 2. Set up an environment with the engine version in [`baseline.json`](baseline.json):
41
+
42
+ ```bash
43
+ python -m venv .venv
44
+ . .venv/bin/activate # Windows: .venv\Scripts\activate
45
+ python -m pip install --upgrade pip
46
+ python -m pip install "os-optics[protected]==0.12.0" matplotlib
47
+ python -m pip install --no-deps -e .
48
+ python -m pip install --group dev
49
+ ```
50
+
51
+ 3. Make the change, then run the checks CI runs:
52
+
53
+ ```bash
54
+ python scripts/check_repo.py
55
+ ruff check .
56
+ mypy
57
+ python -m pytest
58
+ os-optics-kit skills index --check # after changing skills: --write, then commit skills.json
59
+ os-optics-kit cases index --check # after changing cases: --write, then commit cases.json
60
+ os-optics-kit cases verify my-case # for every case you added or changed
61
+ ```
62
+
63
+ 4. Commit with a sign-off (`git commit -s`), push to your fork and open a pull request.
64
+
65
+ ## Sign-off (DCO)
66
+
67
+ Every commit needs a `Signed-off-by:` line with your name and the email of the commit author. It certifies the
68
+ [Developer Certificate of Origin](https://developercertificate.org/): you wrote the change or have the right to
69
+ submit it under the project's license. `git commit -s` adds the line. To sign off commits you already made on a
70
+ branch, run `git rebase --signoff main` and force-push the branch.
71
+
72
+ ## What CI checks
73
+
74
+ | Check | Runs on |
75
+ | --- | --- |
76
+ | Lint (`ruff`) and types (`mypy`) | every pull request |
77
+ | Unit tests without the engine, on each Python version in `baseline.json` | every pull request |
78
+ | `scripts/check_repo.py`: Markdown links resolve, no file over 1 MiB and no image over 400 KiB, no run outputs, no machine-specific paths or secrets, JSON parses, `baseline.json` agrees with the package, English and Simplified Chinese pages come in pairs | every pull request |
79
+ | `skills.json` and `cases.json` match the skills and cases | every pull request |
80
+ | Wheel and source build, `twine check`, contents check, clean `--no-deps` install and command smoke test | every pull request |
81
+ | DCO sign-off of every commit | every pull request |
82
+ | Full test suite, tool workflows and `cases verify` on the published os-optics release and catalog snapshot in `baseline.json`: the cases a pull request changes, all cases on `main` | every pull request, once that os-optics release is on PyPI |
83
+ | Linux, Windows and macOS on every Python version, all cases, and the newest os-optics release as a candidate | weekly |
84
+ | CodeQL | every pull request and weekly |
85
+
86
+ ## Acceptance criteria
87
+
88
+ A case is accepted when:
89
+
90
+ - it follows [the case format](docs/case-format.md): `project.json`, `CASE.md` (at most 700 tokens), `README.md`,
91
+ `expected.json`, and at most four images of at most 400 KiB each, rendered by the engine from the case's own run;
92
+ - `os-optics-kit cases verify NAME` reproduces `expected.json` on the engine version and catalog release it
93
+ declares, which are the ones in `baseline.json`;
94
+ - it shows something the collection does not show yet, and its README explains it in a few paragraphs;
95
+ - it contains only material you can publish under the MIT license: no private, supplier or customer data, no
96
+ run directories or 3D scene files.
97
+
98
+ A tool is accepted when:
99
+
100
+ - more than one case or workflow can use it;
101
+ - it is a module of `tools/os_optics_kit/` with `main(argv) -> int`, registered in the command table, printing
102
+ compact JSON and using the kit's exit codes;
103
+ - `os-optics-kit <command> --help` works without the engine installed (the engine is imported inside functions);
104
+ - it comes with a skill page of the same name (at most 900 tokens) and tests under `tests/`.
105
+
106
+ A skill page follows `templates/SKILL.md`: the required front matter and sections, no host-specific API, at most
107
+ 900 tokens.
108
+
109
+ ## Versions
110
+
111
+ `baseline.json` records the os-optics range the kit supports, the os-optics version it was verified with, and
112
+ the catalog release (with its SHA-256) the cases run on. Every case declares the engine and catalog it was
113
+ verified with. When a new catalog release or engine version changes a case's outcome, the case is re-verified and
114
+ its `expected.json`, `CASE.md` and images are updated in the same pull request that moves `baseline.json`.
115
+ [Engine alignment](docs/engine-alignment.md) describes the checks behind this.
116
+
117
+ ## Conduct and license
118
+
119
+ Participation follows the [Code of Conduct](CODE_OF_CONDUCT.md). Contributions are released under the
120
+ [MIT License](LICENSE). Security issues: see [SECURITY.md](SECURITY.md).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenSci and the os-optics-kit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.5
2
+ Name: os-optics-kit
3
+ Version: 0.1.0
4
+ Summary: Tools, engine-reproducible cases and vendor-neutral agent skills for OS Optics (os-optics).
5
+ Project-URL: Homepage, https://opensci-optics.com/
6
+ Project-URL: Documentation, https://github.com/JunLin615/os-optics-kit#readme
7
+ Project-URL: Source, https://github.com/JunLin615/os-optics-kit
8
+ Project-URL: Issues, https://github.com/JunLin615/os-optics-kit/issues
9
+ Author: OpenSci
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: agent skills,optical design,optics,os-optics,parameter sweep,tolerance analysis
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Physics
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: os-optics<0.13,>=0.12
25
+ Provides-Extra: plot
26
+ Requires-Dist: matplotlib<4,>=3.10; extra == 'plot'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # os-optics-kit
30
+
31
+ **Tools, engine-reproducible cases and agent skills for OS Optics.**
32
+
33
+ English · [简体中文](https://github.com/JunLin615/os-optics-kit/blob/main/README.zh-CN.md)
34
+
35
+ [![PyPI](https://img.shields.io/pypi/v/os-optics-kit.svg)](https://pypi.org/project/os-optics-kit/)
36
+ [![Python](https://img.shields.io/pypi/pyversions/os-optics-kit.svg)](https://pypi.org/project/os-optics-kit/)
37
+
38
+ os-optics-kit builds on the [OS Optics](https://github.com/JunLin615/os-optics) engine. It provides one command,
39
+ `os-optics-kit`, with tools that edit Projects by ID, sweep parameters, compare saved runs, plot, report, estimate
40
+ sensitivity and tolerance, select catalog parts and analyze detector measurements; a collection of cases, designs
41
+ that rerun on the engine and compare with their recorded outcome; and a vendor-neutral skill page for each tool,
42
+ which any coding agent can load.
43
+
44
+ | Name | Where | Contents |
45
+ | --- | --- | --- |
46
+ | [`os-optics`](https://pypi.org/project/os-optics/) | PyPI | The engine: optical catalog, simulation, results and 3D view |
47
+ | [`os-optics-kit`](https://pypi.org/project/os-optics-kit/) | PyPI | Tools, cases and agent skills built on the engine |
48
+ | [`os-optics`](https://github.com/JunLin615/os-optics) | GitHub | Product documentation and feedback |
49
+ | [`os-optics-kit`](https://github.com/JunLin615/os-optics-kit) | GitHub | This repository: tools, cases, skills and contributions |
50
+
51
+ **[Agent guide](https://github.com/JunLin615/os-optics-kit/blob/main/AGENT_GUIDE.md) · [Design studies](https://github.com/JunLin615/os-optics-kit/blob/main/docs/en/workflows.md) · [Measurements](https://github.com/JunLin615/os-optics-kit/blob/main/docs/en/measurements.md) · [External tools](https://github.com/JunLin615/os-optics-kit/blob/main/docs/en/interop.md) · [Workflow recipes](https://github.com/JunLin615/os-optics-kit/blob/main/docs/workflow-recipes.md) · [Contributing](https://github.com/JunLin615/os-optics-kit/blob/main/CONTRIBUTING.md)**
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ python -m pip install "os-optics[protected]" os-optics-kit
57
+ os-optics doctor
58
+ ```
59
+
60
+ Python 3.11 or newer. Plots need the `plot` extra: `python -m pip install "os-optics-kit[plot]"`. Cases that use
61
+ catalog components need the catalog: `os-optics catalog sync`. The engine's
62
+ [installation guide](https://github.com/JunLin615/os-optics/blob/main/docs/en/installation.md) covers virtual
63
+ environments and upgrades.
64
+
65
+ ## Quick start
66
+
67
+ ```bash
68
+ os-optics-kit skills list
69
+ os-optics-kit skills install --dest SKILLS_DIR
70
+ os-optics-kit cases list
71
+ os-optics-kit cases copy ideal-lens-focus --dest .
72
+ os-optics-kit cases verify ideal-lens-focus
73
+ cd ideal-lens-focus
74
+ os-optics project run project.json --out-dir run
75
+ os-optics-kit summary run
76
+ ```
77
+
78
+ `skills list` prints the skill index as compact JSON; `skills install` copies the skill pages into the skills
79
+ directory of your agent host (`SKILLS_DIR`). The cases ship inside the package, so `cases copy` and `cases verify`
80
+ work without a clone; `verify` reruns the case and compares the run status and every target assessment with the
81
+ recorded outcome. `os-optics-kit <command> --help` describes every command.
82
+
83
+ ## Cases
84
+
85
+ | Case | What it shows | Catalog |
86
+ | --- | --- | --- |
87
+ | [beam-expander](https://github.com/JunLin615/os-optics-kit/tree/main/cases/beam-expander) | Catalog beam expander: swap a lens, sweep its spacing, restore collimation | yes |
88
+ | [ideal-lens-focus](https://github.com/JunLin615/os-optics-kit/tree/main/cases/ideal-lens-focus) | Gaussian focus of an ideal thin lens | no |
89
+ | [expansion-focus](https://github.com/JunLin615/os-optics-kit/tree/main/cases/expansion-focus) | Beam expansion and focusing workflow with sensitivity and tolerance studies | no |
90
+ | [polarization-control](https://github.com/JunLin615/os-optics-kit/tree/main/cases/polarization-control) | Polarization control with a half-wave plate and a polarizer | no |
91
+ | [mirror-alignment](https://github.com/JunLin615/os-optics-kit/tree/main/cases/mirror-alignment) | Beam position and pointing after a fold mirror | no |
92
+ | [detector-measurements](https://github.com/JunLin615/os-optics-kit/tree/main/cases/detector-measurements) | Detector linearity and reference-channel normalization | no |
93
+ | [interop-optimization](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-optimization) | External optimization and Sobol tolerance of a beam expander | no |
94
+ | [interop-diffraction](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-diffraction) | Diffraction at a declared stop, handed off to external codes | no |
95
+ | [interop-quantum](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-quantum) | Hong-Ou-Mandel interference from the linear optical network export | no |
96
+ | [interop-metasurface](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-metasurface) | Metasurface lens as a tabulated virtual component | no |
97
+
98
+ Each case holds `project.json` (the Project with its targets), `CASE.md` (for agents), an illustrated `README.md`
99
+ and `expected.json` (the verified outcome), plus its own scripts, study specs or data. See the
100
+ [case format](https://github.com/JunLin615/os-optics-kit/blob/main/docs/case-format.md).
101
+
102
+ ## Tools and skills
103
+
104
+ | Skill | Command | Use it to |
105
+ | --- | --- | --- |
106
+ | `summary` | `os-optics-kit summary` | Read a saved run into one compact JSON document with an exit code per outcome |
107
+ | `edit` | `os-optics-kit edit` | List a Project's objects and apply edits by ID, checked by the engine and written atomically |
108
+ | `sweep` | `os-optics-kit sweep` | Run a bounded one- or two-parameter sweep, every sample saved and counted |
109
+ | `compare` | `os-optics-kit compare` | Compare saved runs or sweep samples by target and plane ID, with freshness |
110
+ | `plot` | `os-optics-kit plot` | Draw sweep curves, heatmaps, power distributions, bar charts and histograms |
111
+ | `report` | `os-optics-kit report` | Assemble a Markdown and JSON report with counts, diagnostics and artifact hashes |
112
+ | `sensitivity` | `os-optics-kit sensitivity` | Rank design parameters by finite-difference sensitivity at two step sizes |
113
+ | `tolerance` | `os-optics-kit tolerance` | Run a seeded tolerance study under declared distributions |
114
+ | `candidates` | `os-optics-kit candidates` | List catalog products that pass explicit filters, sorted by closeness to a value |
115
+ | `measurements` | `os-optics-kit measurements` | Subtract backgrounds, normalize by a reference channel and fit detector CSV data |
116
+ | `run-case` | `os-optics-kit cases` | Find, copy, run, check and adapt a case |
117
+ | `contrib-case` | `os-optics-kit contrib case` | Turn a finished design into a pull-request-ready case |
118
+ | `contrib-tool` | `os-optics-kit contrib tool` | Package a helper as a kit command with its skill page and tests |
119
+
120
+ `os-optics-kit skills show NAME` prints a skill page; [`skills.json`](https://github.com/JunLin615/os-optics-kit/blob/main/skills.json) indexes them. Tools are also
121
+ importable (`import os_optics_kit`), and `python -m os_optics_kit <command>` runs the same commands.
122
+
123
+ ## Version alignment
124
+
125
+ os-optics-kit 0.1.x requires `os-optics>=0.12,<0.13` and was verified with os-optics 0.12.0 and catalog release
126
+ 2026-10-28.1 ([`baseline.json`](https://github.com/JunLin615/os-optics-kit/blob/main/baseline.json)). Each case records the engine and catalog release it was verified
127
+ with. See [case format](https://github.com/JunLin615/os-optics-kit/blob/main/docs/case-format.md) and [engine alignment](https://github.com/JunLin615/os-optics-kit/blob/main/docs/engine-alignment.md).
128
+
129
+ ## Contributing
130
+
131
+ Cases, tools, skills and documentation are welcome as pull requests. An agent contributes with the user's own
132
+ GitHub account: `os-optics-kit contrib case` and `os-optics-kit contrib tool` verify the contribution and open the
133
+ pull request, or stop at a bundle with the patch to submit later. See [CONTRIBUTING.md](https://github.com/JunLin615/os-optics-kit/blob/main/CONTRIBUTING.md) and
134
+ [contributing with an agent](https://github.com/JunLin615/os-optics-kit/blob/main/docs/contributing-with-an-agent.md). Engine questions and bug reports go to the
135
+ [os-optics issue tracker](https://github.com/JunLin615/os-optics/issues).
136
+
137
+ ## License
138
+
139
+ os-optics-kit is released under the [MIT License](https://github.com/JunLin615/os-optics-kit/blob/main/LICENSE). The engine, os-optics, is distributed under its own
140
+ license.
@@ -0,0 +1,112 @@
1
+ # os-optics-kit
2
+
3
+ **Tools, engine-reproducible cases and agent skills for OS Optics.**
4
+
5
+ English · [简体中文](https://github.com/JunLin615/os-optics-kit/blob/main/README.zh-CN.md)
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/os-optics-kit.svg)](https://pypi.org/project/os-optics-kit/)
8
+ [![Python](https://img.shields.io/pypi/pyversions/os-optics-kit.svg)](https://pypi.org/project/os-optics-kit/)
9
+
10
+ os-optics-kit builds on the [OS Optics](https://github.com/JunLin615/os-optics) engine. It provides one command,
11
+ `os-optics-kit`, with tools that edit Projects by ID, sweep parameters, compare saved runs, plot, report, estimate
12
+ sensitivity and tolerance, select catalog parts and analyze detector measurements; a collection of cases, designs
13
+ that rerun on the engine and compare with their recorded outcome; and a vendor-neutral skill page for each tool,
14
+ which any coding agent can load.
15
+
16
+ | Name | Where | Contents |
17
+ | --- | --- | --- |
18
+ | [`os-optics`](https://pypi.org/project/os-optics/) | PyPI | The engine: optical catalog, simulation, results and 3D view |
19
+ | [`os-optics-kit`](https://pypi.org/project/os-optics-kit/) | PyPI | Tools, cases and agent skills built on the engine |
20
+ | [`os-optics`](https://github.com/JunLin615/os-optics) | GitHub | Product documentation and feedback |
21
+ | [`os-optics-kit`](https://github.com/JunLin615/os-optics-kit) | GitHub | This repository: tools, cases, skills and contributions |
22
+
23
+ **[Agent guide](https://github.com/JunLin615/os-optics-kit/blob/main/AGENT_GUIDE.md) · [Design studies](https://github.com/JunLin615/os-optics-kit/blob/main/docs/en/workflows.md) · [Measurements](https://github.com/JunLin615/os-optics-kit/blob/main/docs/en/measurements.md) · [External tools](https://github.com/JunLin615/os-optics-kit/blob/main/docs/en/interop.md) · [Workflow recipes](https://github.com/JunLin615/os-optics-kit/blob/main/docs/workflow-recipes.md) · [Contributing](https://github.com/JunLin615/os-optics-kit/blob/main/CONTRIBUTING.md)**
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ python -m pip install "os-optics[protected]" os-optics-kit
29
+ os-optics doctor
30
+ ```
31
+
32
+ Python 3.11 or newer. Plots need the `plot` extra: `python -m pip install "os-optics-kit[plot]"`. Cases that use
33
+ catalog components need the catalog: `os-optics catalog sync`. The engine's
34
+ [installation guide](https://github.com/JunLin615/os-optics/blob/main/docs/en/installation.md) covers virtual
35
+ environments and upgrades.
36
+
37
+ ## Quick start
38
+
39
+ ```bash
40
+ os-optics-kit skills list
41
+ os-optics-kit skills install --dest SKILLS_DIR
42
+ os-optics-kit cases list
43
+ os-optics-kit cases copy ideal-lens-focus --dest .
44
+ os-optics-kit cases verify ideal-lens-focus
45
+ cd ideal-lens-focus
46
+ os-optics project run project.json --out-dir run
47
+ os-optics-kit summary run
48
+ ```
49
+
50
+ `skills list` prints the skill index as compact JSON; `skills install` copies the skill pages into the skills
51
+ directory of your agent host (`SKILLS_DIR`). The cases ship inside the package, so `cases copy` and `cases verify`
52
+ work without a clone; `verify` reruns the case and compares the run status and every target assessment with the
53
+ recorded outcome. `os-optics-kit <command> --help` describes every command.
54
+
55
+ ## Cases
56
+
57
+ | Case | What it shows | Catalog |
58
+ | --- | --- | --- |
59
+ | [beam-expander](https://github.com/JunLin615/os-optics-kit/tree/main/cases/beam-expander) | Catalog beam expander: swap a lens, sweep its spacing, restore collimation | yes |
60
+ | [ideal-lens-focus](https://github.com/JunLin615/os-optics-kit/tree/main/cases/ideal-lens-focus) | Gaussian focus of an ideal thin lens | no |
61
+ | [expansion-focus](https://github.com/JunLin615/os-optics-kit/tree/main/cases/expansion-focus) | Beam expansion and focusing workflow with sensitivity and tolerance studies | no |
62
+ | [polarization-control](https://github.com/JunLin615/os-optics-kit/tree/main/cases/polarization-control) | Polarization control with a half-wave plate and a polarizer | no |
63
+ | [mirror-alignment](https://github.com/JunLin615/os-optics-kit/tree/main/cases/mirror-alignment) | Beam position and pointing after a fold mirror | no |
64
+ | [detector-measurements](https://github.com/JunLin615/os-optics-kit/tree/main/cases/detector-measurements) | Detector linearity and reference-channel normalization | no |
65
+ | [interop-optimization](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-optimization) | External optimization and Sobol tolerance of a beam expander | no |
66
+ | [interop-diffraction](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-diffraction) | Diffraction at a declared stop, handed off to external codes | no |
67
+ | [interop-quantum](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-quantum) | Hong-Ou-Mandel interference from the linear optical network export | no |
68
+ | [interop-metasurface](https://github.com/JunLin615/os-optics-kit/tree/main/cases/interop-metasurface) | Metasurface lens as a tabulated virtual component | no |
69
+
70
+ Each case holds `project.json` (the Project with its targets), `CASE.md` (for agents), an illustrated `README.md`
71
+ and `expected.json` (the verified outcome), plus its own scripts, study specs or data. See the
72
+ [case format](https://github.com/JunLin615/os-optics-kit/blob/main/docs/case-format.md).
73
+
74
+ ## Tools and skills
75
+
76
+ | Skill | Command | Use it to |
77
+ | --- | --- | --- |
78
+ | `summary` | `os-optics-kit summary` | Read a saved run into one compact JSON document with an exit code per outcome |
79
+ | `edit` | `os-optics-kit edit` | List a Project's objects and apply edits by ID, checked by the engine and written atomically |
80
+ | `sweep` | `os-optics-kit sweep` | Run a bounded one- or two-parameter sweep, every sample saved and counted |
81
+ | `compare` | `os-optics-kit compare` | Compare saved runs or sweep samples by target and plane ID, with freshness |
82
+ | `plot` | `os-optics-kit plot` | Draw sweep curves, heatmaps, power distributions, bar charts and histograms |
83
+ | `report` | `os-optics-kit report` | Assemble a Markdown and JSON report with counts, diagnostics and artifact hashes |
84
+ | `sensitivity` | `os-optics-kit sensitivity` | Rank design parameters by finite-difference sensitivity at two step sizes |
85
+ | `tolerance` | `os-optics-kit tolerance` | Run a seeded tolerance study under declared distributions |
86
+ | `candidates` | `os-optics-kit candidates` | List catalog products that pass explicit filters, sorted by closeness to a value |
87
+ | `measurements` | `os-optics-kit measurements` | Subtract backgrounds, normalize by a reference channel and fit detector CSV data |
88
+ | `run-case` | `os-optics-kit cases` | Find, copy, run, check and adapt a case |
89
+ | `contrib-case` | `os-optics-kit contrib case` | Turn a finished design into a pull-request-ready case |
90
+ | `contrib-tool` | `os-optics-kit contrib tool` | Package a helper as a kit command with its skill page and tests |
91
+
92
+ `os-optics-kit skills show NAME` prints a skill page; [`skills.json`](https://github.com/JunLin615/os-optics-kit/blob/main/skills.json) indexes them. Tools are also
93
+ importable (`import os_optics_kit`), and `python -m os_optics_kit <command>` runs the same commands.
94
+
95
+ ## Version alignment
96
+
97
+ os-optics-kit 0.1.x requires `os-optics>=0.12,<0.13` and was verified with os-optics 0.12.0 and catalog release
98
+ 2026-10-28.1 ([`baseline.json`](https://github.com/JunLin615/os-optics-kit/blob/main/baseline.json)). Each case records the engine and catalog release it was verified
99
+ with. See [case format](https://github.com/JunLin615/os-optics-kit/blob/main/docs/case-format.md) and [engine alignment](https://github.com/JunLin615/os-optics-kit/blob/main/docs/engine-alignment.md).
100
+
101
+ ## Contributing
102
+
103
+ Cases, tools, skills and documentation are welcome as pull requests. An agent contributes with the user's own
104
+ GitHub account: `os-optics-kit contrib case` and `os-optics-kit contrib tool` verify the contribution and open the
105
+ pull request, or stop at a bundle with the patch to submit later. See [CONTRIBUTING.md](https://github.com/JunLin615/os-optics-kit/blob/main/CONTRIBUTING.md) and
106
+ [contributing with an agent](https://github.com/JunLin615/os-optics-kit/blob/main/docs/contributing-with-an-agent.md). Engine questions and bug reports go to the
107
+ [os-optics issue tracker](https://github.com/JunLin615/os-optics/issues).
108
+
109
+ ## License
110
+
111
+ os-optics-kit is released under the [MIT License](https://github.com/JunLin615/os-optics-kit/blob/main/LICENSE). The engine, os-optics, is distributed under its own
112
+ license.
@@ -0,0 +1,106 @@
1
+ # os-optics-kit
2
+
3
+ **OS Optics 的工具、可由引擎复现的案例和 Agent 技能。**
4
+
5
+ [English](README.md) · 简体中文
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/os-optics-kit.svg)](https://pypi.org/project/os-optics-kit/)
8
+ [![Python](https://img.shields.io/pypi/pyversions/os-optics-kit.svg)](https://pypi.org/project/os-optics-kit/)
9
+
10
+ os-optics-kit 基于 [OS Optics](https://github.com/JunLin615/os-optics) 引擎,提供一个命令 `os-optics-kit`:
11
+ 其中的工具可以按标识修改 Project、扫描参数、比较已保存的运行、绘图、生成报告、估计灵敏度和公差、
12
+ 挑选目录元件以及分析探测器测量数据;一组案例,即可在引擎上重新运行并与记录结果比较的设计;以及每个工具
13
+ 对应的一份与厂商无关的技能说明,任何编程 Agent 都可以加载。
14
+
15
+ | 名称 | 位置 | 内容 |
16
+ | --- | --- | --- |
17
+ | [`os-optics`](https://pypi.org/project/os-optics/) | PyPI | 引擎:光学元件目录、仿真、结果与三维视图 |
18
+ | [`os-optics-kit`](https://pypi.org/project/os-optics-kit/) | PyPI | 基于引擎的工具、案例和 Agent 技能 |
19
+ | [`os-optics`](https://github.com/JunLin615/os-optics) | GitHub | 产品文档与问题反馈 |
20
+ | [`os-optics-kit`](https://github.com/JunLin615/os-optics-kit) | GitHub | 本仓库:工具、案例、技能与贡献 |
21
+
22
+ **[Agent 指南(英文)](AGENT_GUIDE.md) · [设计研究](docs/zh-CN/workflows.md) · [测量数据](docs/zh-CN/measurements.md) · [外部工具](docs/zh-CN/interop.md) · [工作流程步骤(英文)](docs/workflow-recipes.md) · [参与贡献(英文)](CONTRIBUTING.md)**
23
+
24
+ ## 安装
25
+
26
+ ```bash
27
+ python -m pip install "os-optics[protected]" os-optics-kit
28
+ os-optics doctor
29
+ ```
30
+
31
+ 需要 Python 3.11 及以上版本。绘图需要 `plot` 扩展:`python -m pip install "os-optics-kit[plot]"`。
32
+ 使用目录元件的案例需要光学元件目录:`os-optics catalog sync`。虚拟环境和升级方法见引擎的
33
+ [安装指南](https://github.com/JunLin615/os-optics/blob/main/docs/zh-CN/installation.md)。
34
+
35
+ ## 快速开始
36
+
37
+ ```bash
38
+ os-optics-kit skills list
39
+ os-optics-kit skills install --dest SKILLS_DIR
40
+ os-optics-kit cases list
41
+ os-optics-kit cases copy ideal-lens-focus --dest .
42
+ os-optics-kit cases verify ideal-lens-focus
43
+ cd ideal-lens-focus
44
+ os-optics project run project.json --out-dir run
45
+ os-optics-kit summary run
46
+ ```
47
+
48
+ `skills list` 以紧凑 JSON 输出技能索引;`skills install` 把技能说明复制到 Agent 宿主的技能目录
49
+ (`SKILLS_DIR`)。案例随软件包一起安装,因此 `cases copy` 和 `cases verify` 无需克隆仓库;`verify`
50
+ 重新运行案例,并将运行状态和每个目标判定与记录结果比较。`os-optics-kit <命令> --help` 说明每个命令。
51
+
52
+ ## 案例
53
+
54
+ | 案例 | 内容 | 目录 |
55
+ | --- | --- | --- |
56
+ | [beam-expander](cases/beam-expander) | 目录元件扩束器:更换透镜、扫描间距、恢复准直 | 是 |
57
+ | [ideal-lens-focus](cases/ideal-lens-focus) | 理想薄透镜的高斯聚焦 | 否 |
58
+ | [expansion-focus](cases/expansion-focus) | 扩束与聚焦工作流程,含灵敏度和公差研究 | 否 |
59
+ | [polarization-control](cases/polarization-control) | 用半波片和偏振器控制偏振 | 否 |
60
+ | [mirror-alignment](cases/mirror-alignment) | 折返镜后的光束位置和指向 | 否 |
61
+ | [detector-measurements](cases/detector-measurements) | 探测器线性度与参考通道归一化 | 否 |
62
+ | [interop-optimization](cases/interop-optimization) | 扩束器的外部优化与 Sobol 公差分析 | 否 |
63
+ | [interop-diffraction](cases/interop-diffraction) | 声明光阑处的衍射,交给外部程序计算 | 否 |
64
+ | [interop-quantum](cases/interop-quantum) | 基于线性光学网络导出的 Hong-Ou-Mandel 干涉 | 否 |
65
+ | [interop-metasurface](cases/interop-metasurface) | 作为表格化虚拟元件的超表面透镜 | 否 |
66
+
67
+ 每个案例包含 `project.json`(带目标的 Project)、`CASE.md`(供 Agent 阅读)、带插图的 `README.md`
68
+ 和 `expected.json`(验证结果),以及案例自己的脚本、研究规格或数据。见[案例格式(英文)](docs/case-format.md)。
69
+
70
+ ## 工具与技能
71
+
72
+ | 技能 | 命令 | 用途 |
73
+ | --- | --- | --- |
74
+ | `summary` | `os-optics-kit summary` | 把已保存的运行读成一个紧凑 JSON 文档,并按结果给出退出码 |
75
+ | `edit` | `os-optics-kit edit` | 列出 Project 中的对象,按标识修改,由引擎检查并原子写入 |
76
+ | `sweep` | `os-optics-kit sweep` | 运行有界的单参数或双参数扫描,保存并统计每个样本 |
77
+ | `compare` | `os-optics-kit compare` | 按目标和平面标识比较已保存的运行或扫描样本,并给出时效 |
78
+ | `plot` | `os-optics-kit plot` | 绘制扫描曲线、热图、功率分布、条形图和直方图 |
79
+ | `report` | `os-optics-kit report` | 生成 Markdown 和 JSON 报告,含计数、诊断信息和产物哈希 |
80
+ | `sensitivity` | `os-optics-kit sensitivity` | 以两种步长的有限差分灵敏度对设计参数排序 |
81
+ | `tolerance` | `os-optics-kit tolerance` | 在声明的分布下运行带种子的公差研究 |
82
+ | `candidates` | `os-optics-kit candidates` | 列出满足明确筛选条件的目录产品,按与给定值的接近程度排序 |
83
+ | `measurements` | `os-optics-kit measurements` | 扣除背景、按参考通道归一化并拟合探测器 CSV 数据 |
84
+ | `run-case` | `os-optics-kit cases` | 查找、复制、运行、核对并修改案例 |
85
+ | `contrib-case` | `os-optics-kit contrib case` | 把完成的设计整理成可直接提交拉取请求的案例 |
86
+ | `contrib-tool` | `os-optics-kit contrib tool` | 把辅助脚本打包为套件命令,附技能说明和测试 |
87
+
88
+ `os-optics-kit skills show NAME` 输出一份技能说明;[`skills.json`](skills.json) 是技能索引。工具也可以
89
+ 在 Python 中导入(`import os_optics_kit`),`python -m os_optics_kit <命令>` 运行同样的命令。
90
+
91
+ ## 版本对应
92
+
93
+ os-optics-kit 0.1.x 需要 `os-optics>=0.12,<0.13`,已在 os-optics 0.12.0 和目录版本 2026-10-28.1 上验证
94
+ ([`baseline.json`](baseline.json))。每个案例记录验证时使用的引擎和目录版本。见
95
+ [案例格式(英文)](docs/case-format.md)和[引擎对齐(英文)](docs/engine-alignment.md)。
96
+
97
+ ## 参与贡献
98
+
99
+ 欢迎以拉取请求提交案例、工具、技能和文档。Agent 使用用户自己的 GitHub 账号贡献:
100
+ `os-optics-kit contrib case` 和 `os-optics-kit contrib tool` 验证贡献内容并打开拉取请求,或生成含补丁的
101
+ 文件包,供之后提交。见 [CONTRIBUTING.md](CONTRIBUTING.md) 和[用 Agent 参与贡献(英文)](docs/contributing-with-an-agent.md)。
102
+ 引擎相关的问题和缺陷报告请提交到 [os-optics 问题反馈](https://github.com/JunLin615/os-optics/issues)。
103
+
104
+ ## 许可证
105
+
106
+ os-optics-kit 采用 [MIT 许可证](LICENSE)。引擎 os-optics 按其自身的许可证分发。