diff --git a/README.md b/README.md index e277bc11..b49f9e00 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/docs/api-coverage.rst b/docs/api-coverage.rst index 0fe64485..30250d28 100644 --- a/docs/api-coverage.rst +++ b/docs/api-coverage.rst @@ -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. diff --git a/docs/conf.py b/docs/conf.py index 1c4c31a6..8f7ee2e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,6 +10,15 @@ 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 @@ -17,7 +26,7 @@ project = "JAX-GalSim" author = "GalSim Developers" -copyright = "2023, GalSim Developers" +copyright = "2026, GalSim Developers" try: from jax_galsim._version import version as release diff --git a/scripts/update_api_coverage.py b/docs/update_api_coverage.py similarity index 71% rename from scripts/update_api_coverage.py rename to docs/update_api_coverage.py index c48560f8..58822f6c 100644 --- a/scripts/update_api_coverage.py +++ b/docs/update_api_coverage.py @@ -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__ @@ -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("\n") - end = lines.index("\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("
\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("
\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) @@ -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) diff --git a/docs/versioning.rst b/docs/versioning.rst index 62e2e564..544a9955 100644 --- a/docs/versioning.rst +++ b/docs/versioning.rst @@ -1,6 +1,11 @@ Versioning and API Policy ---------------------------- +------------------------- -JAX-GalSim follows `Calver `_ with a version number ``YYYY.MM.MICRO`` with ``MICRO`` resetting to ``0`` at the start of each month. +``JAX-GalSim`` follows `Calver `_ 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.