astribidem 0.0.0a0__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.
- astribidem-0.0.0a0/.github/workflows/build.yml +39 -0
- astribidem-0.0.0a0/.github/workflows/ci.yml +33 -0
- astribidem-0.0.0a0/.github/workflows/pre-commit.yml +24 -0
- astribidem-0.0.0a0/.github/workflows/release.yml +34 -0
- astribidem-0.0.0a0/.github/workflows/test.yml +53 -0
- astribidem-0.0.0a0/.gitignore +12 -0
- astribidem-0.0.0a0/.pre-commit-config.yaml +16 -0
- astribidem-0.0.0a0/CHANGELOG.md +26 -0
- astribidem-0.0.0a0/LICENSE +21 -0
- astribidem-0.0.0a0/PKG-INFO +121 -0
- astribidem-0.0.0a0/README.md +81 -0
- astribidem-0.0.0a0/benchmarks/README.md +121 -0
- astribidem-0.0.0a0/benchmarks/benchmark_spatial.py +174 -0
- astribidem-0.0.0a0/benchmarks/benchmark_uid_acero.py +446 -0
- astribidem-0.0.0a0/benchmarks/benchmark_uids.py +205 -0
- astribidem-0.0.0a0/benchmarks/results/spatial-20k.json +158 -0
- astribidem-0.0.0a0/benchmarks/results/uid-acero-2m.json +672 -0
- astribidem-0.0.0a0/benchmarks/results/uid-acero-500k.json +1320 -0
- astribidem-0.0.0a0/benchmarks/results/uid-acero-arrow15-checks.json +14 -0
- astribidem-0.0.0a0/benchmarks/results/uid-canonical-options.json +1092 -0
- astribidem-0.0.0a0/benchmarks/results/uid-index-in.json +461 -0
- astribidem-0.0.0a0/benchmarks/results/uid-native.json +279 -0
- astribidem-0.0.0a0/benchmarks/results/uid-python-baseline.json +279 -0
- astribidem-0.0.0a0/benchmarks/spatial.md +57 -0
- astribidem-0.0.0a0/docs/README.md +23 -0
- astribidem-0.0.0a0/docs/api-and-compatibility.md +104 -0
- astribidem-0.0.0a0/docs/candidate-edges.md +212 -0
- astribidem-0.0.0a0/docs/hub-and-spoke-matching.md +107 -0
- astribidem-0.0.0a0/docs/matching-guide.md +110 -0
- astribidem-0.0.0a0/docs/releasing.md +80 -0
- astribidem-0.0.0a0/docs/uid-matching.md +59 -0
- astribidem-0.0.0a0/notes/README.md +25 -0
- astribidem-0.0.0a0/notes/design/banded-edge-builds.md +355 -0
- astribidem-0.0.0a0/notes/design/grouped-uid-spatial-matching.md +187 -0
- astribidem-0.0.0a0/notes/hub-and-spoke-history.md +43 -0
- astribidem-0.0.0a0/notes/provenance.md +40 -0
- astribidem-0.0.0a0/notes/uid-acero-evaluation.md +137 -0
- astribidem-0.0.0a0/notes/uid-matching-implementation.md +147 -0
- astribidem-0.0.0a0/pyproject.toml +65 -0
- astribidem-0.0.0a0/scripts/check_release.py +18 -0
- astribidem-0.0.0a0/scripts/smoke_install.py +49 -0
- astribidem-0.0.0a0/src/astribidem/__init__.py +73 -0
- astribidem-0.0.0a0/src/astribidem/_formats.py +43 -0
- astribidem-0.0.0a0/src/astribidem/_radii.py +41 -0
- astribidem-0.0.0a0/src/astribidem/api.py +159 -0
- astribidem-0.0.0a0/src/astribidem/audit.py +137 -0
- astribidem-0.0.0a0/src/astribidem/banded.py +562 -0
- astribidem-0.0.0a0/src/astribidem/candidate_edges.py +180 -0
- astribidem-0.0.0a0/src/astribidem/edge_files.py +309 -0
- astribidem-0.0.0a0/src/astribidem/edges.py +369 -0
- astribidem-0.0.0a0/src/astribidem/geometry.py +394 -0
- astribidem-0.0.0a0/src/astribidem/graph.py +178 -0
- astribidem-0.0.0a0/src/astribidem/hub_and_spoke.py +230 -0
- astribidem-0.0.0a0/src/astribidem/index_files.py +165 -0
- astribidem-0.0.0a0/src/astribidem/kernel.py +316 -0
- astribidem-0.0.0a0/src/astribidem/modes.py +751 -0
- astribidem-0.0.0a0/src/astribidem/regions.py +379 -0
- astribidem-0.0.0a0/src/astribidem/uids.py +217 -0
- astribidem-0.0.0a0/tests/fixtures/aion_parity.npz +0 -0
- astribidem-0.0.0a0/tests/fixtures/aion_parity_cases.py +68 -0
- astribidem-0.0.0a0/tests/fixtures/generate_aion_parity.py +147 -0
- astribidem-0.0.0a0/tests/geometry/__init__.py +0 -0
- astribidem-0.0.0a0/tests/geometry/_astropy_reference.py +160 -0
- astribidem-0.0.0a0/tests/geometry/_crossmatch_fixtures.py +131 -0
- astribidem-0.0.0a0/tests/geometry/test_crossmatch_correctness.py +85 -0
- astribidem-0.0.0a0/tests/geometry/test_crossmatch_edge_cases.py +186 -0
- astribidem-0.0.0a0/tests/geometry/test_crossmatch_n_way.py +91 -0
- astribidem-0.0.0a0/tests/test_aion_parity.py +154 -0
- astribidem-0.0.0a0/tests/test_api.py +225 -0
- astribidem-0.0.0a0/tests/test_audit.py +103 -0
- astribidem-0.0.0a0/tests/test_banded.py +173 -0
- astribidem-0.0.0a0/tests/test_candidate_edges.py +283 -0
- astribidem-0.0.0a0/tests/test_crossmatch_dedupe_edges.py +88 -0
- astribidem-0.0.0a0/tests/test_crossmatch_kernel.py +153 -0
- astribidem-0.0.0a0/tests/test_crossmatch_modes.py +308 -0
- astribidem-0.0.0a0/tests/test_formats.py +111 -0
- astribidem-0.0.0a0/tests/test_hub_and_spoke.py +446 -0
- astribidem-0.0.0a0/tests/test_index_files.py +146 -0
- astribidem-0.0.0a0/tests/test_regions.py +178 -0
- astribidem-0.0.0a0/tests/test_spatial_preparation.py +211 -0
- astribidem-0.0.0a0/tests/test_uids.py +366 -0
- astribidem-0.0.0a0/uv.lock +1462 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
release-tag:
|
|
7
|
+
description: Optional release tag; must equal v plus the package version
|
|
8
|
+
type: string
|
|
9
|
+
default: ""
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
19
|
+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.14"
|
|
22
|
+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
23
|
+
with:
|
|
24
|
+
enable-cache: true
|
|
25
|
+
cache-dependency-glob: uv.lock
|
|
26
|
+
- run: uv sync --locked --extra dev
|
|
27
|
+
- name: Check release version
|
|
28
|
+
env:
|
|
29
|
+
RELEASE_TAG: ${{ inputs.release-tag }}
|
|
30
|
+
run: uv run --no-sync python scripts/check_release.py "$RELEASE_TAG"
|
|
31
|
+
- name: Build sdist and wheel from the sdist
|
|
32
|
+
run: uv build
|
|
33
|
+
- name: Check package metadata and README rendering
|
|
34
|
+
run: uv run --no-sync twine check --strict dist/*
|
|
35
|
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
36
|
+
with:
|
|
37
|
+
name: python-distributions
|
|
38
|
+
path: dist/*
|
|
39
|
+
if-no-files-found: error
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
workflow_call:
|
|
9
|
+
inputs:
|
|
10
|
+
release-tag:
|
|
11
|
+
description: Optional release tag; must equal v plus the package version
|
|
12
|
+
type: string
|
|
13
|
+
default: ""
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
20
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
pre-commit:
|
|
24
|
+
uses: ./.github/workflows/pre-commit.yml
|
|
25
|
+
|
|
26
|
+
build:
|
|
27
|
+
uses: ./.github/workflows/build.yml
|
|
28
|
+
with:
|
|
29
|
+
release-tag: ${{ inputs.release-tag || '' }}
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
needs: build
|
|
33
|
+
uses: ./.github/workflows/test.yml
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Pre-commit
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
pre-commit:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
14
|
+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.14"
|
|
17
|
+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
18
|
+
with:
|
|
19
|
+
enable-cache: true
|
|
20
|
+
cache-dependency-glob: uv.lock
|
|
21
|
+
- name: Install development tools
|
|
22
|
+
run: uv sync --locked --extra dev
|
|
23
|
+
- name: Run pre-commit
|
|
24
|
+
run: uv run --no-sync pre-commit run --all-files
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: release-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: false
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
checks:
|
|
16
|
+
uses: ./.github/workflows/ci.yml
|
|
17
|
+
with:
|
|
18
|
+
release-tag: ${{ github.event.release.tag_name }}
|
|
19
|
+
|
|
20
|
+
pypi:
|
|
21
|
+
needs: checks
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
environment:
|
|
24
|
+
name: pypi
|
|
25
|
+
url: https://pypi.org/p/astribidem
|
|
26
|
+
permissions:
|
|
27
|
+
id-token: write
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
30
|
+
with:
|
|
31
|
+
name: python-distributions
|
|
32
|
+
path: dist
|
|
33
|
+
- name: Publish the tested distributions to PyPI
|
|
34
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
14
|
+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.14"
|
|
17
|
+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
18
|
+
with:
|
|
19
|
+
enable-cache: true
|
|
20
|
+
cache-dependency-glob: pyproject.toml
|
|
21
|
+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
22
|
+
with:
|
|
23
|
+
name: python-distributions
|
|
24
|
+
path: dist
|
|
25
|
+
- name: Check base and large installations without test dependencies
|
|
26
|
+
run: |
|
|
27
|
+
wheel=(dist/*.whl)
|
|
28
|
+
for extra in base large; do
|
|
29
|
+
environment=".smoke-$extra"
|
|
30
|
+
uv venv "$environment"
|
|
31
|
+
requirement="${wheel[0]}"
|
|
32
|
+
if [[ "$extra" == large ]]; then requirement+="[large]"; fi
|
|
33
|
+
uv pip install --python "$environment" "$requirement"
|
|
34
|
+
uv run --no-project --python "$environment" python scripts/smoke_install.py "$extra"
|
|
35
|
+
done
|
|
36
|
+
- name: Install the built wheel in an isolated environment
|
|
37
|
+
run: |
|
|
38
|
+
uv venv .ci-venv
|
|
39
|
+
wheel=(dist/*.whl)
|
|
40
|
+
uv pip install --python .ci-venv "${wheel[0]}[test]" coverage
|
|
41
|
+
uv run --no-project --python .ci-venv python -c "import astribidem; assert 'site-packages' in astribidem.__file__, astribidem.__file__"
|
|
42
|
+
- name: Run tests against the installed wheel
|
|
43
|
+
run: uv run --no-project --python .ci-venv coverage run -m pytest --durations=15 --durations-min=1
|
|
44
|
+
- name: Report coverage
|
|
45
|
+
if: ${{ always() && hashFiles('.coverage') != '' }}
|
|
46
|
+
run: |
|
|
47
|
+
uv run --no-project --python .ci-venv coverage xml
|
|
48
|
+
uv run --no-project --python .ci-venv coverage report
|
|
49
|
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
50
|
+
if: ${{ always() && hashFiles('coverage.xml') != '' }}
|
|
51
|
+
with:
|
|
52
|
+
name: coverage
|
|
53
|
+
path: coverage.xml
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-added-large-files
|
|
8
|
+
args: ["--maxkb=1000"]
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: check-toml
|
|
11
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
12
|
+
rev: v0.16.9
|
|
13
|
+
hooks:
|
|
14
|
+
- id: ruff-check
|
|
15
|
+
args: ["--fix"]
|
|
16
|
+
- id: ruff-format
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.0a0 — 2026-09-28
|
|
4
|
+
|
|
5
|
+
First public alpha. The earlier `0.1.0a1` metadata was
|
|
6
|
+
used only during private development and was never published.
|
|
7
|
+
|
|
8
|
+
- Spatial, exact UID and hub-and-spoke matching returning Arrow row indexes.
|
|
9
|
+
- Spatial inputs are name-to-`(ra, dec)` mappings, converted at kernel creation.
|
|
10
|
+
- Scalar radius defaults with `radius_arcsec_overrides` for pairs and
|
|
11
|
+
`dedupe_radius_arcsec_overrides` for surveys.
|
|
12
|
+
- Each mixed match prepares the hub kernel and dedupe result once and releases
|
|
13
|
+
spoke kernels between links; calls remain independent.
|
|
14
|
+
- Explicit deduplication, pair and entity-resolution policies, with optional
|
|
15
|
+
mapping from input rows to caller IDs.
|
|
16
|
+
- Reusable candidate edges, saved segments and banded spatial processing.
|
|
17
|
+
- Versioned saved formats and producer version metadata. Unversioned private
|
|
18
|
+
development files must be regenerated.
|
|
19
|
+
- Reject nonfinite coordinates and declinations outside [-90, 90].
|
|
20
|
+
- Require DuckDB 1.5 for sorted segment resolution; SciPy starts at 1.11.1.
|
|
21
|
+
- CI checks formatting, built distributions and optional installation boundaries
|
|
22
|
+
on Ubuntu with Python 3.14.
|
|
23
|
+
- Publish tested distributions to PyPI through Trusted Publishing on GitHub release.
|
|
24
|
+
|
|
25
|
+
This is an alpha interface. Pin the version and consult
|
|
26
|
+
[API and compatibility](docs/api-and-compatibility.md) before upgrading.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tom Hehir
|
|
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,121 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: astribidem
|
|
3
|
+
Version: 0.0.0a0
|
|
4
|
+
Summary: Astronomical catalogue matching with explicit association policies and Arrow indexes.
|
|
5
|
+
Project-URL: Repository, https://github.com/tom-hehir/astribidem
|
|
6
|
+
Project-URL: Documentation, https://github.com/tom-hehir/astribidem/blob/main/docs/README.md
|
|
7
|
+
Project-URL: Issues, https://github.com/tom-hehir/astribidem/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/tom-hehir/astribidem/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Tom Hehir
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: arrow,astronomy,catalogue,crossmatch,parquet
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
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: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: numpy>=1.26
|
|
23
|
+
Requires-Dist: pyarrow>=15
|
|
24
|
+
Requires-Dist: scipy>=1.11.1
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: astropy>=6; extra == 'dev'
|
|
27
|
+
Requires-Dist: coverage[toml]>=7; extra == 'dev'
|
|
28
|
+
Requires-Dist: duckdb>=1.5; extra == 'dev'
|
|
29
|
+
Requires-Dist: pre-commit>=4; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff==0.16.9; extra == 'dev'
|
|
32
|
+
Requires-Dist: twine>=6; extra == 'dev'
|
|
33
|
+
Provides-Extra: large
|
|
34
|
+
Requires-Dist: duckdb>=1.5; extra == 'large'
|
|
35
|
+
Provides-Extra: test
|
|
36
|
+
Requires-Dist: astropy>=6; extra == 'test'
|
|
37
|
+
Requires-Dist: duckdb>=1.5; extra == 'test'
|
|
38
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# astribidem
|
|
42
|
+
|
|
43
|
+
Astronomical catalogue matching by sky position or shared identifiers.
|
|
44
|
+
Results are Arrow tables of matched row positions, which you can map to your
|
|
45
|
+
own catalogue IDs.
|
|
46
|
+
|
|
47
|
+
## Match coordinate arrays
|
|
48
|
+
|
|
49
|
+
Pass each catalogue as a pair of `(ra, dec)` arrays in degrees, in the same
|
|
50
|
+
celestial frame and epoch.
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from astribidem import DegenerateCrossmatchConfig, crossmatch, rows_to_ids
|
|
54
|
+
|
|
55
|
+
sources = {
|
|
56
|
+
"a": ([10.0, 20.0], [0.0, 0.0]),
|
|
57
|
+
"b": ([10.0001, 30.0], [0.0, 0.0]),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# Match pairs that are each other's nearest neighbours within one arcsecond.
|
|
61
|
+
rows = crossmatch(
|
|
62
|
+
sources,
|
|
63
|
+
radius_arcsec=1.0,
|
|
64
|
+
dedupe_radius_arcsec=0.0, # Disable within-catalogue deduplication.
|
|
65
|
+
mode=DegenerateCrossmatchConfig(surveys=["a", "b"], policy="mutual_nearest"),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Contents of `rows`: the matched input row positions and their separation.
|
|
69
|
+
# Separations are rounded here for display.
|
|
70
|
+
# a/row_index | b/row_index | a__b/separation_arcsec
|
|
71
|
+
# 0 | 0 | 0.36
|
|
72
|
+
|
|
73
|
+
# Replace row positions with your own IDs, supplied in the original row order.
|
|
74
|
+
index = rows_to_ids(rows, {"a": [101, 102], "b": [201, 202]})
|
|
75
|
+
|
|
76
|
+
# Contents of `index`: the same match, now labelled with catalogue IDs.
|
|
77
|
+
# a/id | b/id | a__b/separation_arcsec
|
|
78
|
+
# 101 | 201 | 0.36
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
See the [matching guide](https://github.com/tom-hehir/astribidem/blob/main/docs/matching-guide.md)
|
|
82
|
+
for other policies, multiple catalogues and per-catalogue radius settings.
|
|
83
|
+
|
|
84
|
+
## Match shared identifiers
|
|
85
|
+
|
|
86
|
+
When catalogues share an identifier system, match their unique IDs directly:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from astribidem import match_uids
|
|
90
|
+
|
|
91
|
+
uids = {
|
|
92
|
+
"images": ["object-B", "object-A"],
|
|
93
|
+
"spectra": ["object-A", "object-C"],
|
|
94
|
+
}
|
|
95
|
+
matches = match_uids(uids, join="outer") # Keep every identifier from either catalogue.
|
|
96
|
+
|
|
97
|
+
# Contents of `matches`: input row positions; null means no match in that catalogue.
|
|
98
|
+
# entity_id | images/row_index | spectra/row_index
|
|
99
|
+
# 0 | 0 | null
|
|
100
|
+
# 1 | 1 | 0
|
|
101
|
+
# 2 | null | 1
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Use `join="inner"` to keep only shared identifiers. See
|
|
105
|
+
[UID matching](https://github.com/tom-hehir/astribidem/blob/main/docs/uid-matching.md)
|
|
106
|
+
for join options and mapping the results to IDs.
|
|
107
|
+
|
|
108
|
+
## Save an index
|
|
109
|
+
|
|
110
|
+
Results are ordinary Arrow tables, so they can be saved as Parquet:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
import pyarrow.parquet as pq
|
|
114
|
+
|
|
115
|
+
pq.write_table(index, "index.parquet")
|
|
116
|
+
index = pq.read_table("index.parquet")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
See the [documentation](https://github.com/tom-hehir/astribidem/blob/main/docs/README.md)
|
|
120
|
+
for mixed UID/coordinate matching, larger-than-memory workflows, API details
|
|
121
|
+
and development instructions.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# astribidem
|
|
2
|
+
|
|
3
|
+
Astronomical catalogue matching by sky position or shared identifiers.
|
|
4
|
+
Results are Arrow tables of matched row positions, which you can map to your
|
|
5
|
+
own catalogue IDs.
|
|
6
|
+
|
|
7
|
+
## Match coordinate arrays
|
|
8
|
+
|
|
9
|
+
Pass each catalogue as a pair of `(ra, dec)` arrays in degrees, in the same
|
|
10
|
+
celestial frame and epoch.
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from astribidem import DegenerateCrossmatchConfig, crossmatch, rows_to_ids
|
|
14
|
+
|
|
15
|
+
sources = {
|
|
16
|
+
"a": ([10.0, 20.0], [0.0, 0.0]),
|
|
17
|
+
"b": ([10.0001, 30.0], [0.0, 0.0]),
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# Match pairs that are each other's nearest neighbours within one arcsecond.
|
|
21
|
+
rows = crossmatch(
|
|
22
|
+
sources,
|
|
23
|
+
radius_arcsec=1.0,
|
|
24
|
+
dedupe_radius_arcsec=0.0, # Disable within-catalogue deduplication.
|
|
25
|
+
mode=DegenerateCrossmatchConfig(surveys=["a", "b"], policy="mutual_nearest"),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Contents of `rows`: the matched input row positions and their separation.
|
|
29
|
+
# Separations are rounded here for display.
|
|
30
|
+
# a/row_index | b/row_index | a__b/separation_arcsec
|
|
31
|
+
# 0 | 0 | 0.36
|
|
32
|
+
|
|
33
|
+
# Replace row positions with your own IDs, supplied in the original row order.
|
|
34
|
+
index = rows_to_ids(rows, {"a": [101, 102], "b": [201, 202]})
|
|
35
|
+
|
|
36
|
+
# Contents of `index`: the same match, now labelled with catalogue IDs.
|
|
37
|
+
# a/id | b/id | a__b/separation_arcsec
|
|
38
|
+
# 101 | 201 | 0.36
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
See the [matching guide](https://github.com/tom-hehir/astribidem/blob/main/docs/matching-guide.md)
|
|
42
|
+
for other policies, multiple catalogues and per-catalogue radius settings.
|
|
43
|
+
|
|
44
|
+
## Match shared identifiers
|
|
45
|
+
|
|
46
|
+
When catalogues share an identifier system, match their unique IDs directly:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from astribidem import match_uids
|
|
50
|
+
|
|
51
|
+
uids = {
|
|
52
|
+
"images": ["object-B", "object-A"],
|
|
53
|
+
"spectra": ["object-A", "object-C"],
|
|
54
|
+
}
|
|
55
|
+
matches = match_uids(uids, join="outer") # Keep every identifier from either catalogue.
|
|
56
|
+
|
|
57
|
+
# Contents of `matches`: input row positions; null means no match in that catalogue.
|
|
58
|
+
# entity_id | images/row_index | spectra/row_index
|
|
59
|
+
# 0 | 0 | null
|
|
60
|
+
# 1 | 1 | 0
|
|
61
|
+
# 2 | null | 1
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Use `join="inner"` to keep only shared identifiers. See
|
|
65
|
+
[UID matching](https://github.com/tom-hehir/astribidem/blob/main/docs/uid-matching.md)
|
|
66
|
+
for join options and mapping the results to IDs.
|
|
67
|
+
|
|
68
|
+
## Save an index
|
|
69
|
+
|
|
70
|
+
Results are ordinary Arrow tables, so they can be saved as Parquet:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import pyarrow.parquet as pq
|
|
74
|
+
|
|
75
|
+
pq.write_table(index, "index.parquet")
|
|
76
|
+
index = pq.read_table("index.parquet")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
See the [documentation](https://github.com/tom-hehir/astribidem/blob/main/docs/README.md)
|
|
80
|
+
for mixed UID/coordinate matching, larger-than-memory workflows, API details
|
|
81
|
+
and development instructions.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Matching benchmarks
|
|
2
|
+
|
|
3
|
+
For spatial matching, see the [in-memory versus banded benchmark](spatial.md),
|
|
4
|
+
which records time and peak memory and verifies identical output indexes.
|
|
5
|
+
|
|
6
|
+
## UID matching benchmark
|
|
7
|
+
|
|
8
|
+
The [UID implementation decision](../notes/uid-matching-implementation.md) records a separate
|
|
9
|
+
comparison of canonical Arrow, NumPy, pandas and Polars approaches, including
|
|
10
|
+
threading and native-string requirements. Arrow remains the chosen dependency;
|
|
11
|
+
the measurements below describe the earlier Python-object-to-Arrow update.
|
|
12
|
+
|
|
13
|
+
The [direct Acero evaluation](../notes/uid-acero-evaluation.md) preserves a
|
|
14
|
+
reproducible two-source comparison of the production matcher, optimized
|
|
15
|
+
`index_in`, `Table.join`, and row-position-only Acero joins at 500k and 2m
|
|
16
|
+
rows/source. Run `benchmark_uid_acero.py` using the commands in that report.
|
|
17
|
+
It is an experiment, not a selectable production backend.
|
|
18
|
+
|
|
19
|
+
`benchmark_uids.py` measures the UID matcher in fresh, sequential subprocesses.
|
|
20
|
+
Each process warms its implementation, creates native typed inputs, times one
|
|
21
|
+
match call and then validates the complete ordered row output and nullable
|
|
22
|
+
memberships. The matcher now returns rows, so mapping them to IDs is a separate
|
|
23
|
+
`rows_to_ids` step outside the timing; earlier measurements below included the
|
|
24
|
+
ID gather. Validating an older typed-ID implementation needs the script from
|
|
25
|
+
that commit. There are three repeats per case; the table reports medians.
|
|
26
|
+
|
|
27
|
+
Run from the repository root with the package's dependencies installed:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
python benchmarks/benchmark_uids.py \
|
|
31
|
+
--module src/astribidem/uids.py \
|
|
32
|
+
--label native_arrays --output /tmp/uid-native.json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To reproduce the previous Python-dictionary implementation separately:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
git show 9c075412265e941cd94ed49d8adf44eb64284a22:src/astro_crossmatch/uids.py > /tmp/uid-baseline.py
|
|
39
|
+
python benchmarks/benchmark_uids.py \
|
|
40
|
+
--module /tmp/uid-baseline.py \
|
|
41
|
+
--label python_baseline --output /tmp/uid-baseline.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Recorded on 2026-09-17 with Python 3.13.5, NumPy 2.5.3 and PyArrow 25.0.1,
|
|
45
|
+
on macOS arm64. Each case has two shuffled sources with half their keys shared.
|
|
46
|
+
Mixed integers include adjacent signed/unsigned keys across `INT64_MAX`.
|
|
47
|
+
|
|
48
|
+
| Rows per source / key type | Join | Previous time | Native time | Previous additional peak RSS | Native additional peak RSS |
|
|
49
|
+
| --- | --- | ---: | ---: | ---: | ---: |
|
|
50
|
+
| 500,000 int64 | inner | 0.486 s | 0.162 s | 249.9 MB | 130.0 MB |
|
|
51
|
+
| 500,000 int64 | outer | 0.430 s | 0.200 s | 310.7 MB | 134.0 MB |
|
|
52
|
+
| 100,000 strings | inner | 0.104 s | 0.040 s | 50.2 MB | 24.1 MB |
|
|
53
|
+
| 100,000 strings | outer | 0.102 s | 0.053 s | 53.3 MB | 28.3 MB |
|
|
54
|
+
| 100,000 mixed integers | inner | 0.090 s | 0.027 s | 60.3 MB | 30.2 MB |
|
|
55
|
+
| 100,000 mixed integers | outer | 0.087 s | 0.033 s | 66.8 MB | 31.1 MB |
|
|
56
|
+
|
|
57
|
+
Raw repetitions and environment metadata are in
|
|
58
|
+
[the previous baseline](results/uid-python-baseline.json) and
|
|
59
|
+
[the native-array result](results/uid-native.json).
|
|
60
|
+
|
|
61
|
+
RSS is the increase in the process high-water mark over the value measured
|
|
62
|
+
after input creation; it excludes input storage and is not an exact allocation
|
|
63
|
+
count. Decimal MB are used. Allocator retention and OS accounting affect the
|
|
64
|
+
result. These local measurements are not a general throughput or memory bound:
|
|
65
|
+
native hash tables remain a material memory cost, indexes remain in RAM, and
|
|
66
|
+
different numbers of sources, overlaps and key lengths can change the balance.
|
|
67
|
+
|
|
68
|
+
Validation for the implementation change: 251 core tests and 186 downstream
|
|
69
|
+
HF tests passed on PyArrow 25.0.1. All 75 UID tests also passed with Python 3.11,
|
|
70
|
+
NumPy 1.26.4 and the minimum declared PyArrow version, 15.0.0.
|
|
71
|
+
|
|
72
|
+
## `index_in` production update
|
|
73
|
+
|
|
74
|
+
The production matcher now performs one `pc.index_in` lookup per non-anchor
|
|
75
|
+
source and reuses the resulting row positions for membership and final output.
|
|
76
|
+
It retains N-source inner/left/outer semantics, exact integer and string keys,
|
|
77
|
+
and all validation. NumPy handles only integer row positions and an outer-join
|
|
78
|
+
boolean bitmap. Normalized keys are released before final ID gathers; row maps
|
|
79
|
+
are released as each output column is built.
|
|
80
|
+
|
|
81
|
+
A before/after run on 2026-09-17 used the same fixtures and worker from
|
|
82
|
+
`benchmark_uid_acero.py`, calling the production `current` strategy against
|
|
83
|
+
`80aedb8` and the updated module. Each case used 500,000 rows/source, 50% overlap,
|
|
84
|
+
one Arrow thread, and three fresh sequential warmed workers per implementation;
|
|
85
|
+
implementation order alternated between repeats. Times include validation,
|
|
86
|
+
normalization, matching and ordered typed output; every output was checked
|
|
87
|
+
against the independent rank oracle outside timing.
|
|
88
|
+
|
|
89
|
+
| Keys / join | Before | Updated | Before additional peak RSS | Updated additional peak RSS |
|
|
90
|
+
| --- | ---: | ---: | ---: | ---: |
|
|
91
|
+
| int64 / inner | 171.8 ms | 119.5 ms | 130.0 MB | 119.5 MB |
|
|
92
|
+
| int64 / outer | 216.1 ms | 139.5 ms | 134.0 MB | 125.6 MB |
|
|
93
|
+
| string / inner | 316.0 ms | 274.6 ms | 130.2 MB | 127.2 MB |
|
|
94
|
+
| string / outer | 434.2 ms | 258.9 ms | 140.7 MB | 134.1 MB |
|
|
95
|
+
|
|
96
|
+
Medians are shown. The updated matcher took 13–40% less time on these two-source
|
|
97
|
+
workloads, with modest memory reductions. RSS has the high-water-mark limitations
|
|
98
|
+
described above; this does not establish N-source performance or survey-scale
|
|
99
|
+
capacity. [Raw results and module checksum](results/uid-index-in.json) preserve
|
|
100
|
+
all 24 measurements and the environment (Python 3.13.5, NumPy 2.5.3,
|
|
101
|
+
PyArrow 25.0.1, macOS arm64).
|
|
102
|
+
|
|
103
|
+
For a before/after comparison using the existing benchmark suite:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
git show 80aedb8:src/astro_crossmatch/uids.py > /tmp/uids-before.py
|
|
107
|
+
python benchmarks/benchmark_uid_acero.py \
|
|
108
|
+
--module /tmp/uids-before.py --output /tmp/uids-before.json
|
|
109
|
+
python benchmarks/benchmark_uid_acero.py \
|
|
110
|
+
--module src/astribidem/uids.py --output /tmp/uids-after.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Compare the `strategy="current"` measurements in those files. The suite also
|
|
114
|
+
runs the older two-source prototypes. To reproduce individual production workers
|
|
115
|
+
or alternate before/after modules, use `--worker --strategy current --threads 1
|
|
116
|
+
--rows 500000 --kind int64 --join inner`, varying key family and join as needed.
|
|
117
|
+
|
|
118
|
+
Validation: 260 core tests and 186 downstream HF tests passed against the updated
|
|
119
|
+
source. All 84 UID tests passed on minimum-supported PyArrow 15.0.0 as well.
|
|
120
|
+
New regressions cover late-source matches to previously introduced outer keys,
|
|
121
|
+
successive four-source inner reductions, and single-source chunked/empty inputs.
|