obdeect 0.7.0__tar.gz → 0.7.2__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 (103) hide show
  1. obdeect-0.7.2/.github/workflows/changelog.yml +32 -0
  2. {obdeect-0.7.0 → obdeect-0.7.2}/.github/workflows/ci.yml +1 -1
  3. {obdeect-0.7.0 → obdeect-0.7.2}/.github/workflows/docs.yml +5 -2
  4. {obdeect-0.7.0 → obdeect-0.7.2}/.github/workflows/pypi.yml +11 -1
  5. {obdeect-0.7.0 → obdeect-0.7.2}/.github/workflows/tests.yml +7 -3
  6. {obdeect-0.7.0 → obdeect-0.7.2}/AGENTS.md +2 -3
  7. {obdeect-0.7.0 → obdeect-0.7.2}/CHANGELOG.md +61 -7
  8. {obdeect-0.7.0 → obdeect-0.7.2}/PKG-INFO +4 -1
  9. {obdeect-0.7.0 → obdeect-0.7.2}/README.md +2 -0
  10. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/bindings/core.cpp +7 -5
  11. {obdeect-0.7.0 → obdeect-0.7.2}/docs/build_versions.py +14 -6
  12. {obdeect-0.7.0 → obdeect-0.7.2}/docs/optical-models.md +5 -6
  13. {obdeect-0.7.0 → obdeect-0.7.2}/pyproject.toml +6 -0
  14. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/cli.py +2 -0
  15. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/compiler.py +8 -15
  16. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_axes_offset.py +29 -3
  17. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_docs_versions.py +15 -0
  18. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_model.py +8 -1
  19. obdeect-0.7.0/docs/changes/27.feature.md +0 -1
  20. obdeect-0.7.0/docs/changes/28.maintenance.md +0 -1
  21. {obdeect-0.7.0 → obdeect-0.7.2}/.clang-format +0 -0
  22. {obdeect-0.7.0 → obdeect-0.7.2}/.clang-tidy +0 -0
  23. {obdeect-0.7.0 → obdeect-0.7.2}/.editorconfig +0 -0
  24. {obdeect-0.7.0 → obdeect-0.7.2}/.gitattributes +0 -0
  25. {obdeect-0.7.0 → obdeect-0.7.2}/.gitignore +0 -0
  26. {obdeect-0.7.0 → obdeect-0.7.2}/.pre-commit-config.yaml +0 -0
  27. {obdeect-0.7.0 → obdeect-0.7.2}/CITATION.cff +0 -0
  28. {obdeect-0.7.0 → obdeect-0.7.2}/CMakeLists.txt +0 -0
  29. {obdeect-0.7.0 → obdeect-0.7.2}/CMakePresets.json +0 -0
  30. {obdeect-0.7.0 → obdeect-0.7.2}/LICENSE +0 -0
  31. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/bench/bench_trace.cpp +0 -0
  32. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/bench/replay.cpp +0 -0
  33. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/bench/replay_compare.hpp +0 -0
  34. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/bindings/README.md +0 -0
  35. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/bounds.hpp +0 -0
  36. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/bunches.hpp +0 -0
  37. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/json.hpp +0 -0
  38. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/model.hpp +0 -0
  39. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/model_json.hpp +0 -0
  40. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/obscurers.hpp +0 -0
  41. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/random.hpp +0 -0
  42. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/source.hpp +0 -0
  43. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/surfaces.hpp +0 -0
  44. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/table.hpp +0 -0
  45. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/trace.hpp +0 -0
  46. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/include/obdeect/vec.hpp +0 -0
  47. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/check.hpp +0 -0
  48. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/data/make_polynomial_reference.py +0 -0
  49. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/legacy_asphere.hpp +0 -0
  50. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/test_asphere_steps.cpp +0 -0
  51. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/test_bounds.cpp +0 -0
  52. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/test_kernels.cpp +0 -0
  53. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/test_model_json.cpp +0 -0
  54. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/test_replay_compare.cpp +0 -0
  55. {obdeect-0.7.0 → obdeect-0.7.2}/cpp/tests/test_trace.cpp +0 -0
  56. {obdeect-0.7.0 → obdeect-0.7.2}/docs/VALIDATION.md +0 -0
  57. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/baffle_area.png +0 -0
  58. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/mst_shadowing.png +0 -0
  59. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/telescope_lst.png +0 -0
  60. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/telescope_mst_flashcam.png +0 -0
  61. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/telescope_mst_nectarcam.png +0 -0
  62. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/telescope_sct.png +0 -0
  63. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/telescope_sst.png +0 -0
  64. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/telescopes-provenance.json +0 -0
  65. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/figures/validation_psf_area.png +0 -0
  66. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/images/obdeect_21ratio_large.jpg +0 -0
  67. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/images/obdeect_21ratio_small.jpg +0 -0
  68. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/images/obdeect_large.jpg +0 -0
  69. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/images/obdeect_logo.jpg +0 -0
  70. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/images/obdeect_small.jpg +0 -0
  71. {obdeect-0.7.0 → obdeect-0.7.2}/docs/_static/obdeect.css +0 -0
  72. {obdeect-0.7.0 → obdeect-0.7.2}/docs/air-shower-photons.md +0 -0
  73. {obdeect-0.7.0 → obdeect-0.7.2}/docs/api.md +0 -0
  74. {obdeect-0.7.0 → obdeect-0.7.2}/docs/batch-tracing.md +0 -0
  75. {obdeect-0.7.0 → obdeect-0.7.2}/docs/changelog.md +0 -0
  76. {obdeect-0.7.0 → obdeect-0.7.2}/docs/changes/.gitkeep +0 -0
  77. {obdeect-0.7.0 → obdeect-0.7.2}/docs/conf.py +0 -0
  78. {obdeect-0.7.0 → obdeect-0.7.2}/docs/figures/make_figures.py +0 -0
  79. {obdeect-0.7.0 → obdeect-0.7.2}/docs/figures/telescopes.yml +0 -0
  80. {obdeect-0.7.0 → obdeect-0.7.2}/docs/index.md +0 -0
  81. {obdeect-0.7.0 → obdeect-0.7.2}/docs/installation.md +0 -0
  82. {obdeect-0.7.0 → obdeect-0.7.2}/docs/light-sources.md +0 -0
  83. {obdeect-0.7.0 → obdeect-0.7.2}/docs/limitations.md +0 -0
  84. {obdeect-0.7.0 → obdeect-0.7.2}/docs/optical-elements.md +0 -0
  85. {obdeect-0.7.0 → obdeect-0.7.2}/docs/optics.md +0 -0
  86. {obdeect-0.7.0 → obdeect-0.7.2}/docs/python-guide.md +0 -0
  87. {obdeect-0.7.0 → obdeect-0.7.2}/docs/shadowing.md +0 -0
  88. {obdeect-0.7.0 → obdeect-0.7.2}/docs/telescopes.md +0 -0
  89. {obdeect-0.7.0 → obdeect-0.7.2}/docs/usage.md +0 -0
  90. {obdeect-0.7.0 → obdeect-0.7.2}/docs/user-guide.md +0 -0
  91. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/__init__.py +0 -0
  92. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/formats.py +0 -0
  93. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/model.py +0 -0
  94. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/plot.py +0 -0
  95. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/propagation.py +0 -0
  96. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/psf.py +0 -0
  97. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/repository.py +0 -0
  98. {obdeect-0.7.0 → obdeect-0.7.2}/python/obdeect/simtel_tables.py +0 -0
  99. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/telescopes.py +0 -0
  100. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_bunches.py +0 -0
  101. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_compiler.py +0 -0
  102. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_formats.py +0 -0
  103. {obdeect-0.7.0 → obdeect-0.7.2}/python/tests/test_propagation.py +0 -0
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: Changelog
3
+ # Require a changelog entry for each pull request
4
+ # from: https://github.com/cta-observatory/ctapipe/blob/main/.github/workflows/changelog.yml
5
+
6
+ on:
7
+ pull_request:
8
+ types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review]
9
+ branches:
10
+ - 'main'
11
+
12
+ env:
13
+ FRAGMENT_NAME_PREFIX: "docs/changes/${{ github.event.number }}"
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ changelog:
20
+ runs-on: ubuntu-slim
21
+ if: >-
22
+ github.event.pull_request.draft == false &&
23
+ !contains(github.event.pull_request.labels.*.name, 'no-changelog-needed') &&
24
+ !contains(github.event.pull_request.labels.*.name, 'dependencies')
25
+ steps:
26
+ - name: Checkout code
27
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
28
+
29
+ - name: Check for at least one changelog fragment
30
+ run: |
31
+ find docs/changes -type f | \
32
+ grep -E "^${FRAGMENT_NAME_PREFIX}\.(feature|bugfix|maintenance)\.md$"
@@ -13,7 +13,7 @@ concurrency:
13
13
 
14
14
  jobs:
15
15
  lint:
16
- runs-on: ubuntu-24.04
16
+ runs-on: ubuntu-slim
17
17
  steps:
18
18
  - uses: actions/checkout@v7
19
19
  with:
@@ -17,7 +17,7 @@ concurrency:
17
17
 
18
18
  jobs:
19
19
  build:
20
- runs-on: ubuntu-24.04
20
+ runs-on: ubuntu-slim
21
21
  permissions:
22
22
  contents: read
23
23
  steps:
@@ -41,6 +41,9 @@ jobs:
41
41
  if [[ "$GITHUB_REF" == refs/tags/* ]]; then
42
42
  args+=(--dev-ref origin/main)
43
43
  fi
44
+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
45
+ args+=(--dev-only)
46
+ fi
44
47
  python docs/build_versions.py "${args[@]}"
45
48
  - uses: actions/upload-pages-artifact@v5
46
49
  with:
@@ -49,7 +52,7 @@ jobs:
49
52
  deploy:
50
53
  if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
51
54
  needs: build
52
- runs-on: ubuntu-24.04
55
+ runs-on: ubuntu-slim
53
56
  permissions:
54
57
  pages: write
55
58
  id-token: write
@@ -3,6 +3,12 @@ name: Build and publish obdeect
3
3
 
4
4
  on:
5
5
  pull_request:
6
+ paths:
7
+ - "cpp/**"
8
+ - "python/**"
9
+ - "CMakeLists.txt"
10
+ - "pyproject.toml"
11
+ - ".github/workflows/pypi.yml"
6
12
  push:
7
13
  tags:
8
14
  - "v*"
@@ -14,6 +20,10 @@ on:
14
20
  type: boolean
15
21
  default: false
16
22
 
23
+ concurrency:
24
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
26
+
17
27
  permissions:
18
28
  contents: read
19
29
 
@@ -35,7 +45,7 @@ jobs:
35
45
  run: python -m pip install --upgrade cibuildwheel
36
46
  - name: Build and smoke-test wheels
37
47
  env:
38
- CIBW_BUILD: "cp314-*"
48
+ CIBW_BUILD: "cp314-* cp315-*"
39
49
  CIBW_TEST_REQUIRES: "pytest matplotlib"
40
50
  CIBW_TEST_COMMAND: python -m pytest {project}/python/tests -q
41
51
  run: python -m cibuildwheel --output-dir wheelhouse
@@ -19,17 +19,21 @@ jobs:
19
19
  strategy:
20
20
  fail-fast: false
21
21
  matrix:
22
- runner: [ubuntu-24.04, macos-15]
22
+ runner: [ubuntu-24.04, ubuntu-24.04-arm, macos-15]
23
+ python-version: ['3.14', '3.15']
23
24
  runs-on: ${{ matrix.runner }}
24
25
  steps:
25
26
  - uses: actions/checkout@v7
26
27
  - uses: actions/setup-python@v7
27
28
  with:
28
- python-version: '3.14'
29
+ python-version: ${{ matrix.python-version }}
30
+ allow-prereleases: true
29
31
  - name: Install Python package and test dependencies
30
32
  run: python -m pip install --upgrade pip && python -m pip install ".[plot]" pytest
31
33
  - name: Configure and build
32
- run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build --parallel
34
+ run: >-
35
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
36
+ && cmake --build build --parallel
33
37
  - name: Run native and Python tests
34
38
  run: ctest --test-dir build --output-on-failure && pytest python/tests
35
39
  fma:
@@ -51,9 +51,8 @@ scope. Read the relevant code and tests first; use `docs/VALIDATION.md` and
51
51
  ## Changes and validation
52
52
 
53
53
  - Make the narrowest complete change and preserve unrelated work.
54
- - Do not add anything under `docs/changes/` for current work. Leave that
55
- directory untouched unless the user explicitly asks for a changelog or
56
- release-note change.
54
+ - Add an appropriate Towncrier fragment under `docs/changes/` for changes
55
+ that should appear in the release notes.
57
56
  - Add or update a focused test for every behavioural change. Establish analytic
58
57
  kernel and primitive tests before optical-model, cross-tool, or performance tests.
59
58
  - Preserve results across photon ordering, blocks, and thread counts. Record
@@ -3,14 +3,68 @@
3
3
  This project follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
4
4
  and uses semantic versioning after the first stable release.
5
5
 
6
- ## [0.6.0]
6
+ <!-- towncrier release notes start -->
7
+
8
+ ## [v0.7.2] - 2026-11-06
9
+
10
+ ### Added
11
+
12
+ - Expanded the agent guide (`AGENTS.md`) with the repository layout, CI-equivalent sanitizer and FMA build commands, pre-commit coverage, and corrected paths and references. (#27)
13
+ - Add a --version to the obdeect executable. (#32)
14
+
15
+ ### Fixed
16
+
17
+ - Accept two components for axes offsets (as expected by the simulation models). (#31)
18
+ - Include the Python headers before the standard library in the bindings, fixing source builds with Python 3.15 that failed on `_POSIX_C_SOURCE` redefinition warnings. Wheels are now also built for Python 3.15. (#33)
19
+
20
+ ### Maintenance
21
+
22
+ - Reduce external python dependencies. (#28)
23
+ - Pull-request documentation builds only build the dev pages; releases are rebuilt on `main` and tags. Changelog fragments of type `maintenance` are now accepted. (#33)
24
+
25
+
26
+ ## [v0.7.1] - 2026-11-04
27
+
28
+ Bug fix release.
29
+
30
+ ### Fixed
31
+
32
+ - Support both components of the `axes_offsets` telescope parameter. The compiled optical model
33
+ now includes the transverse offset, allowing models such as SSTS design v2.0.0 to run with
34
+ obdeect. (#31)
35
+
36
+ ## [v0.7.0] - 2026-11-04
37
+
38
+ Trace air-shower Cherenkov photons and pass them on to `sim_telarray` using the
39
+ `bypass_optics` mode.
40
+
41
+ ### Added
42
+
43
+ - Air-shower photon bunches: `trace_bunches` takes `wavelength_law=(lo_nm, hi_nm)`, an exact
44
+ 1/λ² wavelength law with sim_telarray-style truncation to integer nm. It also takes
45
+ `normalise_transmission`. Thinning sizes the output from the photons that survive.
46
+ - Telescope axes offsets are compiled into the optical model and applied when tracing. Input
47
+ planes below an incoming obscurer are rejected, and `max_incoming_obscurer_z_m()` reports the
48
+ obscurer height.
49
+ - New documentation: an air-shower photons guide, batch-tracing updates, and validation results
50
+ in `docs/VALIDATION.md`.
51
+
52
+ ### Changed
53
+
54
+ - Matplotlib is no longer a core dependency. Install `obdeect[plot]` for plotting; `obdeect plot`
55
+ without it fails with a message saying so.
56
+ - Reduced external Python dependencies. `scipy` is no longer a dev dependency, and `astropy` is
57
+ only needed for regenerating figures (`obdeect[figures]`).
58
+ - CI runs the Python lint through pre-commit, and the test job installs `.[plot]`.
59
+
60
+ ## [v0.6.0]
7
61
 
8
62
  ### Changed
9
63
 
10
64
  - The PyPI distribution is named `obdeect`. Install with `pip install obdeect`.
11
65
  The repository is hosted in the `gammasim` organisation.
12
66
 
13
- ## [0.5.0]
67
+ ## [v0.5.0]
14
68
 
15
69
  Maintenance release: CI workflows and changelog. No change to the code or the Python API.
16
70
 
@@ -21,7 +75,7 @@ Maintenance release: CI workflows and changelog. No change to the code or the Py
21
75
  match the expected hash now fails the workflow.
22
76
  - The changelog is rebuilt from the git history for all releases from 0.1.0 on.
23
77
 
24
- ## [0.4.0]
78
+ ## [v0.4.0]
25
79
 
26
80
  Performance release for the optical ray tracer, with additions to the Python API and the
27
81
  command line. The optical-model format is unchanged (`obdeect.optical-model.v2`).
@@ -65,7 +119,7 @@ command line. The optical-model format is unchanged (`obdeect.optical-model.v2`)
65
119
  - A failure while starting the thread pool no longer leaves joinable threads behind; an
66
120
  exception in a task is rethrown to the caller and the remaining chunks are skipped.
67
121
 
68
- ## [0.3.0]
122
+ ## [v0.3.0]
69
123
 
70
124
  Phase 2: calibration light.
71
125
 
@@ -83,13 +137,13 @@ Phase 2: calibration light.
83
137
  - Segment footprint frames are computed once per optical model. Results are bit-identical; SST
84
138
  tracing is about 1.7 times faster.
85
139
 
86
- ## [0.2.1]
140
+ ## [v0.2.1]
87
141
 
88
142
  ### Added
89
143
 
90
144
  - Linux arm64 wheels.
91
145
 
92
- ## [0.2.0]
146
+ ## [v0.2.0]
93
147
 
94
148
  Phase 1: optical models for in-process use by simtools, with sim_telarray equivalence.
95
149
 
@@ -111,7 +165,7 @@ Phase 1: optical models for in-process use by simtools, with sim_telarray equiva
111
165
  - Optical input validation and deterministic boundary selection.
112
166
  - GCC header portability and the macOS wheel deployment target.
113
167
 
114
- ## [0.1.0]
168
+ ## [v0.1.0]
115
169
 
116
170
  First version: a C++20 ray tracer with a Python package.
117
171
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: obdeect
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Ray tracing for imaging atmospheric Cherenkov telescopes
5
5
  Author: obdeect contributors
6
6
  License: BSD 3-Clause License
@@ -38,6 +38,7 @@ Classifier: License :: OSI Approved :: BSD License
38
38
  Classifier: Programming Language :: C++
39
39
  Classifier: Programming Language :: Python :: 3 :: Only
40
40
  Classifier: Programming Language :: Python :: 3.14
41
+ Classifier: Programming Language :: Python :: 3.15
41
42
  Requires-Python: >=3.14
42
43
  Requires-Dist: numpy>=2.3
43
44
  Provides-Extra: dev
@@ -64,6 +65,8 @@ Description-Content-Type: text/markdown
64
65
  <img src="docs/_static/images/obdeect_21ratio_small.jpg" alt="Obdeect optical ray tracing for imaging atmospheric Cherenkov telescopes" width="800">
65
66
  </p>
66
67
 
68
+ [![DOI](https://zenodo.org/badge/1376945125.svg)](https://doi.org/10.5281/zenodo.23942573)
69
+
67
70
  `obdeect` is a C++20 optical ray tracer for imaging atmospheric Cherenkov
68
71
  telescopes. The C++ core uses only the standard library. Python compiles
69
72
  optical models from the simulation models, traces photons, and plots results;
@@ -4,6 +4,8 @@
4
4
  <img src="docs/_static/images/obdeect_21ratio_small.jpg" alt="Obdeect optical ray tracing for imaging atmospheric Cherenkov telescopes" width="800">
5
5
  </p>
6
6
 
7
+ [![DOI](https://zenodo.org/badge/1376945125.svg)](https://doi.org/10.5281/zenodo.23942573)
8
+
7
9
  `obdeect` is a C++20 optical ray tracer for imaging atmospheric Cherenkov
8
10
  telescopes. The C++ core uses only the standard library. Python compiles
9
11
  optical models from the simulation models, traces photons, and plots results;
@@ -1,8 +1,5 @@
1
- #include "obdeect/bunches.hpp"
2
- #include "obdeect/model_json.hpp"
3
- #include "obdeect/source.hpp"
4
- #include "obdeect/trace.hpp"
5
-
1
+ // Python.h must precede all standard headers (it sets feature-test macros such as
2
+ // _POSIX_C_SOURCE), so the nanobind headers come first.
6
3
  #include <nanobind/nanobind.h>
7
4
  #include <nanobind/ndarray.h>
8
5
  #include <nanobind/stl/optional.h>
@@ -10,6 +7,11 @@
10
7
  #include <nanobind/stl/tuple.h>
11
8
  #include <nanobind/stl/vector.h>
12
9
 
10
+ #include "obdeect/bunches.hpp"
11
+ #include "obdeect/model_json.hpp"
12
+ #include "obdeect/source.hpp"
13
+ #include "obdeect/trace.hpp"
14
+
13
15
  #include <algorithm>
14
16
  #include <iterator>
15
17
  #include <memory>
@@ -96,13 +96,18 @@ def build_docs(source, destination, base_url, version, package_path=None):
96
96
  )
97
97
 
98
98
 
99
- def build_site(site, base_url, dev_ref=None):
100
- """Rebuild releases from git, never from copies of the development pages."""
99
+ def build_site(site, base_url, dev_ref=None, dev_only=False):
100
+ """Rebuild releases from git, never from copies of the development pages.
101
+
102
+ With dev_only, release tags are skipped (a quick check of the development pages).
103
+ """
101
104
  if site.exists():
102
105
  raise FileExistsError(f"Use a fresh output directory: {site}")
103
- tags = release_tags(
104
- subprocess.check_output(["git", "tag", "--list"], cwd=ROOT, text=True).splitlines()
105
- )
106
+ tags = []
107
+ if not dev_only:
108
+ tags = release_tags(
109
+ subprocess.check_output(["git", "tag", "--list"], cwd=ROOT, text=True).splitlines()
110
+ )
106
111
  published = []
107
112
  with tempfile.TemporaryDirectory(prefix="obdeect-docs-") as directory:
108
113
  work = Path(directory)
@@ -161,5 +166,8 @@ if __name__ == "__main__":
161
166
  parser.add_argument("--output", type=Path, required=True)
162
167
  parser.add_argument("--base-url", required=True)
163
168
  parser.add_argument("--dev-ref", help="Git ref for dev pages (default: working tree)")
169
+ parser.add_argument(
170
+ "--dev-only", action="store_true", help="Build only the dev pages, skipping release tags"
171
+ )
164
172
  args = parser.parse_args()
165
- build_site(args.output.resolve(), args.base_url, args.dev_ref)
173
+ build_site(args.output.resolve(), args.base_url, args.dev_ref, args.dev_only)
@@ -31,15 +31,14 @@ path of the first error. Surface and obscurer ids are unique.
31
31
 
32
32
  Some telescopes have the optical origin displaced from the rotation axes. The
33
33
  sim_telarray `axes_offsets` record gives the horizontal offset between the
34
- azimuth and altitude axes, in the record's units (cm in sim_telarray). The
35
- first component is that offset; a non-zero second component (displacement
36
- perpendicular to the optical axis) is rejected at compile time.
34
+ azimuth and altitude axes, followed by the altitude-to-optical-axis offset,
35
+ in the record's units (cm in sim_telarray).
37
36
 
38
37
  The compiler stores the offset in the telescope frame, in metres, as
39
38
  `optics.axes_offset_m` = [x, y, z]. The key is written only when the offset is
40
- non-zero, and it needs the zenith angle of the compilation. The offset is
41
- `(O cos(theta), 0, O sin(theta))` for an along-axis offset `O` at zenith
42
- `theta`. The loader requires three numbers.
39
+ non-zero, and it needs the zenith angle of the compilation. For components
40
+ `(O, T)` and zenith `theta`, the offset is
41
+ `(O cos(theta) - T, 0, O sin(theta))`. The loader requires three numbers.
43
42
 
44
43
  The offset is applied only by `trace_bunches`, which subtracts it from its frame
45
44
  offset (see [Batch tracing](batch-tracing.md)). `trace`, `star_photons` and the
@@ -15,6 +15,7 @@ classifiers = [
15
15
  "Programming Language :: C++",
16
16
  "Programming Language :: Python :: 3 :: Only",
17
17
  "Programming Language :: Python :: 3.14",
18
+ "Programming Language :: Python :: 3.15",
18
19
  ]
19
20
  dynamic = [ "version" ]
20
21
  dependencies = [
@@ -50,17 +51,22 @@ line-length = 100
50
51
  preview = true
51
52
  lint.select = [ "E", "F", "I", "UP" ]
52
53
 
54
+ [tool.pyproject-fmt]
55
+ max_supported_python = "3.15"
56
+
53
57
  [tool.towncrier]
54
58
  package = "obdeect"
55
59
  package_dir = "python"
56
60
  directory = "docs/changes"
57
61
  filename = "CHANGELOG.md"
62
+ start_string = "<!-- towncrier release notes start -->\n"
58
63
  title_format = "## [{version}] - {project_date}"
59
64
  issue_format = "#{issue}"
60
65
  underlines = [ "", "", "" ]
61
66
  type = [
62
67
  { directory = "feature", name = "Added", showcontent = true },
63
68
  { directory = "bugfix", name = "Fixed", showcontent = true },
69
+ { directory = "maintenance", name = "Maintenance", showcontent = true },
64
70
  ]
65
71
 
66
72
  [[tool.dynamic-metadata]]
@@ -10,6 +10,7 @@ from pathlib import Path
10
10
 
11
11
  import numpy as np
12
12
 
13
+ from obdeect import __version__
13
14
  from obdeect.formats import ModelError
14
15
  from obdeect.model import STATUS_NAMES, OpticalModel
15
16
  from obdeect.psf import summary
@@ -129,6 +130,7 @@ def _source_arguments(command: argparse.ArgumentParser) -> None:
129
130
 
130
131
  def main(argv: list[str] | None = None) -> int:
131
132
  parser = argparse.ArgumentParser(prog="obdeect", description=__doc__)
133
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
132
134
  commands = parser.add_subparsers(dest="command", required=True)
133
135
 
134
136
  c = commands.add_parser("compile", help="compile an optical model from simulation-models")
@@ -170,13 +170,11 @@ def compile_model(
170
170
  def _axes_offset_m(p: _Parameters, zenith_deg: float | None) -> list[float]:
171
171
  """Offset of the optical origin from the telescope sphere centre, telescope frame [m].
172
172
 
173
- The ``axes_offsets`` record (sim_telarray ``axes_offset``, cm) holds the horizontal offset
174
- of the altitude axis from the azimuth axis, measured along x of the azimuth-rotated frame,
175
- and the displacement perpendicular to the optical axis, which must be zero. A photon at
176
- ground point P is then at R (P - O) in the telescope frame, where R maps the ground frame to
177
- the telescope frame. R O does not depend on the azimuth, so the offset is stored in the
178
- telescope frame at the compiled zenith angle: (O cos(theta), 0, O sin(theta)). Zero when the
179
- record is absent or zero; a non-zero offset needs the zenith angle.
173
+ The ``axes_offsets`` record (sim_telarray ``axes_offset``) holds the horizontal offset
174
+ between the azimuth and altitude axes followed by the altitude-to-optical-axis offset.
175
+ The first component transforms to (along*cos(theta), 0, along*sin(theta)); the second is
176
+ subtracted along telescope-frame x. Zero when the record is absent or zero; a non-zero
177
+ offset needs the zenith angle.
180
178
  """
181
179
  if "axes_offsets" not in p:
182
180
  return [0.0, 0.0, 0.0]
@@ -184,22 +182,17 @@ def _axes_offset_m(p: _Parameters, zenith_deg: float | None) -> list[float]:
184
182
  if len(values) > 2:
185
183
  raise ModelError("axes_offsets has more than two components")
186
184
  along = number(values[0], "axes_offsets") * length_unit_m(units[0], "axes_offsets")
187
- perpendicular = (
185
+ transverse = (
188
186
  number(values[1], "axes_offsets") * length_unit_m(units[1], "axes_offsets")
189
187
  if len(values) == 2
190
188
  else 0.0
191
189
  )
192
- if perpendicular != 0.0:
193
- raise NotImplementedError(
194
- "a non-zero second axes_offsets component (displacement perpendicular to the optical "
195
- "axis) is not supported"
196
- )
197
- if along == 0.0:
190
+ if along == 0.0 and transverse == 0.0:
198
191
  return [0.0, 0.0, 0.0]
199
192
  if zenith_deg is None:
200
193
  raise ModelError("axes_offsets needs the telescope zenith angle")
201
194
  theta = math.radians(zenith_deg)
202
- return [along * math.cos(theta), 0.0, along * math.sin(theta)]
195
+ return [along * math.cos(theta) - transverse, 0.0, along * math.sin(theta)]
203
196
 
204
197
 
205
198
  def _sampling(p: _Parameters, optics: dict[str, Any]) -> dict[str, float]:
@@ -116,9 +116,35 @@ def test_axes_offset_follows_the_zenith_angle():
116
116
  assert model.axes_offset_m == pytest.approx((1.6, 0.0, 0.0))
117
117
 
118
118
 
119
- def test_non_zero_perpendicular_component_is_not_supported():
120
- with pytest.raises(NotImplementedError, match="perpendicular"):
121
- compiled([OFFSET_CM, 10.0])
119
+ def test_second_axes_offset_component_is_transverse_to_the_optical_axis():
120
+ model = compiled([OFFSET_CM, 10.0])
121
+ assert model.axes_offset_m == pytest.approx((
122
+ OFFSET_CM / 100 * COS - 0.1,
123
+ 0.0,
124
+ OFFSET_CM / 100 * SIN,
125
+ ))
126
+
127
+
128
+ def test_equal_offsets_align_optical_and_azimuth_axes_at_zenith():
129
+ model = compiled([OFFSET_CM, OFFSET_CM], zenith_deg=0.0)
130
+ assert model.axes_offset_m == pytest.approx(ORIGIN)
131
+
132
+
133
+ def test_transverse_offset_matches_explicit_frame_transform(reference):
134
+ model = compiled([OFFSET_CM, 10.0])
135
+ bunches = ground_bunches(3000)
136
+ # sim_telarray translates by -O before rotation and +T in telescope x.
137
+ frame_offset = -ROTATION @ GROUND_OFFSET_M + np.array([0.1, 0.0, 0.0])
138
+ expected = trace_ground(reference, bunches, 30.0, offset_m=frame_offset)
139
+ actual = trace_ground(model, bunches, 30.0)
140
+ assert len(actual["weight"]) > 0
141
+ for name in ("bunch_index", "position_m", "direction", "time_ns", "weight"):
142
+ np.testing.assert_allclose(actual[name], expected[name], atol=1e-9)
143
+
144
+
145
+ def test_second_axes_offset_component_needs_the_zenith_angle():
146
+ with pytest.raises(ModelError, match="zenith"):
147
+ compiled([0.0, 10.0], zenith_deg=None)
122
148
 
123
149
 
124
150
  def test_axes_offset_needs_the_zenith_angle():
@@ -1,6 +1,7 @@
1
1
  """Version selection and publishing layout for the documentation site."""
2
2
 
3
3
  import importlib.util
4
+ import json
4
5
  import runpy
5
6
  import sys
6
7
  from pathlib import Path
@@ -73,6 +74,20 @@ def test_refuse_to_publish_into_an_existing_directory(tmp_path):
73
74
  versions.publish_dev(tmp_path / "build", tmp_path)
74
75
 
75
76
 
77
+ def test_dev_only_build_skips_release_tags(tmp_path, monkeypatch):
78
+ built = []
79
+ monkeypatch.setattr(
80
+ versions.subprocess, "check_output", lambda *a, **k: pytest.fail("tags were listed")
81
+ )
82
+ monkeypatch.setattr(versions, "build_docs", lambda *a, **k: built.append(a[3]))
83
+ monkeypatch.setattr(versions, "publish_dev", lambda build, site: site.mkdir())
84
+ versions.build_site(tmp_path / "site", "https://example.org/project", dev_only=True)
85
+ assert built == ["dev"]
86
+ entries = json.loads((tmp_path / "site" / "switcher.json").read_text())
87
+ assert [entry["version"] for entry in entries] == ["dev"]
88
+ assert not (tmp_path / "site" / "stable").exists()
89
+
90
+
76
91
  def test_docs_authors_come_from_citation(monkeypatch):
77
92
  root = SCRIPT.parents[1]
78
93
  authors = [
@@ -7,7 +7,7 @@ import sys
7
7
 
8
8
  import numpy as np
9
9
  import pytest
10
- from obdeect import ModelError, OpticalModel, ThreadPool, trace_many
10
+ from obdeect import ModelError, OpticalModel, ThreadPool, __version__, trace_many
11
11
  from obdeect.cli import main
12
12
  from obdeect.compiler import model_hash
13
13
  from obdeect.model import DETECTED, STATUS_NAMES
@@ -16,6 +16,13 @@ from obdeect.repository import read_telescope
16
16
  from telescopes import STRUCTURE, dual, record, segmented, write_simulation_models
17
17
 
18
18
 
19
+ def test_cli_version(capsys):
20
+ with pytest.raises(SystemExit) as error:
21
+ main(["--version"])
22
+ assert error.value.code == 0
23
+ assert capsys.readouterr().out.strip() == f"obdeect {__version__}"
24
+
25
+
19
26
  def model_of(records_files, **options):
20
27
  records, files = records_files
21
28
  return OpticalModel.from_records(
@@ -1 +0,0 @@
1
- Expanded the agent guide (`AGENTS.md`) with the repository layout, CI-equivalent sanitizer and FMA build commands, pre-commit coverage, and corrected paths and references.
@@ -1 +0,0 @@
1
- Reduce external python dependencies.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes