Metadata-Version: 2.4
Name: astrooracle
Version: 0.2.0
Summary: AstroOracle: active learning oracle for astronomical anomaly triage (SkyView cutouts + annotations + retrain hooks).
Author: AstroOracle Contributors
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE.txt
Requires-Dist: numpy>=1.23
Requires-Dist: pandas>=2.0
Requires-Dist: matplotlib>=3.7
Requires-Dist: scikit-learn>=1.3
Requires-Dist: pyarrow>=12.0
Requires-Dist: pillow>=10.0
Provides-Extra: astro
Requires-Dist: astropy>=5.3; extra == "astro"
Requires-Dist: astroquery>=0.4.6; extra == "astro"
Provides-Extra: notebook
Requires-Dist: ipywidgets>=8.1; extra == "notebook"
Requires-Dist: jupyterlab>=4.0; extra == "notebook"
Requires-Dist: plotly>=5.18; extra == "notebook"
Provides-Extra: plotly
Requires-Dist: plotly>=5.18; extra == "plotly"
Provides-Extra: watch
Requires-Dist: watchdog>=3.0; extra == "watch"
Provides-Extra: api
Requires-Dist: fastapi>=0.110; extra == "api"
Requires-Dist: uvicorn>=0.27; extra == "api"
Requires-Dist: pydantic>=2.6; extra == "api"
Provides-Extra: stats
Requires-Dist: duckdb>=0.10; extra == "stats"
Provides-Extra: ml
Requires-Dist: scipy>=1.10; extra == "ml"
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: ruff>=0.3; extra == "dev"
Requires-Dist: black>=24.1; extra == "dev"
Dynamic: license-file

# AstroOracle

AstroOracle is an active learning “oracle” for astronomical anomaly triage.

- Reads candidate detections from a Parquet file.
- Ranks them by uncertainty + optional embedding diversity.
- Pulls multi-survey cutouts from SkyView.
- Annotates via CLI (matplotlib) or Jupyter (ipywidgets + Plotly).
- Logs events in append-only JSONL.
- Optionally triggers retraining.

## Install (editable)

```bash
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e ".[plotly,watch,notebook]"
```

## Quickstart (CLI)

Generate sample candidates:

```bash
python examples/sample_candidates.py
```

Run oracle:

```bash
astrooracle run --candidates candidates.parquet --interval 300 --n-query 6
```

Headless + PNG export:

```bash
astrooracle run --no-gui --save-cutouts cutouts/ --candidates candidates.parquet
```

## Jupyter UI

```bash
jupyter lab
```

Open `examples/oracle_notebook.ipynb`.

## Watch mode (watchdog)

```bash
astrooracle watch --candidates candidates.parquet
```

## Batch HTML export

```bash
astrooracle batch-html --candidates candidates.parquet --out-dir batch_out/ --n-query 60
```

Open `batch_out/index.html` and export annotations from the page.

## License

MIT


## Demo visuals (offline)

Generate sample candidates and create an HTML batch annotator + PNG cutouts without network access:

```bash
python examples/sample_candidates.py
astrooracle batch-html --candidates candidates.parquet --out-dir demo_out --n-query 12 --offline
```

Open `demo_out/index.html`.


## Nouveautés v0.2.0

- Ranking multicritère (anomaly score + acquisition + prior + diversité)
- Acquisition: entropy, margin, BALD (via ensemble), BADGE
- Diversité batch: k-center (core-set) et DPP greedy
- Entraînement: modèle ensemble logistic regression calibré + métriques (ECE)
- API: FastAPI (endpoints /rank, /annotate)
- Stats: DuckDB sur logs JSONL

### Commandes

```bash
astrooracle train --candidates candidates.parquet --annotations annotations.csv
astrooracle batch-html --out-dir out_html
astrooracle serve --host 127.0.0.1 --port 8000
astrooracle stats
```
