ray-tracing-shapely 0.3.1__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.
- ray_tracing_shapely-0.3.1/PKG-INFO +227 -0
- ray_tracing_shapely-0.3.1/README.md +175 -0
- ray_tracing_shapely-0.3.1/pyproject.toml +166 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/__init__.py +45 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/__init__.py +228 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/agentic_db.py +941 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/agentic_tools.py +1991 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/bidirectional.py +616 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/fresnel_utils.py +277 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/glass_geometry.py +1424 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/irradiance.py +387 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/lineage_analysis.py +501 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/mcp_server.py +194 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/portable_scene.py +175 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/ray_geometry_queries.py +542 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/ray_jobs.py +370 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/render_result.py +123 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/run_registry.py +398 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/saving.py +439 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/signature_analysis.py +629 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/simulation_result.py +1057 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/targeted_resimulation.py +303 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/targeted_resimulation_flow.py +690 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/analysis/tool_registry.py +1579 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/__init__.py +34 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/constants.py +47 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/equation.py +597 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/geometry.py +572 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/glass_curves.py +827 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/glass_spans.py +394 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/ray.py +419 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/ray_lineage.py +320 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene.py +612 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/__init__.py +32 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/base_custom_surface.py +596 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/base_filter.py +227 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/base_glass.py +1002 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/base_grin_glass.py +782 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/base_scene_obj.py +704 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/blocker/__init__.py +20 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/blocker/blocker.py +312 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/circle_obj_mixin.py +476 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/glass/__init__.py +22 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/glass/glass.py +1007 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/glass/ideal_lens.py +469 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/glass/spherical_lens.py +563 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/ground_glass.py +479 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/light_source/__init__.py +23 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/light_source/angle_source.py +579 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/light_source/backward_detector_source.py +222 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/light_source/beam.py +742 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/light_source/point_source.py +483 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/light_source/single_ray.py +404 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/line_obj_mixin.py +467 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/mirror/__init__.py +21 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/mirror/ideal_mirror.py +631 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/mirror/mirror.py +415 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/other/__init__.py +11 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/other/detector.py +550 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/scene_objs/param_curve_obj_mixin.py +916 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/simulator.py +1575 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/core/svg_renderer.py +2301 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/_fake_modal.py +139 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/_flow_jobs.py +55 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/conftest.py +61 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_angle_transformer.py +217 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_architecture_layering.py +241 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_asphere_curve.py +263 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_beam_ray_count.py +79 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_bidirectional.py +932 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_conic_mirror.py +348 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_context_registry.py +154 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_contract_references.py +109 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_curved_glass_analysis.py +266 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_detector_agentic_tools.py +364 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_detector_hit_records.py +770 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_eye_safety.py +1531 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_eye_safety_classification_flow.py +1308 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_flow_executors.py +366 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_flow_tools.py +234 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_flows_dashboard.py +168 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_flows_package.py +96 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_glass_arc_exit.py +79 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_glass_curves.py +312 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_grazing_incidence.py +510 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_irradiance.py +124 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_led_collimators.py +279 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_linear_sensor.py +456 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_mirror_coated_edge.py +109 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_modal_executor.py +250 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_nonimaging_geometry.py +415 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_nonimaging_prisms.py +213 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_phase1_agentic_db.py +498 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_phase2_schemas_and_lineage.py +443 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_phase3_render_result.py +358 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_phase7_agentic_svg_tools.py +378 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_physical_scene.py +524 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_portable_resimulation.py +249 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_prisms.py +1150 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_profile_export.py +265 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_profile_scan.py +276 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_radiation_plot.py +107 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_ray_jobs.py +133 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_ray_lineage.py +164 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rayfile.py +110 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rayfile_slice.py +115 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rayfile_slicing_flow.py +222 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rayfile_source_spec.py +108 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_refractometer_prism.py +393 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_roles.py +197 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rr_lens.py +239 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_run_registry.py +349 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rx_concentrator.py +93 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rxi.py +326 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_rxi_direct.py +279 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_saved_runs_in_context.py +261 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_signature_analysis.py +531 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_singlet_lens_profile.py +362 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_sms_chain.py +398 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_sms_claims.py +264 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_sms_splines.py +140 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_source_spec.py +190 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_spherical_lens.py +124 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_spline_mirror.py +112 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_surface_hit_records.py +405 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_svg_renderer.py +516 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_targeted_resimulation.py +359 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_targeted_resimulation_flow.py +281 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_tir_analysis.py +511 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_tool_lists.py +145 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_version.py +35 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/developer_tests/test_xr_concentrator.py +130 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/bulk_lens_demo/bulk_lens_collimation_demo.py +251 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/bulk_lens_demo/lens_validator.py +227 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/bulk_lens_demo/test_arc_rendering.py +223 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/bulk_lens_demo/test_corrected_lens.py +141 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/bulk_lens_demo/test_single_lens.py +139 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/collimation_demo/demo.py +218 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/coupled_prisms/test_glass_geometry.py +182 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/coupled_prisms/test_surface_merging.py +128 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/coupled_prisms/uncoupled_copled_prisms.py +613 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/reflectometer_1/fig_1.py +17 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/tir_demo/test_verbose.py +90 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/tir_demo/test_verbose_propagation.py +182 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/examples/tir_demo/tir_demo.py +278 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/__init__.py +124 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/agentic.py +293 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/budgets.py +138 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/dashboard.py +631 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/executors.py +561 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/fields.py +160 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/flow_base.py +840 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/kinds.py +110 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/modal_executor.py +537 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/persistence.py +255 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/runs.py +173 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/flows/worker.py +35 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/__init__.py +218 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/__init__.py +140 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/angular_subtense.py +147 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/correction_factors.py +157 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/exposure_duration.py +162 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/hazard_functions.py +225 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/iec60825_1.py +741 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/iec62471.py +755 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/pupil_aperture.py +182 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/radiometry_conversions.py +81 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/result.py +90 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety/spectral_data.py +249 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/__init__.py +138 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/dashboard.py +29 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/dimensional_checks.py +249 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/explanations.py +226 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/flow_base.py +29 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/iec60825_1_flow.py +275 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/iec62471_flow.py +439 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/intake_flow.py +716 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/eye_safety_classification_flow/persistence.py +29 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/lenses/__init__.py +39 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/lenses/collimator_design.py +168 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/lenses/fresnel.py +333 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/lenses/profile_scan.py +792 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/lenses/singlet.py +300 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/lenses/tir_collimator.py +421 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/mirrors/__init__.py +26 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/mirrors/conic.py +330 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/mirrors/sheet_profile.py +216 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/mirrors/spline.py +195 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physical_scene.py +114 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physics/__init__.py +41 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physics/exceptions.py +25 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physics/liv_curve.py +54 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physics/photoconversion.py +259 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physics/photoemission.py +83 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/physics/projection.py +299 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/__init__.py +283 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/angle_transformer.py +193 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/base_prism.py +983 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/dtirc.py +245 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/equilateral.py +243 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/nonimaging_geometry.py +471 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/prism_utils.py +472 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/profile_export.py +760 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/refractometer.py +849 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/right_angle.py +285 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/rr_lens.py +309 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/rx_concentrator.py +251 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/rxi.py +355 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/rxi_direct.py +507 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/sms_chain.py +884 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/tir_utils.py +459 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/prisms/xr_concentrator.py +320 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/roles.py +76 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sensors/__init__.py +35 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sensors/linear_sensor.py +550 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/__init__.py +33 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/radiation_plot.py +316 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/ray_set_source.py +148 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/rayfile.py +276 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/rayfile_slice.py +205 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/rayfile_slicing_flow.py +607 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/sources/source_spec.py +574 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely/optical_elements/units.py +277 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely.egg-info/PKG-INFO +227 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely.egg-info/SOURCES.txt +447 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely.egg-info/dependency_links.txt +1 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely.egg-info/requires.txt +39 -0
- ray_tracing_shapely-0.3.1/ray_tracing_shapely.egg-info/top_level.txt +1 -0
- ray_tracing_shapely-0.3.1/setup.cfg +4 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ray-tracing-shapely
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Python ray tracing library using Shapely for computational geometry
|
|
5
|
+
Author: ray-tracing-shapely authors and contributors
|
|
6
|
+
Author-email: Michele Benetti <michele@tiberavon.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/tiberavon/ray-tracing-shapely
|
|
9
|
+
Project-URL: Repository, https://github.com/tiberavon/ray-tracing-shapely
|
|
10
|
+
Project-URL: Documentation, https://github.com/tiberavon/ray-tracing-shapely#readme
|
|
11
|
+
Keywords: ray-tracing,optics,simulation,shapely,physics
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: shapely>=2.0.0
|
|
23
|
+
Requires-Dist: sympy>=1.12
|
|
24
|
+
Requires-Dist: numpy>=1.23.2
|
|
25
|
+
Requires-Dist: svgwrite>=1.4.0
|
|
26
|
+
Requires-Dist: networkx>=3.0
|
|
27
|
+
Provides-Extra: radiometry
|
|
28
|
+
Requires-Dist: pint>=0.24; extra == "radiometry"
|
|
29
|
+
Provides-Extra: flows
|
|
30
|
+
Requires-Dist: transitions>=0.9; extra == "flows"
|
|
31
|
+
Requires-Dist: graphviz>=0.20; extra == "flows"
|
|
32
|
+
Provides-Extra: eye-safety
|
|
33
|
+
Requires-Dist: ray-tracing-shapely[flows,radiometry]; extra == "eye-safety"
|
|
34
|
+
Provides-Extra: agentic
|
|
35
|
+
Requires-Dist: mcp<2,>=1.2; extra == "agentic"
|
|
36
|
+
Provides-Extra: modal
|
|
37
|
+
Requires-Dist: ray-tracing-shapely[flows]; extra == "modal"
|
|
38
|
+
Requires-Dist: modal>=1.6; extra == "modal"
|
|
39
|
+
Provides-Extra: notebook
|
|
40
|
+
Requires-Dist: jupyterlab; extra == "notebook"
|
|
41
|
+
Requires-Dist: papermill; extra == "notebook"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: ray-tracing-shapely[agentic,eye-safety,flows,modal,notebook,radiometry]; extra == "all"
|
|
44
|
+
Provides-Extra: test
|
|
45
|
+
Requires-Dist: ray-tracing-shapely[agentic,eye-safety,flows,radiometry]; extra == "test"
|
|
46
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
47
|
+
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: ray-tracing-shapely[all]; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
51
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
52
|
+
|
|
53
|
+
# ray-tracing-shapely
|
|
54
|
+
|
|
55
|
+
[](https://doi.org/10.5281/zenodo.23991020)
|
|
56
|
+
|
|
57
|
+
A 2D optical **analysis and design** environment in Python, built on
|
|
58
|
+
[Shapely](https://shapely.readthedocs.io/) for geometry. It began as a
|
|
59
|
+
translation of a JavaScript interactive simulator and grew into something with
|
|
60
|
+
a different purpose.
|
|
61
|
+
|
|
62
|
+
## What it is for
|
|
63
|
+
|
|
64
|
+
Most 2D optics tools let you *watch* rays. This one lets you ask questions
|
|
65
|
+
about them afterwards, and lets you design a surface from what you want the
|
|
66
|
+
light to do.
|
|
67
|
+
|
|
68
|
+
Every traced ray keeps its lineage — a parent, a unique identity, the surfaces
|
|
69
|
+
it met and what happened at each one. That turns a simulation from a picture
|
|
70
|
+
into a record you can query: which paths reach the detector, how much energy
|
|
71
|
+
each carries, where two designs begin to differ, which rays are trapped by
|
|
72
|
+
repeated total internal reflection. Runs are stored and compared, so "did that
|
|
73
|
+
change help?" is a question with an answer rather than an impression.
|
|
74
|
+
|
|
75
|
+
On top of that sit layers the original simulator does not have:
|
|
76
|
+
|
|
77
|
+
- **Ray lineage as a graph** — parent/child tracking, structural path
|
|
78
|
+
signatures, bidirectional tracing that connects a forward tree from the
|
|
79
|
+
sources to a backward tree from the detector.
|
|
80
|
+
- **Nonimaging design** — CPC-family concentrators (DTIRC, angle transformer,
|
|
81
|
+
RXI) and Miñano–Benítez Simultaneous Multiple Surface profile construction
|
|
82
|
+
(RR / RX / XR / RXI), on a reusable plane-curve toolbox. Surfaces are built from
|
|
83
|
+
optical requirements, not from vertices typed in by hand.
|
|
84
|
+
- **Lenses and aspheres** — labelled singlets, LED collimators (a TIR lens and
|
|
85
|
+
a Fresnel lens) and exact even aspheres as glass edges, with the
|
|
86
|
+
coefficients in Zemax's and Optiland's order. A lens face measured by a
|
|
87
|
+
profilometer is read from its DXF and fitted with its vertex and tilt. The
|
|
88
|
+
fit reports which of its numbers the data do not separately determine, and
|
|
89
|
+
becomes two models of the lens, fitted and as measured.
|
|
90
|
+
- **Light sources and measured LEDs** — a source described once, built in 2D
|
|
91
|
+
and in 3D, and stored with the element it lights in `profile.json`. An LED's
|
|
92
|
+
rayfile (IES TM-25) is read, drawn as a radiation pattern, and sliced into
|
|
93
|
+
the 2D plane, with the share of its light a 2D section cannot carry stated.
|
|
94
|
+
- **Light on a plane** — the irradiance map, and the 2D line profile, of the
|
|
95
|
+
light that leaves an optic.
|
|
96
|
+
- **Radiometry and eye safety** — unit-checked physical quantities, and
|
|
97
|
+
exposure-limit routines for IEC 60825-1 (lasers) and IEC 62471 (lamps and
|
|
98
|
+
LEDs), run as explicit state machines rather than nested conditionals.
|
|
99
|
+
- **An agentic surface** — the whole query layer is exposed as tools a language
|
|
100
|
+
model can call, sharing one live kernel with the human at the notebook.
|
|
101
|
+
Several runs are held at once as named contexts, a saved run is reloaded by
|
|
102
|
+
reference, and a package built on the library adds tools of its own beside
|
|
103
|
+
the core's.
|
|
104
|
+
- **Long runs, off the notebook** — a procedure is a flow: a fixed diagram
|
|
105
|
+
whose every step is recorded, so a run that stops can be read back. Its long
|
|
106
|
+
jobs go to local processes or to Modal's serverless containers, each with an
|
|
107
|
+
estimate of its time and cost before it starts, and a local dashboard shows
|
|
108
|
+
what is running and what it has cost. A targeted re-simulation of the paths
|
|
109
|
+
that matter, cut into chunks, runs this way and gives the run the kernel
|
|
110
|
+
would have given.
|
|
111
|
+
- **Run persistence** — parameter sweeps, stored results, cross-run
|
|
112
|
+
comparison.
|
|
113
|
+
|
|
114
|
+
If you want an interactive simulator with a gallery of worked scenes, the
|
|
115
|
+
upstream [Ray Optics Simulation](https://github.com/ricktu288/ray-optics) is
|
|
116
|
+
better. This is more an analytical tool to understand a design.
|
|
117
|
+
|
|
118
|
+
## Install
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
pip install ray-tracing-shapely
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The core install stays deliberately small — `shapely`, `numpy`, `sympy`,
|
|
125
|
+
`svgwrite`, `networkx`. The heavier layers are extras, so you only pay for
|
|
126
|
+
what you use:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
pip install "ray-tracing-shapely[radiometry]" # unit-checked quantities (pint)
|
|
130
|
+
pip install "ray-tracing-shapely[flows]" # observable step-by-step procedures (transitions)
|
|
131
|
+
pip install "ray-tracing-shapely[eye-safety]" # IEC 60825-1 / IEC 62471
|
|
132
|
+
pip install "ray-tracing-shapely[agentic]" # the MCP tool surface
|
|
133
|
+
pip install "ray-tracing-shapely[modal]" # flows' jobs on Modal (the Modal client)
|
|
134
|
+
pip install "ray-tracing-shapely[notebook]" # running the example notebooks (jupyterlab, papermill)
|
|
135
|
+
pip install "ray-tracing-shapely[all]" # everything
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Python 3.11 or newer.
|
|
139
|
+
|
|
140
|
+
## Thirty seconds
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from ray_tracing_shapely.core.scene import Scene
|
|
144
|
+
from ray_tracing_shapely.core.scene_objs import Glass, SingleRay
|
|
145
|
+
from ray_tracing_shapely.core.simulator import Simulator
|
|
146
|
+
|
|
147
|
+
scene = Scene()
|
|
148
|
+
scene.color_mode = 'linear'
|
|
149
|
+
|
|
150
|
+
prism = Glass(scene)
|
|
151
|
+
prism.path = [
|
|
152
|
+
{'x': 100, 'y': 50, 'arc': False},
|
|
153
|
+
{'x': 200, 'y': 50, 'arc': False},
|
|
154
|
+
{'x': 150, 'y': 150, 'arc': False},
|
|
155
|
+
]
|
|
156
|
+
prism.refIndex = 1.5
|
|
157
|
+
scene.add_object(prism)
|
|
158
|
+
|
|
159
|
+
ray = SingleRay(scene)
|
|
160
|
+
ray.p1 = {'x': 50, 'y': 100}
|
|
161
|
+
ray.p2 = {'x': 100, 'y': 100}
|
|
162
|
+
scene.add_object(ray)
|
|
163
|
+
|
|
164
|
+
segments = Simulator(scene, max_rays=1000).run()
|
|
165
|
+
print(f"Traced {len(segments)} ray segments") # Traced 16 ray segments
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Sixteen segments from one incident ray: it refracts into the glass, reflects
|
|
169
|
+
internally, and splits at each surface it meets. Render the result as SVG with
|
|
170
|
+
`SVGRenderer`, and every element it draws carries the identity of the ray or
|
|
171
|
+
object that produced it, so a diagram can be clicked back to the simulation
|
|
172
|
+
that made it.
|
|
173
|
+
|
|
174
|
+
## Documentation
|
|
175
|
+
|
|
176
|
+
The code is documented in two layers, both shipped with the package:
|
|
177
|
+
|
|
178
|
+
- **`dev_doc/concepts/`** — why the code has the shape it has. Thirty-seven
|
|
179
|
+
numbered concepts, each stating one claim and the evidence for it, written
|
|
180
|
+
for a reader who wants to understand the design rather than just call it.
|
|
181
|
+
- **`dev_doc/architecture/`** — what is true now: a component map, a port
|
|
182
|
+
register, and contracts stating what each boundary assumes and guarantees.
|
|
183
|
+
|
|
184
|
+
Docstrings cite both, so a question that starts in the code has somewhere to
|
|
185
|
+
go.
|
|
186
|
+
|
|
187
|
+
## Citing
|
|
188
|
+
|
|
189
|
+
If you use this software, please cite **both** this project and the Ray Optics
|
|
190
|
+
Simulation project it is in part translated from. `CITATION.cff` carries the
|
|
191
|
+
metadata for both; GitHub will format it for you from the *Cite this
|
|
192
|
+
repository* link.
|
|
193
|
+
|
|
194
|
+
This project: [doi:10.5281/zenodo.23991020](https://doi.org/10.5281/zenodo.23991020)
|
|
195
|
+
— that is the *concept* DOI and always resolves to the latest release. Each
|
|
196
|
+
release also has its own DOI, which is what to cite if you need to pin the
|
|
197
|
+
exact version a result came from.
|
|
198
|
+
|
|
199
|
+
Upstream: [doi:10.5281/zenodo.6386611](https://doi.org/10.5281/zenodo.6386611).
|
|
200
|
+
|
|
201
|
+
## Licence and attribution
|
|
202
|
+
|
|
203
|
+
Apache-2.0. See `LICENSE.txt` and `NOTICE.txt`.
|
|
204
|
+
|
|
205
|
+
<!-- attribution:begin -- generated by dev_doc/tools/attribution.py, do not edit -->
|
|
206
|
+
This project began as a translation of the
|
|
207
|
+
[Ray Optics Simulation](https://github.com/ricktu288/ray-optics) JavaScript project
|
|
208
|
+
(Copyright 2024 its authors and contributors, Apache-2.0,
|
|
209
|
+
[doi:10.5281/zenodo.6386611](https://doi.org/10.5281/zenodo.6386611)), and has grown a
|
|
210
|
+
great deal of new work on top of it.
|
|
211
|
+
|
|
212
|
+
Of this distribution's 220 source files, **35 are translations** of
|
|
213
|
+
that project — the ray-tracing engine and its scene objects — and **185
|
|
214
|
+
were written for this project**: the analysis layer, the nonimaging design
|
|
215
|
+
methods, the radiometric and photobiological layers, the agentic surface,
|
|
216
|
+
and the tests and examples. Every file says which it is in its own header,
|
|
217
|
+
and `NOTICE.txt` lists the translated set.
|
|
218
|
+
|
|
219
|
+
If you use this software please cite both, per `CITATION.cff`.
|
|
220
|
+
<!-- attribution:end -->
|
|
221
|
+
|
|
222
|
+
## Status
|
|
223
|
+
|
|
224
|
+
Early development: the translation of the original
|
|
225
|
+
simulator is not complete, and the API is not yet stable. Issues and
|
|
226
|
+
descriptions of what you are trying to do are the most useful contribution
|
|
227
|
+
right now .
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# ray-tracing-shapely
|
|
2
|
+
|
|
3
|
+
[](https://doi.org/10.5281/zenodo.23991020)
|
|
4
|
+
|
|
5
|
+
A 2D optical **analysis and design** environment in Python, built on
|
|
6
|
+
[Shapely](https://shapely.readthedocs.io/) for geometry. It began as a
|
|
7
|
+
translation of a JavaScript interactive simulator and grew into something with
|
|
8
|
+
a different purpose.
|
|
9
|
+
|
|
10
|
+
## What it is for
|
|
11
|
+
|
|
12
|
+
Most 2D optics tools let you *watch* rays. This one lets you ask questions
|
|
13
|
+
about them afterwards, and lets you design a surface from what you want the
|
|
14
|
+
light to do.
|
|
15
|
+
|
|
16
|
+
Every traced ray keeps its lineage — a parent, a unique identity, the surfaces
|
|
17
|
+
it met and what happened at each one. That turns a simulation from a picture
|
|
18
|
+
into a record you can query: which paths reach the detector, how much energy
|
|
19
|
+
each carries, where two designs begin to differ, which rays are trapped by
|
|
20
|
+
repeated total internal reflection. Runs are stored and compared, so "did that
|
|
21
|
+
change help?" is a question with an answer rather than an impression.
|
|
22
|
+
|
|
23
|
+
On top of that sit layers the original simulator does not have:
|
|
24
|
+
|
|
25
|
+
- **Ray lineage as a graph** — parent/child tracking, structural path
|
|
26
|
+
signatures, bidirectional tracing that connects a forward tree from the
|
|
27
|
+
sources to a backward tree from the detector.
|
|
28
|
+
- **Nonimaging design** — CPC-family concentrators (DTIRC, angle transformer,
|
|
29
|
+
RXI) and Miñano–Benítez Simultaneous Multiple Surface profile construction
|
|
30
|
+
(RR / RX / XR / RXI), on a reusable plane-curve toolbox. Surfaces are built from
|
|
31
|
+
optical requirements, not from vertices typed in by hand.
|
|
32
|
+
- **Lenses and aspheres** — labelled singlets, LED collimators (a TIR lens and
|
|
33
|
+
a Fresnel lens) and exact even aspheres as glass edges, with the
|
|
34
|
+
coefficients in Zemax's and Optiland's order. A lens face measured by a
|
|
35
|
+
profilometer is read from its DXF and fitted with its vertex and tilt. The
|
|
36
|
+
fit reports which of its numbers the data do not separately determine, and
|
|
37
|
+
becomes two models of the lens, fitted and as measured.
|
|
38
|
+
- **Light sources and measured LEDs** — a source described once, built in 2D
|
|
39
|
+
and in 3D, and stored with the element it lights in `profile.json`. An LED's
|
|
40
|
+
rayfile (IES TM-25) is read, drawn as a radiation pattern, and sliced into
|
|
41
|
+
the 2D plane, with the share of its light a 2D section cannot carry stated.
|
|
42
|
+
- **Light on a plane** — the irradiance map, and the 2D line profile, of the
|
|
43
|
+
light that leaves an optic.
|
|
44
|
+
- **Radiometry and eye safety** — unit-checked physical quantities, and
|
|
45
|
+
exposure-limit routines for IEC 60825-1 (lasers) and IEC 62471 (lamps and
|
|
46
|
+
LEDs), run as explicit state machines rather than nested conditionals.
|
|
47
|
+
- **An agentic surface** — the whole query layer is exposed as tools a language
|
|
48
|
+
model can call, sharing one live kernel with the human at the notebook.
|
|
49
|
+
Several runs are held at once as named contexts, a saved run is reloaded by
|
|
50
|
+
reference, and a package built on the library adds tools of its own beside
|
|
51
|
+
the core's.
|
|
52
|
+
- **Long runs, off the notebook** — a procedure is a flow: a fixed diagram
|
|
53
|
+
whose every step is recorded, so a run that stops can be read back. Its long
|
|
54
|
+
jobs go to local processes or to Modal's serverless containers, each with an
|
|
55
|
+
estimate of its time and cost before it starts, and a local dashboard shows
|
|
56
|
+
what is running and what it has cost. A targeted re-simulation of the paths
|
|
57
|
+
that matter, cut into chunks, runs this way and gives the run the kernel
|
|
58
|
+
would have given.
|
|
59
|
+
- **Run persistence** — parameter sweeps, stored results, cross-run
|
|
60
|
+
comparison.
|
|
61
|
+
|
|
62
|
+
If you want an interactive simulator with a gallery of worked scenes, the
|
|
63
|
+
upstream [Ray Optics Simulation](https://github.com/ricktu288/ray-optics) is
|
|
64
|
+
better. This is more an analytical tool to understand a design.
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install ray-tracing-shapely
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The core install stays deliberately small — `shapely`, `numpy`, `sympy`,
|
|
73
|
+
`svgwrite`, `networkx`. The heavier layers are extras, so you only pay for
|
|
74
|
+
what you use:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install "ray-tracing-shapely[radiometry]" # unit-checked quantities (pint)
|
|
78
|
+
pip install "ray-tracing-shapely[flows]" # observable step-by-step procedures (transitions)
|
|
79
|
+
pip install "ray-tracing-shapely[eye-safety]" # IEC 60825-1 / IEC 62471
|
|
80
|
+
pip install "ray-tracing-shapely[agentic]" # the MCP tool surface
|
|
81
|
+
pip install "ray-tracing-shapely[modal]" # flows' jobs on Modal (the Modal client)
|
|
82
|
+
pip install "ray-tracing-shapely[notebook]" # running the example notebooks (jupyterlab, papermill)
|
|
83
|
+
pip install "ray-tracing-shapely[all]" # everything
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Python 3.11 or newer.
|
|
87
|
+
|
|
88
|
+
## Thirty seconds
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from ray_tracing_shapely.core.scene import Scene
|
|
92
|
+
from ray_tracing_shapely.core.scene_objs import Glass, SingleRay
|
|
93
|
+
from ray_tracing_shapely.core.simulator import Simulator
|
|
94
|
+
|
|
95
|
+
scene = Scene()
|
|
96
|
+
scene.color_mode = 'linear'
|
|
97
|
+
|
|
98
|
+
prism = Glass(scene)
|
|
99
|
+
prism.path = [
|
|
100
|
+
{'x': 100, 'y': 50, 'arc': False},
|
|
101
|
+
{'x': 200, 'y': 50, 'arc': False},
|
|
102
|
+
{'x': 150, 'y': 150, 'arc': False},
|
|
103
|
+
]
|
|
104
|
+
prism.refIndex = 1.5
|
|
105
|
+
scene.add_object(prism)
|
|
106
|
+
|
|
107
|
+
ray = SingleRay(scene)
|
|
108
|
+
ray.p1 = {'x': 50, 'y': 100}
|
|
109
|
+
ray.p2 = {'x': 100, 'y': 100}
|
|
110
|
+
scene.add_object(ray)
|
|
111
|
+
|
|
112
|
+
segments = Simulator(scene, max_rays=1000).run()
|
|
113
|
+
print(f"Traced {len(segments)} ray segments") # Traced 16 ray segments
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Sixteen segments from one incident ray: it refracts into the glass, reflects
|
|
117
|
+
internally, and splits at each surface it meets. Render the result as SVG with
|
|
118
|
+
`SVGRenderer`, and every element it draws carries the identity of the ray or
|
|
119
|
+
object that produced it, so a diagram can be clicked back to the simulation
|
|
120
|
+
that made it.
|
|
121
|
+
|
|
122
|
+
## Documentation
|
|
123
|
+
|
|
124
|
+
The code is documented in two layers, both shipped with the package:
|
|
125
|
+
|
|
126
|
+
- **`dev_doc/concepts/`** — why the code has the shape it has. Thirty-seven
|
|
127
|
+
numbered concepts, each stating one claim and the evidence for it, written
|
|
128
|
+
for a reader who wants to understand the design rather than just call it.
|
|
129
|
+
- **`dev_doc/architecture/`** — what is true now: a component map, a port
|
|
130
|
+
register, and contracts stating what each boundary assumes and guarantees.
|
|
131
|
+
|
|
132
|
+
Docstrings cite both, so a question that starts in the code has somewhere to
|
|
133
|
+
go.
|
|
134
|
+
|
|
135
|
+
## Citing
|
|
136
|
+
|
|
137
|
+
If you use this software, please cite **both** this project and the Ray Optics
|
|
138
|
+
Simulation project it is in part translated from. `CITATION.cff` carries the
|
|
139
|
+
metadata for both; GitHub will format it for you from the *Cite this
|
|
140
|
+
repository* link.
|
|
141
|
+
|
|
142
|
+
This project: [doi:10.5281/zenodo.23991020](https://doi.org/10.5281/zenodo.23991020)
|
|
143
|
+
— that is the *concept* DOI and always resolves to the latest release. Each
|
|
144
|
+
release also has its own DOI, which is what to cite if you need to pin the
|
|
145
|
+
exact version a result came from.
|
|
146
|
+
|
|
147
|
+
Upstream: [doi:10.5281/zenodo.6386611](https://doi.org/10.5281/zenodo.6386611).
|
|
148
|
+
|
|
149
|
+
## Licence and attribution
|
|
150
|
+
|
|
151
|
+
Apache-2.0. See `LICENSE.txt` and `NOTICE.txt`.
|
|
152
|
+
|
|
153
|
+
<!-- attribution:begin -- generated by dev_doc/tools/attribution.py, do not edit -->
|
|
154
|
+
This project began as a translation of the
|
|
155
|
+
[Ray Optics Simulation](https://github.com/ricktu288/ray-optics) JavaScript project
|
|
156
|
+
(Copyright 2024 its authors and contributors, Apache-2.0,
|
|
157
|
+
[doi:10.5281/zenodo.6386611](https://doi.org/10.5281/zenodo.6386611)), and has grown a
|
|
158
|
+
great deal of new work on top of it.
|
|
159
|
+
|
|
160
|
+
Of this distribution's 220 source files, **35 are translations** of
|
|
161
|
+
that project — the ray-tracing engine and its scene objects — and **185
|
|
162
|
+
were written for this project**: the analysis layer, the nonimaging design
|
|
163
|
+
methods, the radiometric and photobiological layers, the agentic surface,
|
|
164
|
+
and the tests and examples. Every file says which it is in its own header,
|
|
165
|
+
and `NOTICE.txt` lists the translated set.
|
|
166
|
+
|
|
167
|
+
If you use this software please cite both, per `CITATION.cff`.
|
|
168
|
+
<!-- attribution:end -->
|
|
169
|
+
|
|
170
|
+
## Status
|
|
171
|
+
|
|
172
|
+
Early development: the translation of the original
|
|
173
|
+
simulator is not complete, and the API is not yet stable. Issues and
|
|
174
|
+
descriptions of what you are trying to do are the most useful contribution
|
|
175
|
+
right now .
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# >=77 for PEP 639: `license` as an SPDX string rather than a table.
|
|
3
|
+
requires = ["setuptools>=77"]
|
|
4
|
+
build-backend = "setuptools.build_meta"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "ray-tracing-shapely"
|
|
8
|
+
version = "0.3.1"
|
|
9
|
+
description = "Python ray tracing library using Shapely for computational geometry"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
license = "Apache-2.0"
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Michele Benetti", email = "michele@tiberavon.com"},
|
|
15
|
+
{name = "ray-tracing-shapely authors and contributors"},
|
|
16
|
+
]
|
|
17
|
+
keywords = ["ray-tracing", "optics", "simulation", "shapely", "physics"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
dependencies = [
|
|
30
|
+
"shapely>=2.0.0",
|
|
31
|
+
"sympy>=1.12",
|
|
32
|
+
# 1.23.2 is the first release with a CPython 3.11 wheel; anything
|
|
33
|
+
# older would be a source build on the Python floor below.
|
|
34
|
+
"numpy>=1.23.2",
|
|
35
|
+
"svgwrite>=1.4.0",
|
|
36
|
+
# Required for bidirectional ray tracing (Ray Lineage Step C): the combined
|
|
37
|
+
# forward/backward graph is an attributed nx.DiGraph, and path extraction,
|
|
38
|
+
# reachability and topological cross-run comparison run on networkx.
|
|
39
|
+
"networkx>=3.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.optional-dependencies]
|
|
43
|
+
# Each extra names a future satellite. Declaring the boundary
|
|
44
|
+
# here, before it is cut, makes it testable: CI installs bare core and imports
|
|
45
|
+
# every core module, which fails if anything in core reaches into a layer above.
|
|
46
|
+
|
|
47
|
+
# The radiometric layer: PhysicalScene, the projection models, photoconversion,
|
|
48
|
+
# and the unit registry they share. Kept out of core because the core is a
|
|
49
|
+
# geometry hot loop whose coordinates are plain floats (concept KC1).
|
|
50
|
+
radiometry = [
|
|
51
|
+
"pint>=0.24",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
# The observable flow machine (ray_tracing_shapely.flows): a procedure as a
|
|
55
|
+
# fixed diagram, every move an event and a heartbeat.
|
|
56
|
+
#
|
|
57
|
+
# transitions is pinned bare (no [diagrams] extra, which pulls in pygraphviz,
|
|
58
|
+
# a C extension painful to build on Windows) plus the pure-Python graphviz
|
|
59
|
+
# bindings, which shell out to the `dot` executable instead. The `dot` binary
|
|
60
|
+
# is a separate per-machine OS-level install, not pip.
|
|
61
|
+
flows = [
|
|
62
|
+
"transitions>=0.9",
|
|
63
|
+
"graphviz>=0.20",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
# Photobiological safety: both standards, and the observable classification
|
|
67
|
+
# flow over them. Depends on radiometry for its dimensional checks -- see
|
|
68
|
+
# concept KC4; duplicating that check here instead is what C-UNITS-02
|
|
69
|
+
# exists to prevent.
|
|
70
|
+
eye-safety = [
|
|
71
|
+
"ray-tracing-shapely[radiometry,flows]",
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
# The agentic surface. The tools themselves need nothing extra; only the
|
|
75
|
+
# kernel-embedded MCP server does.
|
|
76
|
+
agentic = [
|
|
77
|
+
# mcp 2.x renamed FastMCP (mcp.server.fastmcp -> mcp.server.mcpserver.MCPServer)
|
|
78
|
+
# and changed other APIs; the server is written for 1.x and imports nothing
|
|
79
|
+
# under 2.x. Checked on 1.30.
|
|
80
|
+
"mcp>=1.2,<2",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
# Jobs on Modal (flows.modal_executor): the client is imported only when a
|
|
84
|
+
# ModalExecutor is made, so the rest of flows runs without it. Written and
|
|
85
|
+
# checked against the 1.6 client.
|
|
86
|
+
modal = [
|
|
87
|
+
"ray-tracing-shapely[flows]",
|
|
88
|
+
"modal>=1.6",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
# Running the example and sweep notebooks.
|
|
92
|
+
notebook = [
|
|
93
|
+
"jupyterlab",
|
|
94
|
+
"papermill",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
all = [
|
|
98
|
+
"ray-tracing-shapely[radiometry,flows,eye-safety,agentic,notebook,modal]",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
# What CI installs to run the suite. Deliberately narrower than `dev`:
|
|
102
|
+
# the tests need pint (radiometry) and transitions with graphviz (the
|
|
103
|
+
# classification flows), and no test imports jupyterlab or papermill, which
|
|
104
|
+
# `all` would drag in on every matrix job.
|
|
105
|
+
test = [
|
|
106
|
+
"ray-tracing-shapely[radiometry,flows,eye-safety,agentic]",
|
|
107
|
+
"pytest>=7.0.0",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
dev = [
|
|
111
|
+
"ray-tracing-shapely[all]",
|
|
112
|
+
"pytest>=7.0.0",
|
|
113
|
+
# ruff replaces both black and flake8, and is what CI runs.
|
|
114
|
+
"ruff>=0.6",
|
|
115
|
+
# Installed but deliberately not in CI: 774 of 1759 functions carry a
|
|
116
|
+
# return annotation, so mypy would mostly report absence rather than
|
|
117
|
+
# error. Useful locally on a module you are working on.
|
|
118
|
+
"mypy>=1.0.0",
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
[project.urls]
|
|
122
|
+
Homepage = "https://github.com/tiberavon/ray-tracing-shapely"
|
|
123
|
+
Repository = "https://github.com/tiberavon/ray-tracing-shapely"
|
|
124
|
+
Documentation = "https://github.com/tiberavon/ray-tracing-shapely#readme"
|
|
125
|
+
|
|
126
|
+
[tool.setuptools]
|
|
127
|
+
package-dir = {"" = "."}
|
|
128
|
+
|
|
129
|
+
[tool.setuptools.packages.find]
|
|
130
|
+
where = ["."]
|
|
131
|
+
include = ["ray_tracing_shapely", "ray_tracing_shapely.*"]
|
|
132
|
+
|
|
133
|
+
[tool.ruff]
|
|
134
|
+
line-length = 100
|
|
135
|
+
target-version = "py311"
|
|
136
|
+
|
|
137
|
+
[tool.ruff.lint]
|
|
138
|
+
# `F` is the blocking set: pyflakes finds real defects -- an undefined name,
|
|
139
|
+
# an import that is not there, a variable assigned and never read -- rather
|
|
140
|
+
# than style. It was chosen as the starting point because the full default
|
|
141
|
+
# ruleset reports 1795 findings, and a gate nobody can get through is a gate
|
|
142
|
+
# that gets switched off. Widen a family at a time, each with its own cleanup.
|
|
143
|
+
select = ["F"]
|
|
144
|
+
|
|
145
|
+
[tool.ruff.lint.per-file-ignores]
|
|
146
|
+
# In the developer tests the module-level import list is itself an assertion.
|
|
147
|
+
# `test_imports()` in several files has no body beyond a comment -- *"If we
|
|
148
|
+
# got here, imports succeeded (done at module level)"* -- so a name imported
|
|
149
|
+
# and never otherwise used is the thing being checked. Removing it would
|
|
150
|
+
# leave the test passing while testing less, which is worse than the warning.
|
|
151
|
+
"ray_tracing_shapely/developer_tests/*" = ["F401"]
|
|
152
|
+
|
|
153
|
+
[tool.pytest.ini_options]
|
|
154
|
+
testpaths = ["ray_tracing_shapely/developer_tests"]
|
|
155
|
+
# These tests run two ways: under pytest, and as scripts whose `main()` block
|
|
156
|
+
# collects each function's return value to build a summary table. The returns
|
|
157
|
+
# are what the second route needs, so the warning is about the design working
|
|
158
|
+
# as intended, not a defect. 188 of them would otherwise bury real warnings.
|
|
159
|
+
filterwarnings = [
|
|
160
|
+
"ignore::pytest.PytestReturnNotNoneWarning",
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
[tool.mypy]
|
|
164
|
+
python_version = "3.11"
|
|
165
|
+
warn_return_any = true
|
|
166
|
+
warn_unused_configs = true
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Original work Copyright 2024 The Ray Optics Simulation authors and contributors
|
|
3
|
+
Python translation Copyright 2026 ray-tracing-shapely authors and contributors
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
Ray Tracing Shapely
|
|
18
|
+
===================
|
|
19
|
+
|
|
20
|
+
A Python ray tracing library using Shapely for computational geometry.
|
|
21
|
+
|
|
22
|
+
Main modules:
|
|
23
|
+
- core: Core simulation engine (Scene, Simulator, Ray, optical objects)
|
|
24
|
+
- analysis: Python-specific analysis utilities (geometry analysis)
|
|
25
|
+
- examples: Example simulations and demonstrations
|
|
26
|
+
|
|
27
|
+
Quick start:
|
|
28
|
+
from ray_tracing_shapely.core.scene import Scene
|
|
29
|
+
from ray_tracing_shapely.core.scene_objs import Glass, SingleRay
|
|
30
|
+
from ray_tracing_shapely.core.simulator import Simulator
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
__version__ = "0.3.1"
|
|
34
|
+
|
|
35
|
+
# Convenience imports for common usage
|
|
36
|
+
from .core.scene import Scene
|
|
37
|
+
from .core.simulator import Simulator
|
|
38
|
+
from .core.ray import Ray
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
'Scene',
|
|
42
|
+
'Simulator',
|
|
43
|
+
'Ray',
|
|
44
|
+
'__version__',
|
|
45
|
+
]
|