WIP: Add documentation site with Material for MkDocs#204
Conversation
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]>
Merging this PR will not alter performance
|
|
|
||
| ## Supported APIs | ||
|
|
||
| ??? note "Click to expand the full list of implemented APIs" |
There was a problem hiding this comment.
Is this AI slop or actual markdown.
There was a problem hiding this comment.
I think it's actually syntax from the admonition plugin? https://squidfunk.github.io/mkdocs-material/reference/admonitions/#collapsible-blocks
ismael-mendoza
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
This feels like it should be in a different section, also again like above not sure if it's true in all cases.
| ```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) | ||
| ``` |
There was a problem hiding this comment.
this does not work without setting the gsparams with fft_size and specifying the size of the image to draw
| ```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) | ||
| ``` |
There was a problem hiding this comment.
this example also requires specifying the gsparams
| 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() |
There was a problem hiding this comment.
need to specify fft_size and image size explicitly for jiiting to work
| ```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() |
There was a problem hiding this comment.
this example will not work either, see other comments
| @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 |
There was a problem hiding this comment.
this example also won't work, need gsparams
|
|
||
| ```python | ||
| noise = jax_galsim.GaussianNoise(sigma=30.0) | ||
| image = image.addNoise(noise) # state is managed internally |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
add noise does not return a new object, it modifies it in place like the OG
Summary
What's included
jit/grad/vmapexamples@implementsdecorator.github/workflows/docs.yml):mkdocs build --stricton PRs,mkdocs gh-deployon push to mainKnown limitations
@implementsdecorator 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.🤖 Generated with Claude Code