Commit c459f349 authored by Leon Merten Lohse's avatar Leon Merten Lohse
Browse files

add infrastructure for documentation

parent 1c5578b8
Pipeline #174381 failed with stages
in 46 seconds
......@@ -2,6 +2,7 @@ image: python
stages:
- lint
- deploy
flake8:
stage: lint
......@@ -20,3 +21,17 @@ cpplint:
script:
- pip install cpplint
- cpplint --linelength=120 --filter=-legal/copyright,-build/include_order,-build/include_subdir,-runtime/references source/*cpp source/*h
pages:
stage: deploy
script:
- pip install sphinx sphinx_rtd_theme sphinxcontrib-bibtex
- cd doc
- make html
- mv build/html ../public/
- echo 'Done'
artifacts:
paths:
- public
only:
- master
# 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 = source
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)
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'Fresnel'
copyright = '2021, Institut für Röntgenphysik'
author = 'Institut für Röntgenphysik'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinxcontrib.bibtex',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
Discrete Hankel Transform
-------------------------
.. automodule:: fresnel.hankel
:members:
.. Fresnel documentation master file, created by
sphinx-quickstart on Wed Feb 17 13:59:17 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Fresnel's documentation!
===================================
.. toctree::
:maxdepth: 2
:caption: Contents:
hankel
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
# This program is public domain
"""
Discrete Hankel transform.
"""
import numpy as np
import scipy.special
def hankelMatrix(N, n=0):
"""
returns a N x N matrix for discrete Hankel transfrom of n-th order.
N: number of pixels
n: order of Hankel transform
The Hankel matrix is self-inverse! I.e. HH = Id
For forward and backward Hankel transfrom different prefactors have to be considered!
As in: Theory and operational rules for the discreteHankel transform
by Natalie Baddour* and Ugo Chouinard
https://doi.org/10.1364/JOSAA.32.000611
Create a N x N matrix for discrete Hankel transfrom (DHT) [1]_ of n-th order.
Parameters
----------
N : int
number of pixels
n : int, optional
order of DHT
Returns
-------
ndarray
Hankel matrix
Notes
-----
The Hankel matrix is self-inverse, i.e.
.. math:: YY = \mathbb{1}.
References
----------
.. [1] N. Baddour and U. Chouinard, “Theory and operational rules for the discrete Hankel transform,” Journal of the Optical Society of America A, vol. 32, no. 4, p. 611, Mar. 2015. https://doi.org/10.1364/JOSAA.32.000611
"""
jn = np.array(scipy.special.jn_zeros(n, N + 1))
......@@ -32,11 +49,21 @@ def hankelMatrix(N, n=0):
def hankelFreq(N, n=0, kmax=0.5):
"""
Returns the Hankel space (frequency) sampling grid for the inverse discrete
Hankel transfrom (of order n) of a signal with N pixels.
kmax is the maximum sampling frequency in dimensionless units, i.e.
minimal sampled realspace oscillation 2px -> max. sampled frequency 1/(2px)
-> 0.5 dimensionless
Returns the Hankel space (frequency) sampling grid for the inverse DHT
Parameters
----------
N : int
number of pixels
n : int, optional
order of DHT
kmax : float, optional
maximum sampling frequency in dimensionless units
Returns
-------
array
frequency sampling grid
"""
jn = np.array(scipy.special.jn_zeros(n, N + 1))
......@@ -46,11 +73,22 @@ def hankelFreq(N, n=0, kmax=0.5):
def hankelSamples(N, n=0, kmax=0.5):
"""
Returns the real space sampling grid for the forward discrete Hankel
transfrom (of order n) of a signal with N pixels.
kmax is the maximum sampling frequency in dimensionless units, i.e.
minimal sampled realspace oscillation 2px -> max. sampled frequency 1/(2px)
-> 0.5 dimensionless
Returns the real space sampling grid for the DHT
Parameters
----------
N : int
number of pixels
n : int, optional
order of DHT
kmax : float, optional
maximum sampling frequency in dimensionless units
Returns
-------
array
real space sampling grid
"""
jn = np.array(scipy.special.jn_zeros(n, N))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment