Skip to content

WIP: Add documentation site with Material for MkDocs#204

Draft
EiffL wants to merge 4 commits intomainfrom
documentation
Draft

WIP: Add documentation site with Material for MkDocs#204
EiffL wants to merge 4 commits intomainfrom
documentation

Conversation

@EiffL
Copy link
Member

@EiffL EiffL commented Feb 20, 2026

Summary

  • Adds a full documentation site using Material for MkDocs with mkdocstrings for auto-generated API reference from docstrings
  • Includes getting started guides (installation, quick start), notable differences from GalSim, API coverage page, and complete API reference stubs for all implemented modules
  • Adds GitHub Actions workflow for building docs on PRs and deploying to GitHub Pages on push to main

What's included

  • Home page with feature highlights, quick install, and minimal code example
  • Getting Started section: installation (pip, GPU, dev setup) and quick start tutorial with jit/grad/vmap examples
  • Notable Differences from GalSim: thorough guide covering immutability, array views, RNG, PyTree registration, control flow/tracing, profile restrictions, numerical precision, and the @implements decorator
  • API Coverage page (22.5% of GalSim API)
  • API Reference (~30 pages) auto-generated from docstrings via mkdocstrings
  • CI workflow (.github/workflows/docs.yml): mkdocs build --strict on PRs, mkdocs gh-deploy on push to main

Known limitations

  • API function documentation is incomplete — the @implements decorator copies GalSim's docstrings at runtime, but mkdocstrings doesn't always pick them up cleanly. RST cross-references (:func:, :class:) from GalSim's docstrings render as literal text rather than links.
  • Some API pages show minimal content where docstring propagation from GalSim didn't work as expected.

🤖 Generated with Claude Code

EiffL and others added 3 commits February 20, 2026 17:52
Set up full documentation infrastructure with auto-generated API reference
from docstrings, narrative guides, and GitHub Pages deployment via CI.

- Add mkdocs-material and mkdocstrings[python] as docs dependencies
- Create mkdocs.yml with Material theme, left sidebar nav, Mermaid, MathJax
- Add narrative pages: home, getting started, architecture, notable differences
- Add API reference stubs for all public modules targeting specific classes
- Add GitHub Actions workflow for build on PR / deploy on push to main

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove duplicated explanations, tighten prose, and condense sections
that repeated information already covered on other pages. Net reduction
of ~80 lines with no content loss -- cross-links replace duplication.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove the architecture/ pages (pytree, implements, gsobject, drawing)
and key-concepts page. Consolidate their most useful content into
notable-differences.md, which now thoroughly covers immutability, array
views, RNG, PyTree registration, control flow/tracing, profile
restrictions, numerical precision, and the @implements decorator.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@EiffL EiffL changed the title Add documentation site with Material for MkDocs WIP: Add documentation site with Material for MkDocs Feb 20, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 20, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 36 untouched benchmarks


Comparing documentation (5b2c943) with main (d2f2d94)

Open in CodSpeed


## Supported APIs

??? note "Click to expand the full list of implemented APIs"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this AI slop or actual markdown.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's actually syntax from the admonition plugin? https://squidfunk.github.io/mkdocs-material/reference/admonitions/#collapsible-blocks

Copy link
Collaborator

@ismael-mendoza ismael-mendoza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I flagged a couple of cases in the examples provided that don't actually work. @EiffL could you modify as needed?

image.array[10, 10] = 0.0

# JAX-GalSim — returns a new image each time
image = image.addNoise(noise)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this actually the case? looking at the addNoise methods in noise.py, I don't think they return the image object.

sequences differ from GalSim. Results will not match GalSim number-for-number.
This is expected --- the underlying PRNG algorithms are completely different.

**No in-place fill**: GalSim deviates can "fill" existing arrays. JAX deviates
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should be in a different section, also again like above not sure if it's true in all cases.

Comment on lines +42 to +54
```python
import jax

@jax.jit
def simulate(flux, sigma):
gal = jax_galsim.Gaussian(flux=flux, sigma=sigma)
psf = jax_galsim.Gaussian(flux=1.0, sigma=1.0)
final = jax_galsim.Convolve([gal, psf])
return final.drawImage(scale=0.2)

# First call compiles; subsequent calls are fast
image = simulate(1e5, 2.0)
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not work without setting the gsparams with fft_size and specifying the size of the image to draw

Comment on lines +79 to +93
```python
import jax.numpy as jnp

sigmas = jnp.linspace(1.0, 4.0, 10)

@jax.vmap
def batch_simulate(sigma):
gal = jax_galsim.Gaussian(flux=1e5, sigma=sigma)
psf = jax_galsim.Gaussian(flux=1.0, sigma=1.0)
final = jax_galsim.Convolve([gal, psf])
return final.drawImage(scale=0.2, nx=64, ny=64).array

# Simulate all 10 galaxies in parallel
images = batch_simulate(sigmas) # shape: (10, 64, 64)
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example also requires specifying the gsparams

Comment on lines +63 to +66
def simulate(flux, sigma):
gal = jax_galsim.Gaussian(flux=flux, sigma=sigma)
psf = jax_galsim.Gaussian(flux=1.0, sigma=1.0)
return jax_galsim.Convolve([gal, psf]).drawImage(scale=0.2).array.sum()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to specify fft_size and image size explicitly for jiiting to work

Comment on lines +104 to +112
```python
import jax

gsparams = jax_galsim.GSParams(maximum_fft_size=8192)

@jax.jit
def simulate(flux, sigma):
gal = jax_galsim.Gaussian(flux=flux, sigma=sigma, gsparams=gsparams)
return gal.drawImage(scale=0.2).array.sum()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example will not work either, see other comments

Comment on lines +153 to +157
@jax.vmap
def batch(sigma):
gal = jax_galsim.Gaussian(flux=1e5, sigma=sigma)
# Must specify nx, ny so all images have the same shape
return gal.drawImage(scale=0.2, nx=64, ny=64).array
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this example also won't work, need gsparams


```python
noise = jax_galsim.GaussianNoise(sigma=30.0)
image = image.addNoise(noise) # state is managed internally
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addNoise does not actually return a new image object

image = final.drawImage(scale=0.2)

# Add noise
image = image.addNoise(jax_galsim.GaussianNoise(sigma=30.0))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add noise does not return a new object, it modifies it in place like the OG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants