diff --git a/.gitignore b/.gitignore index 30010a7..51b262d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +# docs +docs/_build +docs/api +!docs/_static/*.png + +pyvisgen/_version_cache.py +pyvisgen/_version.py + #slurm *.slurm *.log diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..5b16ce9 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,18 @@ +version: 2 + +build: + os: ubuntu-24.04 + apt_packages: + - graphviz + tools: + python: "3.10" + +python: + install: + - method: pip + path: . + extra_requirements: + - docs + +sphinx: + configuration: docs/conf.py diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_static/favicon/favicon.ico b/docs/_static/favicon/favicon.ico new file mode 100755 index 0000000..efcd29d Binary files /dev/null and b/docs/_static/favicon/favicon.ico differ diff --git a/docs/_static/pyvisgen.css b/docs/_static/pyvisgen.css new file mode 100644 index 0000000..eadf40b --- /dev/null +++ b/docs/_static/pyvisgen.css @@ -0,0 +1,221 @@ +@import url('https://fonts.googleapis.com/css?family=Open+Sans:700|Open+Sans:400'); +@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&display=swap'); + + +:root[data-theme="light"] { + --pst-color-text: #090704; + --pst-color-background: #f5f5f5; + --pst-color-on-background: #ffffff; + --pst-color-primary: #52ba66; + --pst-color-secondary: #325e8d; + --pst-color-primary-highlight: #6EC87F; + --pst-color-secondary-highlight: #547cae; + --pst-color-inline-code: var(--pst-color-primary-highlight); + --bd-header-announcement-color: var(--pst-color-background); + --bd-header-announcement-background: var(--pst-color-primary); + --table-hover-background: var(--pst-color-primary-highlight); + --hl-pre-code-background: var(--pst-color-background); +} +:root[data-theme="dark"] { + --pst-color-text: #faf8f4; + --pst-color-background: #181f28; + --pst-color-on-background: #222832; + --pst-color-primary: #52ba66; + --pst-color-secondary: #b8dc2e; + --pst-color-primary-highlight: #83c39c; + --pst-color-secondary-highlight: #ece520; + --pst-color-inline-code: var(--pst-color-primary-highlight); + --bd-header-announcement-color: var(--pst-color-background); + --bd-header-announcement-background: var(--pst-color-primary-highlight); + --table-hover-background: #279544; + --hl-pre-code-background: var(--pst-color-background); +} + + +body { + font-family: 'Open Sans'; + font-weight: 400; +} + +:root { + --pst-font-family-monospace: "Fira Mono"; +} + + +h1, h2, h3, h4, h5 { +font-family: 'Open Sans'; + font-weight: 700; +} + +html {font-size: 100%;} /* 16px */ + +h1 { + font-size: 2.489rem; + background-image: -webkit-gradient( + linear, + left top, + right top, + color-stop(0.03, var(--pst-color-primary)), + color-stop(0.40, var(--pst-color-secondary)), + color-stop(0.97, var(--pst-color-primary-highlight)) +); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +h1 .docutils { + -webkit-text-fill-color: var(--pst-color-inline-code); +} + +h2 {font-size: 2.074rem; /* 33.12px */} + +h3 {font-size: 1.728rem; /* 27.68px */} + +h4 {font-size: 1.440rem; /* 23.04px */} + +h5 {font-size: 1.200rem; /* 19.2px */} + +small {font-size: 0.833rem; /* 13.28px */} + +dt:target { + background-color: var(--pst-color-surface); + border-radius: 10px; + padding: 5px 5px 5px 5px; +} + +/* code blocks */ +div.highlight { + background-color: var(--hl-pre-code-background) !important; +} +.highlight pre { + border-radius: 20px; + background-color: var(--pst-color-on-background); +} +.highlight pre .gp { + color: var(--pst-color-primary); +} + +.bd-header-announcement { + color: var(--bd-header-announcement-color); + background-color: var(--bd-header-announcement-background); +} + +.admonition { + border-radius: 10px !important; +} + +/* sphinx-design */ +.sd-card { + background-color: var(--pst-color-on-background); + border-radius: 10px; + padding: 30px 10px 20px 10px; + margin: 10px 0px; +} + +.sd-card .sd-card-header .sd-card-text { + margin: 0px; +} + +.sd-card .sd-card-header { + border: none; + text-align: center; + font-size: var(--pst-font-size-h4); + font-weight: bold; + padding: 0.5rem 0rem 0.5rem 0rem; +} + +.sd-card .sd-card-footer { + border: none; +} + +.sd-card .sd-card-footer .sd-card-text { + max-width: 220px; + margin-left: auto; + margin-right: auto; +} + +.sd-card .sd-btn { + border-radius: 20px; +} + +.sd-card:hover { + border-color: var(--pst-color-secondary); + transform: scale(1.05); + -webkit-transition: all .2s; + -moz-transition: all .2s; + transition: all .2s; +} + +.sd-card .sd-btn:hover { + -webkit-animation: pulse 2s infinite; + animation: pulse512 1.5s infinite; + background-size: 200% auto; +} + +.search-button-field:hover { + border-color: var(--pst-color-primary-highlight); + border-width: 2pt; + -webkit-animation: pulse 2s infinite; + animation: pulse512 1.5s infinite; + background-size: 200% auto; +} + +@keyframes pulse512 { + 0% { + box-shadow: 0 0 0 0 var(--pst-color-primary-highlight); + } + + 70% { + box-shadow: 0 0 0 10px rgb(255 255 255 / 0%); + } + + 100% { + box-shadow: 0 0 0 0 rgb(255 255 255 / 0%); + } +} + +/* sphinx gallery */ +.sphx-glr-thumbcontainer { + border-radius: 10px; + transition: 0.3s; + border-color: var(--pst-color-primary); +} + +.sphx-glr-thumbcontainer:hover { + border-color: var(--pst-color-secondary); + transform: scale(1.05); +} + +.sphx-glr-thumbcontainer::after { + border-radius: 10px !important; +} + +.reference.download.internal { + --pst-color-inline-code-links: white; + background-color: var(--pst-color-primary); + background-image: none !important; + border-radius: 40px; +} + +.reference.download.internal::before { + color: white; + text-decoration: none; +} + +.reference.download.internal:hover { + background-color: var(--pst-color-secondary) !important; + transition: 0.3s; + -webkit-animation: pulse 2s infinite; + animation: pulse512 1.5s infinite; + background-size: 200% auto; +} + +/* tables */ +.table tbody tr:hover td, .table tbody tr:hover th { + background: var(--table-hover-background) !important; +} + +/* buttons */ +#pst-back-to-top: { + background-color: var(--pst-color-secondary-highlight); +} diff --git a/docs/_static/pyvisgen.webp b/docs/_static/pyvisgen.webp new file mode 100755 index 0000000..58582e6 Binary files /dev/null and b/docs/_static/pyvisgen.webp differ diff --git a/docs/_static/pyvisgen_dark.webp b/docs/_static/pyvisgen_dark.webp new file mode 100755 index 0000000..f95e7e4 Binary files /dev/null and b/docs/_static/pyvisgen_dark.webp differ diff --git a/docs/_templates/base.rst b/docs/_templates/base.rst new file mode 100644 index 0000000..1621719 --- /dev/null +++ b/docs/_templates/base.rst @@ -0,0 +1,2 @@ +{% extends "autosummary_core/base.rst" %} +{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} diff --git a/docs/_templates/class.rst b/docs/_templates/class.rst new file mode 100644 index 0000000..0fa59f2 --- /dev/null +++ b/docs/_templates/class.rst @@ -0,0 +1,2 @@ +{% extends "autosummary_core/class.rst" %} +{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} diff --git a/docs/_templates/module.rst b/docs/_templates/module.rst new file mode 100644 index 0000000..230cd6e --- /dev/null +++ b/docs/_templates/module.rst @@ -0,0 +1,2 @@ +{% extends "autosummary_core/module.rst" %} +{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} diff --git a/docs/api-reference/fits/data.rst b/docs/api-reference/fits/data.rst new file mode 100644 index 0000000..6d9ae7a --- /dev/null +++ b/docs/api-reference/fits/data.rst @@ -0,0 +1,16 @@ +.. _data: + +******************************** +Data (:mod:`pyvisgen.fits.data`) +******************************** + +.. currentmodule:: pyvisgen.fits.data + +Data submodule of :mod:`pyvisgen.fits`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.fits.data + :inherited-members: diff --git a/docs/api-reference/fits/index.rst b/docs/api-reference/fits/index.rst new file mode 100644 index 0000000..de2e08e --- /dev/null +++ b/docs/api-reference/fits/index.rst @@ -0,0 +1,31 @@ +.. _fits: + +*********************************** +FITS Handler (:mod:`pyvisgen.fits`) +*********************************** + +.. currentmodule:: pyvisgen.fits + + +Introduction +============ + +This module include all the functions and classes needed for handling FITS files. + + +Submodules +========== + +.. toctree:: + :maxdepth: 1 + :glob: + + data + writer + + +Reference/API +============= + +.. automodapi:: pyvisgen.fits + :no-inheritance-diagram: diff --git a/docs/api-reference/fits/writer.rst b/docs/api-reference/fits/writer.rst new file mode 100644 index 0000000..931673d --- /dev/null +++ b/docs/api-reference/fits/writer.rst @@ -0,0 +1,16 @@ +.. _writer: + +***************************************** +FITS Writer (:mod:`pyvisgen.fits.writer`) +***************************************** + +.. currentmodule:: pyvisgen.fits.writer + +FITS writer submodule of :mod:`pyvisgen.fits`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.fits.writer + :inherited-members: diff --git a/docs/api-reference/gridding/index.rst b/docs/api-reference/gridding/index.rst new file mode 100644 index 0000000..ba07831 --- /dev/null +++ b/docs/api-reference/gridding/index.rst @@ -0,0 +1,16 @@ +.. _gridding: + +*********************************** +Gridding (:mod:`pyvisgen.gridding`) +*********************************** + +.. currentmodule:: pyvisgen.gridding + +Gridding module of pyvisgen. + + +Reference/API +============= + +.. automodapi:: pyvisgen.gridding + :inherited-members: diff --git a/docs/api-reference/index.rst b/docs/api-reference/index.rst new file mode 100644 index 0000000..f22811f --- /dev/null +++ b/docs/api-reference/index.rst @@ -0,0 +1,9 @@ +************* +API Reference +************* + +.. toctree:: + :maxdepth: 1 + :glob: + + */index diff --git a/docs/api-reference/layouts/index.rst b/docs/api-reference/layouts/index.rst new file mode 100644 index 0000000..3fc719b --- /dev/null +++ b/docs/api-reference/layouts/index.rst @@ -0,0 +1,16 @@ +.. _layouts: + +********************************* +Layouts (:mod:`pyvisgen.layouts`) +********************************* + +.. currentmodule:: pyvisgen.layouts + +Layouts module of pyvisgen. + + +Reference/API +============= + +.. automodapi:: pyvisgen.layouts + :inherited-members: diff --git a/docs/api-reference/simulation/array.rst b/docs/api-reference/simulation/array.rst new file mode 100644 index 0000000..d71723b --- /dev/null +++ b/docs/api-reference/simulation/array.rst @@ -0,0 +1,16 @@ +.. array: + +**************************************** +Array (:mod:`pyvisgen.simulation.array`) +**************************************** + +.. currentmodule:: pyvisgen.simulation.array + +Scan submodule of :mod:`pyvisgen.simulation`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.simulation.array + :inherited-members: diff --git a/docs/api-reference/simulation/data_set.rst b/docs/api-reference/simulation/data_set.rst new file mode 100644 index 0000000..741a63f --- /dev/null +++ b/docs/api-reference/simulation/data_set.rst @@ -0,0 +1,16 @@ +.. _data_set: + +********************************************** +Data Set (:mod:`pyvisgen.simulation.data_set`) +********************************************** + +.. currentmodule:: pyvisgen.simulation.visibility + +Data set submodule of :mod:`pyvisgen.simulation`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.simulation.data_set + :inherited-members: diff --git a/docs/api-reference/simulation/index.rst b/docs/api-reference/simulation/index.rst new file mode 100644 index 0000000..837daf6 --- /dev/null +++ b/docs/api-reference/simulation/index.rst @@ -0,0 +1,34 @@ +.. _simulation: + +*************************************** +Simulation (:mod:`pyvisgen.simulation`) +*************************************** + +.. currentmodule:: pyvisgen.simulation + + +Introduction +============ + +This module include all the functions and classes needed for the simulation of an observation. + + +Submodules +========== + +.. toctree:: + :maxdepth: 1 + :glob: + + array + data_set + observation + scan + visibility + + +Reference/API +============= + +.. automodapi:: pyvisgen.simulation + :no-inheritance-diagram: diff --git a/docs/api-reference/simulation/observation.rst b/docs/api-reference/simulation/observation.rst new file mode 100644 index 0000000..bda3eed --- /dev/null +++ b/docs/api-reference/simulation/observation.rst @@ -0,0 +1,16 @@ +.. _observation: + +**************************************************** +Observation (:mod:`pyvisgen.simulation.observation`) +**************************************************** + +.. currentmodule:: pyvisgen.simulation.observation + +Observation submodule of pyvisgen. + + +Reference/API +============= + +.. automodapi:: pyvisgen.simulation.observation + :inherited-members: diff --git a/docs/api-reference/simulation/scan.rst b/docs/api-reference/simulation/scan.rst new file mode 100644 index 0000000..97ad498 --- /dev/null +++ b/docs/api-reference/simulation/scan.rst @@ -0,0 +1,16 @@ +.. scan: + +************************************** +Scan (:mod:`pyvisgen.simulation.scan`) +************************************** + +.. currentmodule:: pyvisgen.simulation.scan + +Scan submodule of :mod:`pyvisgen.simulation`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.simulation.scan + :inherited-members: diff --git a/docs/api-reference/simulation/visibility.rst b/docs/api-reference/simulation/visibility.rst new file mode 100644 index 0000000..25a0474 --- /dev/null +++ b/docs/api-reference/simulation/visibility.rst @@ -0,0 +1,16 @@ +.. _visibility: + +************************************************** +Visibility (:mod:`pyvisgen.simulation.visibility`) +************************************************** + +.. currentmodule:: pyvisgen.simulation.visibility + +Visibility simulation submodule of :mod:`pyvisgen.simulation`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.simulation.visibility + :inherited-members: diff --git a/docs/api-reference/utils/config.rst b/docs/api-reference/utils/config.rst new file mode 100644 index 0000000..4d66dc4 --- /dev/null +++ b/docs/api-reference/utils/config.rst @@ -0,0 +1,16 @@ +.. _utils_config: + +************************************* +Config (:mod:`pyvisgen.utils.config`) +************************************* + +.. currentmodule:: pyvisgen.utils.config + +Config utility submodule of :mod:`pyvisgen.utils`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.utils.config + :inherited-members: diff --git a/docs/api-reference/utils/data.rst b/docs/api-reference/utils/data.rst new file mode 100644 index 0000000..a7bf249 --- /dev/null +++ b/docs/api-reference/utils/data.rst @@ -0,0 +1,16 @@ +.. _utils_data: + +********************************* +Data (:mod:`pyvisgen.utils.data`) +********************************* + +.. currentmodule:: pyvisgen.utils.data + +Data utility submodule of :mod:`pyvisgen.utils`. + + +Reference/API +============= + +.. automodapi:: pyvisgen.utils.data + :inherited-members: diff --git a/docs/api-reference/utils/index.rst b/docs/api-reference/utils/index.rst new file mode 100644 index 0000000..915bbdb --- /dev/null +++ b/docs/api-reference/utils/index.rst @@ -0,0 +1,31 @@ +.. _utils: + +***************************** +Utils (:mod:`pyvisgen.utils`) +***************************** + +.. currentmodule:: pyvisgen.utils + + +Introduction +============ + +This module contains utility functions. + + +Submodules +========== + +.. toctree:: + :maxdepth: 1 + :glob: + + config + data + + +Reference/API +============= + +.. automodapi:: pyvisgen.utils + :no-inheritance-diagram: diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..2120f07 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,5 @@ +********** +Change Log +********** + +.. include:: ../CHANGES.rst diff --git a/docs/changes/47.feature.rst b/docs/changes/47.feature.rst new file mode 100644 index 0000000..cf47768 --- /dev/null +++ b/docs/changes/47.feature.rst @@ -0,0 +1 @@ +- Add docs diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..2c0f945 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +import datetime +import sys +from pathlib import Path + +import pyvisgen + +if sys.version_info < (3, 11): + import tomli as tomllib +else: + import tomllib + +pyproject_path = Path(__file__).parent.parent / "pyproject.toml" +pyproject = tomllib.loads(pyproject_path.read_text()) + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.viewcode", + "sphinx_automodapi.automodapi", + "sphinx_automodapi.smart_resolver", + "matplotlib.sphinxext.plot_directive", + "numpydoc", + "sphinx_design", + "IPython.sphinxext.ipython_console_highlighting", + "sphinx_copybutton", +] + +numpydoc_show_class_members = False +numpydoc_class_members_toctree = False + +templates_path = ["_templates"] +exclude_patterns = [ + "_build", + "Thumbs.db", + ".DS_Store", + "changes", + "*.log", +] + +source_suffix = ".rst" +master_doc = "index" + + +project = pyproject["project"]["name"] +author = pyproject["project"]["authors"][0]["name"] +copyright = "{}. Last updated {}".format( + author, datetime.datetime.now().strftime("%d %b %Y %H:%M") +) +python_requires = pyproject["project"]["requires-python"] + +# make some variables available to each page +rst_epilog = f""" +.. |python_requires| replace:: {python_requires} +""" + + +version = pyvisgen.__version__ +# The full version, including alpha/beta/rc tags. +release = version + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "pydata_sphinx_theme" +html_static_path = ["_static"] + +html_file_suffix = ".html" + +html_css_files = ["pyvisgen.css"] + +html_favicon = "_static/favicon/favicon.ico" + +html_theme_options = { + "github_url": "https://github.com/radionets-project/pyvisgen", + "header_links_before_dropdown": 5, + "navbar_start": ["navbar-logo"], + "navigation_with_keys": False, + # "use_edit_page_button": True, + "icon_links_label": "Quick Links", + "icon_links": [ + { + "name": "Radionets Project", + "url": "https://github.com/radionets-project", + "type": "url", + "icon": "https://avatars.githubusercontent.com/u/77392854?s=200&v=4", # noqa: E501 + }, + ], + "logo": { + "image_light": "_static/pyvisgen.webp", + "image_dark": "_static/pyvisgen_dark.webp", + "alt_text": "pyvisgen", + }, + "announcement": """ +
pyvisgen is not stable yet, so expect large and rapid + changes to structure and functionality as we explore various + design choices before the 1.0 release.
+ """, +} + +html_title = f"{project}: Visibility Simulations in Python" +htmlhelp_basename = project + "docs" + + +# Configuration for intersphinx +intersphinx_mapping = { + "astropy": ("https://docs.astropy.org/en/stable", None), + "ipywidgets": ("https://ipywidgets.readthedocs.io/en/stable", None), + "joblib": ("https://joblib.readthedocs.io/en/stable", None), + "matplotlib": ("https://matplotlib.org/stable", None), + "numba": ("https://numba.readthedocs.io/en/stable", None), + "numpy": ("https://numpy.org/doc/stable", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None), + "pytest": ("https://docs.pytest.org/en/stable", None), + "python": ("https://docs.python.org/3", None), + "scipy": ("https://docs.scipy.org/doc/scipy", None), + "setuptools": ("https://setuptools.pypa.io/en/stable", None), + "sklearn": ("https://scikit-learn.org/stable", None), + "torch": ("https://pytorch.org/docs/stable/", None), +} + + +suppress_warnings = [ + "intersphinx.external", +] diff --git a/docs/developer-guide/getting-started.rst b/docs/developer-guide/getting-started.rst new file mode 100644 index 0000000..a73e4a3 --- /dev/null +++ b/docs/developer-guide/getting-started.rst @@ -0,0 +1,51 @@ +.. _getting_started_dev: + +****************************** +Getting Started for Developers +****************************** + +We strongly recommend using the `Miniforge3 conda distribution