Skip to main content

xmatcher

xmatcher matches and joins astronomical catalogues from local files, HATS trees, and configured remote archives. Matching features depend on the selected engine and the metadata supplied for each catalogue; the guides document those limits and the memory trade-offs.

Version 0.5.1 is the PyPI release. The v0.5.0 GitHub release keeps the old xmatch name. See the migration notes.

xmatcher match catalog1.parquet catalog2.csv -o matches.parquet -r 1.0

Inputs can be local Parquet, CSV, TSV, or FITS files, HATS directories, Polars frames, or configured remote catalogues. Coordinate names can be configured or detected. Proper-motion propagation uses declared epoch and motion metadata; mixed coordinate frames are rejected and generic catalogue discovery does not invent positional uncertainties.


📚 Complete Documentation Suite

All detailed architectural references and user guides are organized in the docs/ directory:


Capabilities

  • Universal Multi-Format I/O:
    • Ingests and streams .parquet, .csv, .tsv, .tab, .fits (via high-speed Torchfits with Astropy fallback), and HATS.
    • Remote storage connectors: POSIX filesystem, CANFAR VOSpace (vos:), HTTP/HTTPS, and S3.
  • File I/O and explicit memory controls:
    • Parquet, CSV, TSV, FITS, and HATS readers with Parquet/CSV/TSV/FITS outputs.
    • Output sinks can stream serialization. Most matching engines still materialize inputs and matches; local pairwise CSV/Parquet requests can opt into the spill path with --memory-budget-bytes and file output. See memory limits.
  • Astrometric and probabilistic matchers:
    • Simple radius (sky) and adaptive per-row astrometric uncertainties (skyerr).
    • 2D Gaussian error ellipses via Mahalanobis distance (skyellipse).
    • Proper-motion epoch propagation (target_epoch) when epoch and motion metadata are supplied, plus an explicit population drift model (pm_prior) for missing motion.
    • Sutherland & Saunders (1992) Likelihood Ratio (lr) with magnitude background subtraction.
    • Machine learning classifiers (ml Random Forest, xgb XGBoost/LightGBM) with self-match pseudo-labeling.
    • AUF-inspired empirical separation/background scores (auf) and a flux-augmented heuristic (macauff). These are not full reproductions of the published methods and their scores are not calibrated probabilities.
    • Bayesian positional qualification (probabilistic=True) or photometric qualification (prior_columns) with declared errors or explicit error floors, plus simultaneous $N$-way scores (nway_match). These scores use stated assumptions and are not population-calibrated probabilities.
    • Friends-of-Friends transitive closure object bundles (fof_match).
  • Complete Relational Joins:
    • Inner (1and2), Left (all1), Right (all2), Full Outer (1or2, all), and Anti-joins (1not2, 2not1).
    • Relational ID joins on survey identifiers (--id-join).
    • Multi-catalogue sequential chains (crossmatch_multi).
  • Local Mirroring & Offline Caching:
    • xmatcher sync: Mirror remote TAP and HATS surveys into a durable local HATS cache with keyset paging, rate limiting, and progress checkpoints.
  • Distributed execution:
    • engine="ray" parallelizes pairwise HEALPix candidate searches. The coordinator still holds the input frames and final result in memory.
    • engine="ray-union" mirrors inputs into HATS and writes a full-sky, full-outer HATS union. It supports sky, skyerr, and skyellipse; compressed interval planning handles mixed-order/RING layouts and uncertainty or epoch halos in distributed tasks. Planning may scan additional partitions. Output trees add non-null _union_ra and _union_dec routing columns and declare NESTED ordering.

Installation

Requires Python $\ge 3.13$. The checked Pixi environment and local release gate use Python 3.13.

git clone https://github.com/astroai/xmatcher.git
cd xmatcher

# Install environment and dependencies
pixi install

# Run lint, formatting, bytecode, and offline test checks
pixi run preflight-push
pixi run ci-local

Standard: Pip

python -m pip install "xmatcher==0.5.1"

# Optional integrations; use only the extras you need
python -m pip install "xmatcher[cds,hats-ray,torchfits,ml]==0.5.1"

A source checkout uses the same extras from the tree:

git clone https://github.com/astroai/xmatcher.git
cd xmatcher
python -m pip install ".[cds,hats-ray,torchfits,ml]"

The tensor-native torchsky engine is not a package extra: no torchsky distribution is published on PyPI. To use it, install xmatcher alongside a compatible Torchsky checkout. The integration was tested with the sibling Torchsky 0.4 development source installed editable and Torchfits 1.0.0 from PyPI.


Command Line Quick Reference

Task Command
Match two local files xmatcher match cat1.parquet cat2.csv -o matches.parquet -r 1.5
Match against remote Gaia DR3 xmatcher match targets.csv gaia -o targets_gaia.parquet -r 1.0
Astrometric error ellipse match xmatcher match xray.fits optical.parquet --matcher skyellipse --max-error 3.0
Proper-motion drift prior match xmatcher match old_survey.csv gaia --target-epoch 2016.0 --pm-prior -r 2.0
Relational ID join xmatcher match cat1.parquet cat2.parquet --id-join --id1 objid --id2 objid
Multi-survey 3-way chain xmatcher match gaia wise.csv 2mass.parquet -r 1.5 -o 3way.parquet
Distributed HATS master union xmatcher match gaia allwise 2mass des --union --engine ray-union -o /data/master.hats
Mirror remote surveys to local cache xmatcher sync gaia allwise 2mass
Search remote TAP archives xmatcher search des
Discover archive schemas xmatcher discover noirlab --schema nsc_dr2.object

Python API Quickstart

from xmatcher import CrossMatch, MatchRequest, MatchSpec

cm = CrossMatch()

# 1. Preferred typed request interface
req = MatchRequest(
    cat1="optical.parquet",
    cat2="infrared.csv",
    spec=MatchSpec(radius_arcsec=1.5, matcher="sky", find="best"),
    engine="fast",  # SciPy cKDTree multi-threaded on 3D unit sphere
)
result_df = cm.crossmatch_request(req)

# 2. Multi-catalogue sequential intersection
result_3way = cm.crossmatch_multi(
    ["optical.parquet", "infrared.csv", "radio.fits"],
    radius_arcsec=2.0,
    join_type="1and2",
)

# 3. Friends-of-Friends object bundles
bundles = cm.fof_match(
    ["survey_a.parquet", "survey_b.parquet", "survey_c.parquet"],
    radius_arcsec=1.5,
)

License

MIT License. See LICENSE for details.

Metadata

Release files for xmatcher 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xmatcher 0.5.1
File Size Uploaded Provenance Actions
xmatcher-0.5.1.tar.gz 785.3 kB With provenance Details for xmatcher-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xmatcher 0.5.1
File Interpreter ABI Platform Actions
xmatcher-0.5.1-py3-none-any.whl Python 3 none any Details for xmatcher-0.5.1-py3-none-any.whl

Total release size: 1.0 MB

Release files / xmatcher-0.5.1.tar.gz

Download URL xmatcher-0.5.1.tar.gz
Size 785.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f9deb17a89bcd3bc2bcf0a9d3fd01c6b645043635f6472147964567410fd8d27
BLAKE2b-256 checksum
How to use checksums
98278da623bb50f907b1d706c2ab605fcdeae3f746c5bd5fe9794933f378b821
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / xmatcher-0.5.1-py3-none-any.whl

Download URL xmatcher-0.5.1-py3-none-any.whl
Size 238.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0fabd95b8d22552b9ec65c239dc2367b0116ea52d6660d393c6bea9760152cf
BLAKE2b-256 checksum
How to use checksums
a9d71fb3604d3f2e6c23205a4349048bb0b4688e388c9e6ad49f540aee9206cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Security for xmatcher 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xmatcher-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page