Skip to main content

Findakin

Find a kin for every spectrum.

Findakin answers population questions about collections of astronomical spectra: which look alike, what structure they form, which stand out, which changed in time, and which representation (encoder) is the most physical. It is a local Python library built on spectro-kernel (one spectrum → one vector) and LanceDB (an embedded, versioned, columnar store with a vector index). No server, no account: your spectra stay on your disk.

Status: 0.2 alpha, API may still change. Findakin started as a hosted web application (FastAPI + MongoDB + Qdrant + React, retired in October 2026) and was rebuilt as a local-first library. Landing page: findakin.lelain.net · Documentation: findakin.lelain.net/docs.

spectro-kernel  = algorithms on ONE spectrum   (embeddings, I/O, lines, RV, reduction…)
Findakin        = questions on MANY spectra    (index, neighbours, clusters, anomalies,
                                                trajectories, encoder benchmarks)

406 pro-am spectra of three stars read back as spectra: mean and spread per star on a common grid

Three stars of a pro-am campaign (STAROS) read back as spectra after ingestion, embedding and grouping. The documentation works through this population and through 566 SDSS stars, with provenance.

Install

pip install findakin                 # core: store, ingestion, kernel recipes, k-NN, analysis toolbox
pip install "findakin[viz]"          # + the Plotly views (maps, overlays, cluster means, trajectories…)
pip install "findakin[analysis]"     # + UMAP, HDBSCAN, self-organising maps (minisom)
pip install "findakin[vo]"           # + SSAP / Virtual Observatory connectors
pip install "findakin[encoders]"     # + local PyTorch encoders (spectro-kernel embed_pretrained)

Python ≥ 3.11.

Quick start

from findakin import Store

st = Store.open("~/findakin/store")                 # a directory; created if missing

# 1. ingest — FITS (BeSS / ISIS / specINTI / Demetra dialects), CSV, JSON, TXT.
#    Spectra are deduplicated by content; metadata (object, time, instrument,
#    observer, site, resolution, coverage) is extracted from the headers.
report = st.ingest_folder("~/spectra/staros", source="staros", tags=["campaign:staros"])
print(report)                                       # 406 files → 406 added, 0 duplicates, 0 errors

# 2. embed — any spectro-kernel strategy; several encoders coexist for the same spectra
enc = st.embed(strategy="dct", dim=256, norm_method="z_score")   # → 'dct:v1:256:nogrid:z_score'
enc_ll = st.embed(strategy="log_lambda", dim=256)                 # Doppler-robust recipe
# tip: with min_max the continuum term dominates the vector and every pair scores ≈ 0.99;
# z_score (zero mean) or continuum_subtracted let the lines drive the similarity.

#    a named common grid, stored once: every spectrum resampled on 6545–6580 Å, the sharper
#    ones degraded to R = 8000 at constant R; encoders and flux matrices read the same rows
st.define_grid("halpha", 6545, 6580, resolution=8000)
st.apply_grid("halpha")                                           # 399 added; 345 degraded, 35 coarser, 19 R unknown
enc_ha = st.embed(strategy="dct", dim=64, norm_method="z_score", grid="halpha")   # → 'dct:v1:64:halpha:z_score'
st.create_index(enc)                                              # a vector index, for 10^5+ vectors

# 3. ask
st.neighbours("~/spectra/new_alfdra.fits", k=10, encoder=enc)          # k-NN by file…
st.neighbours(some_id, k=10, encoder=enc, where="resolution > 15000")   # …or by id, filtered
ids, X = st.vectors(enc, where="series_id = 'alf dra'")                 # numpy matrix for analysis

from findakin.analysis import cluster_embeddings, cluster_stability, detect_anomalies, decompose, series_trajectory
res = cluster_embeddings(X, method="agglomerative", n_clusters=2)     # Ward; linkage kept for a dendrogram
cluster_stability(X, method="agglomerative", n_clusters=2)           # is the partition reproducible?
weird = detect_anomalies(X, method="urf", contamination=0.05)        # unsupervised random forest weirdness
stack = st.flux_matrix(grid="halpha", where="series_id = 'alf Dra'") # the spectra on the grid
pca = decompose(stack.flux, "pca", n_components=5)                   # eigenspectra + reconstruction error
ids_s, t, XS = st.series("alf Dra", enc)                              # one series in time order
tr = series_trajectory(XS, t, ids=ids_s, period=51.42)               # outliers, change points, orbital phase

# 4. look — every view is a Plotly figure (pip install "findakin[viz]")
from findakin import viz
viz.cluster_spectra(stack.wavelength, stack.flux, res.labels)        # clusters read back as spectra
viz.leakage_view(project_embeddings(X).points, meta, by=("object", "instrument"))
viz.trajectory_plot(tr, x="phase", y=pca.weights[:, 0])             # the orbit, folded

Every method is glue over scikit-learn, scipy, astropy, minisom or plotly, cites its reference in the docstring, and returns a result aligned with the input ids.

Same verbs on the command line:

findakin ingest ~/spectra/alphadra --source staros --tag campaign:alphadra
findakin embed --strategy dct --dim 256
findakin grid define halpha --wl-min 6545 --wl-max 6580 --resolution 8000 && findakin grid apply halpha
findakin embed --strategy dct --dim 64 --norm-method z_score --grid halpha
findakin index dct:v1:256:nogrid:min_max
findakin search ~/spectra/new_alfdra.fits -k 10 -e dct:v1:64:halpha:z_score
findakin info

What is in the store

A LanceDB directory, versioned, rebuildable from your files:

Table Content
spectra one row per spectrum: id (content hash), source, object, series_id, t_mjd, instrument, observer, site, resolution, wl_min/wl_max, file_uri, tags, raw header (JSON)
flux_native the native wavelength / flux arrays (re-embed with a new encoder without re-reading files)
grids / flux__<grid> the named common grids, and each spectrum on each grid: flux, coverage, native resolution, degraded flag
emb__<encoder> one table per encoder: (id, vector, provenance) — encoder_id = strategy:model_version:dim:grid:norm — with an optional vector index
encoders the encoder registry (config, dimension)
results analyses stored with their provenance: name, kind, encoder, params, {id: value} payload, store version

series_id groups spectra that form a trajectory in time: an object followed over epochs (default), a night of sky spectra (series_from="night", e.g. aurorae), or a folder.

Roadmap (short)

Phase 0 — store, ingestion, kernel encoders, k-NN, CLI ✅ · Phase 2a — population toolbox (clusters + stability, URF anomalies, eigenspectra / NMF, trajectories, SOM), stored results, Plotly views ✅ · Phase 1 — named common λ grids in the store (flux__<grid>, resolution matching at constant R), vector indexes ✅ · Phase 2b — named populations, SIMBAD aliases, notebook templates · Phase 3 — learned encoders registry, benchmark with an instrument-leakage score · Phase 4 — findakin-mcp over the store · Phase 5 — thin HTTP façade for applications.

Development

uv venv .venv --python 3.12 && source .venv/bin/activate
uv pip install -e ".[dev]"
pytest -q
ruff check src tests

The landing page lives in website/ (Vite + React, deployed separately).

License

MIT — © 2026 Matthieu Le Lain.

Metadata

Release files for findakin 0.2.2

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

Source distribution (sdist)

Source distribution for findakin 0.2.2
File Size Uploaded Provenance
findakin-0.2.2.tar.gz 111.3 kB With provenance Details

Built distribution (wheel)

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

Total release size: 218.8 kB

Release files / findakin-0.2.2.tar.gz

Download URL findakin-0.2.2.tar.gz
Size 111.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0fa225afface71fe4934ab49d9cadbbce602c1886879b0cea3c11dc46cca5439
BLAKE2b-256 checksum
How to use checksums
fd8799dc86a4421fd96a29d112a236ac528912bf510622b7cc1e9f764982b32d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 23, 2026.

Transparency log

Release files / findakin-0.2.2-py3-none-any.whl

Download URL findakin-0.2.2-py3-none-any.whl
Size 107.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e532e66cd43926aa22bb4a6691fea4b2a258cbaa261ce3e7888e5aa384c86cf
BLAKE2b-256 checksum
How to use checksums
81b2885540b756ca6947df2b5934d8a501631b0189b8c20bcae5cc08e27e1fbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 23, 2026.

Transparency log

Security for findakin 0.2.2

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 findakin-0.2.2.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 23, 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.

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