Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
10debb4
Update requirements.txt
benjaminpope Jun 11, 2024
d18d55d
Merge pull request #1 from afeinstein20/main
benjaminpope Nov 4, 2025
3f997ea
Migrate to Keras Core (JAX); drop TensorFlow; use .keras; update CI/d…
benjaminpope Nov 4, 2025
8bfcaaa
keras fixes
benjaminpope Nov 4, 2025
5f504ab
tests: use bundled model in test_predict; register downloads marker; …
benjaminpope Nov 4, 2025
f541626
package: move model .keras files into stella/data for packaging
benjaminpope Nov 4, 2025
623b105
package: include stella/data/*.keras; tests: load model via importlib…
benjaminpope Nov 4, 2025
ca43a86
feat(models): add stella.models helpers and use in tests/docs; build:…
benjaminpope Nov 4, 2025
aef4bd6
feat(models): expose stella.models.models list; docs: use packaged mo…
benjaminpope Nov 4, 2025
c8bbf77
feat(predict): add per-window progress with chunked inference; pipe t…
benjaminpope Nov 4, 2025
c693aa2
fix(mark_flares): return ragged groups as object-dtype array to avoid…
benjaminpope Nov 4, 2025
b9b05f4
feat(backends): add require_backend(); chore: migrate pytest config t…
benjaminpope Nov 4, 2025
53d24cd
fix(mark_flares): cast per-lightcurve arrays to float to avoid object…
benjaminpope Nov 4, 2025
42d5f89
docs(install): document backend extras (jax/jax-mps/torch), KERAS_BAC…
benjaminpope Nov 4, 2025
5f0e8d3
feat(backends): auto-select default Keras backend (prefer JAX then To…
benjaminpope Nov 4, 2025
5fb6dba
chore(repo): ignore and untrack downloaded FITS data (mastDownload/) …
benjaminpope Nov 4, 2025
670b684
chore(repo): stop tracking local notebooks and scripts\n\n- Ignore a…
benjaminpope Nov 4, 2025
a9eb96c
update python version
benjaminpope Nov 4, 2025
8764426
ci: install gettext on macOS before setup-python to fix libintl.8.dyl…
benjaminpope Nov 4, 2025
525d425
ci(tests): install package in editable mode with dev+jax extras befor…
benjaminpope Nov 4, 2025
5a1da44
ci: modernize GitHub Actions versions (checkout@v4, setup-python@v5, …
benjaminpope Nov 4, 2025
7fdeb57
ci: remove legacy npm docs workflow (no package.json); use Sphinx doc…
benjaminpope Nov 4, 2025
c99e0b8
ci: use pip install . instead of setup.py install (pyproject build)
benjaminpope Nov 4, 2025
b494b38
ci: use native Python arch on macOS-14 (remove architecture: x64)
benjaminpope Nov 4, 2025
dcb5349
ci: unify all workflows to Python 3.12 (CI, tests, docs)
benjaminpope Nov 4, 2025
e56d337
tests: skip JAX-specific tests when jax is not installed (importorskip)
benjaminpope Nov 4, 2025
83ddc97
docs: fix theme 'style' context and nbsphinx issues in tutorial\n\n- …
benjaminpope Nov 4, 2025
ce71d38
suggested fixes
benjaminpope Nov 4, 2025
790839d
minimal torch
benjaminpope Nov 4, 2025
5c15e67
docs(mkdocs): migrate from Sphinx to MkDocs\n\n- Add mkdocs.yml with …
benjaminpope Nov 4, 2025
5f242a6
torch is still a problem on mac
benjaminpope Nov 4, 2025
508fd6f
docs(mkdocs): port Sphinx content to Markdown, add logo asset, trigge…
benjaminpope Nov 4, 2025
063d18a
stella logo
benjaminpope Nov 4, 2025
1d86ed1
docs: add Markdown versions of Shortest Demo and Other Features; upda…
benjaminpope Nov 4, 2025
4b4876e
docs: replace Tutorial with Markdown page; ci: run Torch tests on Lin…
benjaminpope Nov 4, 2025
e76b587
remove greetings
benjaminpope Nov 4, 2025
20af64f
docs(ci): run docs workflow on any push/PR to main, feat/**, fix/** (…
benjaminpope Nov 4, 2025
cfe8b7d
Merge pull request #2 from benjaminpope/feat/keras-jax
benjaminpope Nov 4, 2025
fdb161e
fix landing page
benjaminpope Nov 4, 2025
64c9319
Merge pull request #4 from benjaminpope/feat/keras-jax
benjaminpope Nov 4, 2025
1708b03
fix links
benjaminpope Nov 4, 2025
b3dd903
Merge pull request #5 from benjaminpope/feat/keras-jax
benjaminpope Nov 4, 2025
50366cd
docs: render original notebooks in nav (mkdocs-jupyter)
benjaminpope Nov 5, 2025
657871f
docs: exclude Markdown duplicates via mkdocs-exclude; tqdm: use auto …
benjaminpope Nov 6, 2025
676eac5
tqdm: prefer notebook bars and always show single per-model window ba…
benjaminpope Nov 6, 2025
3502e4a
tqdm: revert to tqdm.auto for environment auto-detection; retain two-…
benjaminpope Nov 6, 2025
07776e1
tqdm: use tqdm.autonotebook for thin notebook bars with terminal/HPC …
benjaminpope Nov 6, 2025
d773310
progress: switch to Rich track for outer/inner progress; remove final…
benjaminpope Nov 6, 2025
e4ace0b
Merge pull request #6 from benjaminpope/docs/notebooks-in-nav
benjaminpope Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: stella-ci

on:
push:
branches: [ main, feat/**, fix/** ]
pull_request:

jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
backend: jax
python: '3.12'
- os: ubuntu-latest
backend: torch
python: '3.12'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# macOS-specific gettext step removed; both matrix jobs run on Linux now
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies (base)
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install backend (JAX)
if: matrix.backend == 'jax'
run: |
pip install -r requirements-jax.txt
echo "KERAS_BACKEND=jax" >> $GITHUB_ENV
- name: Install backend (Torch)
if: matrix.backend == 'torch'
run: |
pip install -r requirements-torch.txt
echo "KERAS_BACKEND=torch" >> $GITHUB_ENV
- name: Install package
run: |
python -m pip install --upgrade pip build setuptools wheel
pip install .
- name: Run tests
run: pytest stella/tests -q
20 changes: 0 additions & 20 deletions .github/workflows/docs-page.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy Docs

on:
push:
branches:
- main
- feat/**
- fix/**
pull_request:
branches:
- main
- feat/**
- fix/**
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
python -m pip install mkdocs mkdocs-material mkdocstrings[python] mkdocs-jupyter mkdocs-exclude

- name: Build MkDocs site
run: |
mkdocs build --strict

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
12 changes: 0 additions & 12 deletions .github/workflows/greetings.yml

This file was deleted.

17 changes: 9 additions & 8 deletions .github/workflows/stella-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
name: [3.6, 3.7]
name: [3.12]
include:
- name: 3.6
python-version: 3.6
pytest-command: poetry run pytest
- name: 3.7
python-version: 3.7
- name: 3.12
python-version: 3.12
pytest-command: poetry run pytest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install package and dev deps (with JAX)
run: |
python -m pip install --upgrade setuptools wheel
python -m pip install -e ".[dev,jax]"
- name: Test with pytest
run: |
pytest --doctest-modules --cov=com --cov-report=xml --cov-report=html
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
mastDownload/
stella/mastDownload/
*.fits
__pycache__
*/__pycache__
*/*/__pycache__
Expand All @@ -16,3 +19,8 @@ dist
*.cppimporthash
.rendered.*
*.egg-info

## Local examples and helpers (not part of package)
notebooks/jax_keras.ipynb
scripts/
site/
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
name: black (python formatter)
language_version: python3
types: [python]
additional_dependencies: []
33 changes: 13 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
dist: xenial
dist: focal

language: python
python: 3.7

matrix:
include:
- os: linux
python: 3.10
env: BACKEND=jax
- os: osx
language: shell
env: BACKEND=torch PYTHON=3.10

addons:
apt_packages:
Expand All @@ -14,26 +18,15 @@ addons:
cache: pip

before_install:
- sudo apt-get install python3-pip
- sudo pip3 install requests
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install -y python3-pip; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo pip3 install requests; fi

install:
- pip install tornado
- pip install tensorflow>2.1.0
- pip install scipy!=1.4.1
- pip install lightkurve
- pip install astropy
- pip install astroquery
- pip install tqdm
- pip install sphinx
- pip install nbsphinx
- pip install cython
- pip install codecov
- pip install coverage
- pip install pytest
- pip install pytest-cov
- pip install lxml
- pip install pybind11
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then python3 -m pip install --upgrade pip; else pip install --upgrade pip; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then python3 -m pip install -r requirements.txt; else pip install -r requirements.txt; fi
- if [ "$BACKEND" = "jax" ]; then pip install -r requirements-jax.txt; export KERAS_BACKEND=jax; fi
- if [ "$BACKEND" = "torch" ]; then python3 -m pip install -r requirements-torch.txt; export KERAS_BACKEND=torch; fi
- pip install sphinx nbsphinx
- python setup.py install

script:
Expand Down
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<a href="https://afeinstein20.github.io/stella/"><img src="https://img.shields.io/badge/read-the_docs-3C1370.svg?style=flat"/></a>
<a href="https://pypi.org/project/stella"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/stella?color=D35968"></a>
<a href="https://doi.org/10.21105/joss.02347"> <img src="https://joss.theoj.org/papers/10.21105/joss.02347/status.svg?color=D35968"></a>
<!-- Fork-specific docs status -->
<a href="https://github.com/benjaminpope/stella/actions/workflows/docs.yml"><img src="https://github.com/benjaminpope/stella/actions/workflows/docs.yml/badge.svg" alt="Docs Deploy"></a>
<a href="https://benjaminpope.github.io/stella/"><img src="https://img.shields.io/badge/docs-fork_pages-3C1370.svg?style=flat" alt="GitHub Pages"></a>
</p>


Expand All @@ -29,6 +32,52 @@ Alternatively you can install the current development version of stella:
cd stella
python setup.py install

Backends and models
-------------------
- stella uses Keras Core and works with multiple backends: JAX or PyTorch. Choose one, install, and set it before importing `keras`:

```bash
# JAX
pip install -r requirements-jax.txt
export KERAS_BACKEND=jax

# or PyTorch
pip install -r requirements-torch.txt
export KERAS_BACKEND=torch
```

Models are saved/loaded in the native Keras format (`.keras`). If you have older `.h5`
or legacy SavedModel models, use the included converter:

```bash
# Convert .h5 or legacy SavedModel to .keras (TensorFlow backend only for conversion)
python scripts/convert_h5_to_keras.py /path/to/models -r --cadences 350 -o /path/to/out
```

Pipeline quickstart
-------------------
- See the new pipeline guide for a friendly, end-to-end example (TIC 62124646):
https://afeinstein20.github.io/stella/getting_started/pipeline.html

Swap backends quickly
---------------------
- Inspect availability and devices:

```python
import stella
stella.check_backend()
```

- Prepare a swap (restart your interpreter after):

```python
import stella
stella.swap_backend('torch', accelerator='mps') # Apple Silicon
# or
stella.swap_backend('jax', accelerator='cpu')
```
```

<p>
If your work uses the stella software, please cite <a href="https://ui.adsabs.harvard.edu/abs/2020JOSS....5.2347F/abstract">Feinstein, Montet, & Ansdell (2020)</a>.
</p>
Expand Down
3 changes: 3 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API Reference

::: stella
Binary file added docs/assets/stella_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,7 @@
if not on_rtd: # only import and set the theme if we're building docs locally
html_theme = 'sphinx_rtd_theme'
html_theme_path = ['.',]

# Ensure theme templates have a default 'style' context to avoid Jinja errors
html_context = globals().get('html_context', {})
html_context.setdefault('style', 'default')
11 changes: 11 additions & 0 deletions docs/getting_started/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# About stella

stella identifies flares in TESS short‑cadence data with a convolutional neural network (CNN).

In its simplest form, stella takes a pre‑trained CNN (details in Feinstein et al.) and a light curve `(time, flux, flux_err)` and returns a probability light curve. Values are between 0 and 1, where 1 indicates a likely flare.

You can also train your own customized CNN architecture. See the Quickstart tutorial for a walkthrough.

Links:
- Paper: Feinstein, Montet, & Ansdell (2020, JOSS)
- Issues: https://github.com/benjaminpope/stella/issues
49 changes: 49 additions & 0 deletions docs/getting_started/backends.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Backends (JAX and PyTorch)

stella uses Keras 3, which can run on multiple numerical backends. You can use either the JAX or the PyTorch backend with the same stella code.

Quick facts
-----------
- Select backend via the environment variable `KERAS_BACKEND` before importing `keras`.
- The stella code is backend‑agnostic; no changes are required besides selecting the backend and installing the backend packages.

Setup: JAX
-----------

```bash
pip install -U keras jax jaxlib
export KERAS_BACKEND=jax
```

Setup: PyTorch
--------------

```bash
pip install -U keras torch
export KERAS_BACKEND=torch
```

Usage is identical
------------------

```python
import os
os.environ.setdefault("KERAS_BACKEND", "jax") # or "torch"
import keras
m = keras.models.load_model("/path/to/model.keras", compile=False)
y = m.predict(x)
```

Troubleshooting
---------------
- If you see a backend mismatch, ensure `KERAS_BACKEND` is set before any import of `keras` occurs in your Python process.
- Some ops or layers may have different performance characteristics across backends.

Inspect, swap, and benchmark
----------------------------

```python
import stella
stella.check_backend()
stella.swap_backend('torch', accelerator='mps') # prepare env for PyTorch Metal
```
Loading