Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ about the inner workings of GalSim and how to code in JAX.

## Current GalSim API Coverage

JAX-GalSim current has implemented **22.5%** of the GalSim API. See the corresponding [documentation page](https://jax-galsim.readthedocs.io/en/latest/api-coverage) for a list of what is currently implemented.
See the corresponding [documentation page](https://jax-galsim.readthedocs.io/en/latest/api-coverage) for a list of what is currently implemented.
129 changes: 3 additions & 126 deletions docs/api-coverage.rst
Original file line number Diff line number Diff line change
@@ -1,132 +1,9 @@
API Coverage
============

JAX-GalSim has implemented **22.5 %** of the GalSim API. The project focuses on
the most commonly used profiles and operations, with coverage expanding over time.
The project focuses on the most commonly used profiles and operations,
with coverage expanding over time. The list below is updated automatically
when the documentation is built.

Supported APIs
--------------

.. dropdown:: Click to expand the full list of implemented APIs

- ``galsim.Add``
- ``galsim.AffineTransform``
- ``galsim.Angle``
- ``galsim.AngleUnit``
- ``galsim.BaseDeviate``
- ``galsim.BaseNoise``
- ``galsim.BaseWCS``
- ``galsim.BinomialDeviate``
- ``galsim.Bounds``
- ``galsim.BoundsD``
- ``galsim.BoundsI``
- ``galsim.Box``
- ``galsim.CCDNoise``
- ``galsim.CelestialCoord``
- ``galsim.Chi2Deviate``
- ``galsim.Convolution``
- ``galsim.Convolve``
- ``galsim.Cubic``
- ``galsim.Deconvolution``
- ``galsim.Deconvolve``
- ``galsim.Delta``
- ``galsim.DeltaFunction``
- ``galsim.DeviateNoise``
- ``galsim.Exponential``
- ``galsim.FitsHeader``
- ``galsim.FitsWCS``
- ``galsim.GSFitsWCS``
- ``galsim.GSObject``
- ``galsim.GSParams``
- ``galsim.GalSimBoundsError``
- ``galsim.GalSimConfigError``
- ``galsim.GalSimConfigValueError``
- ``galsim.GalSimDeprecationWarning``
- ``galsim.GalSimError``
- ``galsim.GalSimFFTSizeError``
- ``galsim.GalSimHSMError``
- ``galsim.GalSimImmutableError``
- ``galsim.GalSimIncompatibleValuesError``
- ``galsim.GalSimIndexError``
- ``galsim.GalSimKeyError``
- ``galsim.GalSimNotImplementedError``
- ``galsim.GalSimRangeError``
- ``galsim.GalSimSEDError``
- ``galsim.GalSimUndefinedBoundsError``
- ``galsim.GalSimValueError``
- ``galsim.GalSimWarning``
- ``galsim.GammaDeviate``
- ``galsim.Gaussian``
- ``galsim.GaussianDeviate``
- ``galsim.GaussianNoise``
- ``galsim.Image``
- ``galsim.ImageCD``
- ``galsim.ImageCF``
- ``galsim.ImageD``
- ``galsim.ImageF``
- ``galsim.ImageI``
- ``galsim.ImageS``
- ``galsim.ImageUI``
- ``galsim.ImageUS``
- ``galsim.Interpolant``
- ``galsim.InterpolatedImage``
- ``galsim.JacobianWCS``
- ``galsim.Lanczos``
- ``galsim.Linear``
- ``galsim.Moffat``
- ``galsim.Nearest``
- ``galsim.OffsetShearWCS``
- ``galsim.OffsetWCS``
- ``galsim.PhotonArray``
- ``galsim.Pixel``
- ``galsim.PixelScale``
- ``galsim.PoissonDeviate``
- ``galsim.PoissonNoise``
- ``galsim.Position``
- ``galsim.PositionD``
- ``galsim.PositionI``
- ``galsim.Quintic``
- ``galsim.Sensor``
- ``galsim.Shear``
- ``galsim.ShearWCS``
- ``galsim.SincInterpolant``
- ``galsim.Spergel``
- ``galsim.Sum``
- ``galsim.TanWCS``
- ``galsim.Transform``
- ``galsim.Transformation``
- ``galsim.UniformDeviate``
- ``galsim.VariableGaussianNoise``
- ``galsim.WeibullDeviate``
- ``galsim.bessel.j0``
- ``galsim.bessel.kv``
- ``galsim.bessel.si``
- ``galsim.fits.closeHDUList``
- ``galsim.fits.readCube``
- ``galsim.fits.readFile``
- ``galsim.fits.readMulti``
- ``galsim.fits.write``
- ``galsim.fits.writeFile``
- ``galsim.fitswcs.CelestialWCS``
- ``galsim.integ.int1d``
- ``galsim.noise.addNoise``
- ``galsim.noise.addNoiseSNR``
- ``galsim.random.permute``
- ``galsim.utilities.g1g2_to_e1e2``
- ``galsim.utilities.horner``
- ``galsim.utilities.printoptions``
- ``galsim.utilities.unweighted_moments``
- ``galsim.utilities.unweighted_shape``
- ``galsim.wcs.EuclideanWCS``
- ``galsim.wcs.LocalWCS``
- ``galsim.wcs.UniformWCS``

Updating Coverage
-----------------

.. code-block:: bash

python scripts/update_api_coverage.py

Compares GalSim's public API against ``jax_galsim``'s implementations and
updates the coverage percentage and list above.
11 changes: 10 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@
sys.path.insert(0, os.path.abspath(".."))
# Make the custom extension importable.
sys.path.insert(0, os.path.abspath("_ext"))
# Make modules in docs importable.
sys.path.insert(0, os.path.abspath("."))

###########################################
# custom code to update the API coverage
from update_api_coverage import update_api_coverage

update_api_coverage()
###########################################

# ---------------------------------------------------------------------------
# Project information
# ---------------------------------------------------------------------------

project = "JAX-GalSim"
author = "GalSim Developers"
copyright = "2023, GalSim Developers"
copyright = "2026, GalSim Developers"

try:
from jax_galsim._version import version as release
Expand Down
43 changes: 15 additions & 28 deletions scripts/update_api_coverage.py → docs/update_api_coverage.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import inspect

import galsim

import jax_galsim


def _list_all_apis(module, apis=None, seen_modules=None):
import inspect

apis = apis or set()
seen_modules = seen_modules or set()
mname = module.__name__
Expand Down Expand Up @@ -40,36 +35,28 @@ def _list_all_apis(module, apis=None, seen_modules=None):
return apis


def _write_to_readme(missing_apis, jax_galsim_apis, cov_frac):
with open("README.md", "r") as f:
def _write_to_docs(missing_apis, jax_galsim_apis, cov_frac):
with open("api-coverage.rst", "r") as f:
lines = f.readlines()

start = lines.index("<!-- start-api-coverage -->\n")
end = lines.index("<!-- end-api-coverage -->\n")

middle_lines = []
middle_lines.append(
f"JAX-GalSim has implemented {100 * cov_frac:.1f}% of "
"the GalSim API. See the list below for the supported APIs.\n"
)
middle_lines.append("\n")

middle_lines.append("<details>\n")
middle_lines.append("\n")
start = lines.index("Supported APIs\n") + 1

middle_lines = ["\n"]
for api in sorted(jax_galsim_apis):
middle_lines.append(f"- {api}\n")
middle_lines.append(f"- ``{api}``\n")
middle_lines.append("\n")

middle_lines.append("</details>\n")

with open("README.md", "w") as f:
with open("api-coverage.rst", "w") as f:
f.writelines(lines[: start + 1])
f.writelines(middle_lines)
f.writelines(lines[end:])
f.writelines(lines[start + 1 :])


def update_api_coverage():
import galsim

import jax_galsim

if __name__ == "__main__":
galsim_apis = _list_all_apis(galsim)
assert all(api.startswith("galsim.") for api in galsim_apis)

Expand All @@ -85,4 +72,4 @@ def _write_to_readme(missing_apis, jax_galsim_apis, cov_frac):

cov_frac = 1.0 - len(missing_apis) / len(galsim_apis)

_write_to_readme(missing_apis, jax_galsim_apis, cov_frac)
_write_to_docs(missing_apis, jax_galsim_apis, cov_frac)
11 changes: 8 additions & 3 deletions docs/versioning.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Versioning and API Policy
---------------------------
-------------------------

JAX-GalSim follows `Calver <https://calver.org/>`_ with a version number ``YYYY.MM.MICRO`` with ``MICRO`` resetting to ``0`` at the start of each month.
``JAX-GalSim`` follows `Calver <https://calver.org/>`_ with a version number ``YYYY.MM.MICRO``
with ``MICRO`` resetting to ``0`` at the start of each month.

For APIs which are also present in GalSim (e.g., you can import the same thing by substituting galsim for jax_galsim), JAX-GalSim is a strict subset of the GalSim APIs. All other APIs may change without notice for any version part increment. We thus recommend pinning the entire JAX-GalSim version if you use this code in your work.
For APIs which are also present in ``GalSim`` (e.g., you can import the same thing by
substituting ``galsim`` for ``jax_galsim``), ``JAX-GalSim`` is a strict subset of the
``GalSim`` APIs. All other APIs may change without notice for any version part increment.

We thus recommend pinning the entire ``JAX-GalSim`` version if you use this code in your work.
Loading