Skip to content

Commit c46352f

Browse files
committed
add documentation
1 parent c88ede0 commit c46352f

22 files changed

+378
-55
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build-n-publish:
7+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@main
11+
- name: Set up Python 3.8
12+
uses: actions/setup-python@v3
13+
with:
14+
python-version: "3.8"
15+
- name: Install pypa/build
16+
run: >-
17+
python -m
18+
pip install
19+
build
20+
--user
21+
- name: Build a binary wheel and a source tarball
22+
run: >-
23+
python -m
24+
build
25+
--sdist
26+
--wheel
27+
--outdir dist/
28+
.
29+
- name: Publish distribution 📦 to PyPI
30+
if: startsWith(github.ref, 'refs/tags')
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ notebook_testing
66
paper_psf
77
*.pdf
88
*.png
9-
paper/jats
9+
paper/jats
10+
build

docs/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/_static/css/custom.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
html {
2+
--pst-font-size-base: 22px;
3+
}

docs/source/conf.py

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
import toml
16+
sys.path.insert(0, os.path.abspath('../../src'))
17+
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = 'SPECTPSFToolbox'
22+
copyright = '2024, Luke Polson'
23+
author = 'Luke Polson'
24+
25+
# The full version, including alpha/beta/rc tags
26+
with open('../../pyproject.toml', 'r') as f:
27+
release = toml.load(f)['project']['version']
28+
29+
# -- General configuration ---------------------------------------------------
30+
31+
# Add any Sphinx extension module names here, as strings. They can be
32+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33+
# ones.
34+
extensions = [
35+
"myst_parser",
36+
"sphinx.ext.autosectionlabel",
37+
"sphinx.ext.autodoc",
38+
'sphinx.ext.viewcode',
39+
"sphinx.ext.napoleon",
40+
"sphinx_design",
41+
"nbsphinx",
42+
"autoapi.extension",
43+
"IPython.sphinxext.ipython_console_highlighting"
44+
]
45+
46+
# Where to autogen API
47+
autoapi_dirs = ['../../src/spectpsftoolbox']
48+
autoapi_options = [ 'members', 'undoc-members', 'private-members', 'show-inheritance', 'show-module-summary', 'special-members', 'imported-members', 'recursive']
49+
autoapi_template_dir = "_templates/autoapi"
50+
51+
# Add any paths that contain templates here, relative to this directory.
52+
templates_path = ['_templates']
53+
54+
# List of patterns, relative to source directory, that match files and
55+
# directories to ignore when looking for source files.
56+
# This pattern also affects html_static_path and html_extra_path.
57+
exclude_patterns = []
58+
59+
60+
# -- Options for HTML output -------------------------------------------------
61+
62+
# The theme to use for HTML and HTML Help pages. See the documentation for
63+
# a list of builtin themes.
64+
#
65+
html_theme = 'pydata_sphinx_theme'
66+
#html_logo = 'images/PT1.png'
67+
68+
# Add any paths that contain custom static files (such as style sheets) here,
69+
# relative to this directory. They are copied after the builtin static files,
70+
# so a file named "default.css" will overwrite the builtin "default.css".
71+
html_static_path = ['_static']
72+
html_css_files = [
73+
'css/custom.css',
74+
]
75+
76+
# typehints
77+
autodoc_typehints = "description"
78+
autodoc_inherit_docstrings=True
79+
80+
# Add link to github
81+
html_theme_options = {
82+
"icon_links": [
83+
{
84+
"name": "GitHub",
85+
"url": "https://github.com/lukepolson/SPECTPSFToolbox",
86+
"icon": "fa-brands fa-github",
87+
"type": "fontawesome",
88+
},
89+
],
90+
'fixed_sidebar': True,
91+
'sidebar_width': '220px',
92+
93+
}
94+
95+
linkcheck_anchors = False

docs/source/index.rst

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.. SPECTPSFToolbox documentation master file, created by
2+
sphinx-quickstart on Fri Aug 2 21:56:39 2024.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
SPECTPSFToolbox Documentation
7+
===========================================
8+
9+
The ``SPECTPSFToolbox`` is a collection of python functions and classes that can be used for modeling the point spread functions (PSFs) of gamma cameras. The PSF models developed by the toolbox can be saved and used in `PyTomography <https://pytomography.readthedocs.io/en/latest/>`_ for SPECT image reconstruction.
10+
11+
In traditional SPECT reconstruction, only the geometric component of the PSF is considered; this library provides a means for modeling the septal scatter and septal penetration components, permitting more accurate image reconstruction when these components are significant.
12+
13+
.. grid:: 1 3 3 3
14+
:gutter: 2
15+
16+
.. grid-item-card:: Tutorials
17+
:link: tutorials
18+
:link-type: doc
19+
:link-alt: Tutorials
20+
:text-align: center
21+
22+
:material-outlined:`psychology;8em;sd-text-secondary`
23+
24+
These tutorials show how to construct operators, fit them to real/Monte Carlo PSF data, and use them in image reconstruction.
25+
26+
.. grid-item-card:: API Reference
27+
:link: autoapi/index
28+
:link-type: doc
29+
:link-alt: API
30+
:text-align: center
31+
32+
:material-outlined:`computer;8em;sd-text-secondary`
33+
34+
View the application programming interface of the library
35+
36+
.. grid-item-card:: Get Help
37+
:text-align: center
38+
39+
:material-outlined:`live_help;8em;sd-text-secondary`
40+
41+
.. button-link:: https://github.com/lukepolson/SPECTPSFToolbox/issues
42+
:shadow:
43+
:expand:
44+
:color: warning
45+
46+
**Report an issue**
47+
48+
.. button-link:: https://pytomography.discourse.group/
49+
:shadow:
50+
:expand:
51+
:color: warning
52+
53+
**Ask questions on PyTomography discourse**

docs/source/tutorials.rst

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.. _tutorial-index:
2+
3+
************************
4+
Tutorials
5+
************************
6+
The tutorials use data that can be downloaded `here <https://drive.google.com/drive/folders/1dUBC1EbUgEH-Cug-oWIS7Yy_tpAqhe4j?usp=sharing>`_.
7+
8+
.. grid:: 1 2 4 4
9+
:gutter: 2
10+
11+
.. grid-item-card:: 1: Kernel1D
12+
:link: tutorials/1_kernel1d_intro
13+
:link-type: doc
14+
:link-alt: Tutorial 1
15+
:text-align: center
16+
17+
:material-outlined:`psychology;4em;sd-text-secondary`
18+
19+
.. grid-item-card:: 2: Kernel2D
20+
:link: tutorials/2_kernel2d_intro
21+
:link-type: doc
22+
:link-alt: Tutorial 2
23+
:text-align: center
24+
25+
:material-outlined:`psychology;4em;sd-text-secondary`
26+
27+
.. grid-item-card:: 3: Operators
28+
:link: tutorials/3_operators
29+
:link-type: doc
30+
:link-alt: Tutorial 3
31+
:text-align: center
32+
33+
:material-outlined:`psychology;4em;sd-text-secondary`
34+
35+
.. grid-item-card:: 4: Optimization Intro
36+
:link: tutorials/4_optimization_intro
37+
:link-type: doc
38+
:link-alt: Tutorial 4
39+
:text-align: center
40+
41+
:material-outlined:`psychology;4em;sd-text-secondary`
42+
43+
.. grid-item-card:: 5: Optimization Ac225
44+
:link: tutorials/5_optimization_ac225
45+
:link-type: doc
46+
:link-alt: Tutorial 5
47+
:text-align: center
48+
49+
:material-outlined:`psychology;4em;sd-text-secondary`
50+
51+
.. grid-item-card:: 6: NearestKernel Ac225
52+
:link: tutorials/6_nearestkernel_ac225
53+
:link-type: doc
54+
:link-alt: Tutorial 6
55+
:text-align: center
56+
57+
:material-outlined:`psychology;4em;sd-text-secondary`
58+
59+
.. grid-item-card:: 7: Ac225 Reconstruction
60+
:link: tutorials/7_pytomography_ac225_recon
61+
:link-type: doc
62+
:link-alt: Tutorial 7
63+
:text-align: center
64+
65+
:material-outlined:`psychology;4em;sd-text-secondary`
66+
67+
.. grid-item-card:: 8: Lu177 Low Energy Collimator
68+
:link: tutorials/8_pytomography_lu177_le_recon
69+
:link-type: doc
70+
:link-alt: Tutorial 8
71+
:text-align: center
72+
73+
:material-outlined:`psychology;4em;sd-text-secondary`
74+
75+
.. grid-item-card:: 9: Lu177 Medium Energy Collimator
76+
:link: tutorials/9_lu177_me_modeling_and_recon
77+
:link-type: doc
78+
:link-alt: Tutorial 9
79+
:text-align: center
80+
81+
:material-outlined:`psychology;4em;sd-text-secondary`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)