Add initial documentation
All checks were successful
Gitea Actions Demo / build_test (3.13.3) (push) Successful in 11s
Gitea Actions Demo / release-test (push) Successful in 1s

Add synthetic data tutorial
Add read the docs setup
This commit is contained in:
Jakob Lass 2025-04-11 14:02:35 +02:00
parent 1dee498b38
commit 682c9aeac9
9 changed files with 833 additions and 9 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ tests/__pycache__/*
build/*
src/AMBER.egg-info/*
source/tutorials/.ipynb_checkpoints/*
make.bat

19
.readthedocs.yaml Normal file
View File

@ -0,0 +1,19 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the OS, Python version, and other tools you might need
build:
os: ubuntu
tools:
python: "3.13"
# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: source/conf.py
python:
install:
- requirements: docs/requirements.txt

20
Makefile Normal file
View File

@ -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 = 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)

View File

@ -1,14 +1,7 @@
AMBER
=====
[![Test status](https://gitea.psi.ch/lass_j/AMBER/actions/workflows/test.yaml/badge.svg)]()
General introduction
## Installation
## Quick Installation
```
pip install AMBER
@ -22,7 +15,7 @@ python3 -m pip install AMBER
## Documentation and Tutorials
The documentation for AMBER can be found at
## Contribute

37
source/conf.py Normal file
View File

@ -0,0 +1,37 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'AMBER'
copyright = '2025, J. Lass, V. Cohen, B. B. Haro, & D. G. Mazzone'
author = 'J. Lass, V. Cohen, B. B. Haro, & D. G. Mazzone'
release = '0.0.2'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'nbsphinx', # allows notebooks
'myst_parser' # allows markdown
]
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown',
}
templates_path = ['_templates']
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'pyramid'
html_static_path = ['_static']
output_dir = ''

94
source/index.rst Normal file
View File

@ -0,0 +1,94 @@
.. AMBER documentation master file, created by
sphinx-quickstart on Fri Apr 11 10:48:14 2025.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
AMBER documentation
===================
This is the documentation for the **A** lgorithm for **M** ultiplexing spectrometer
**B** ackground **E** stimation with **R** otation-independence **AMBER** which is a method to estimate and background within 3D data sets.
This software is the result of the collaboration between the instrument responsible at the `CAMEA <https://www.psi.ch/en/sinq/camea>`_ beamline at SINQ, at the
`Paul Scherrer Institut <https://psi.ch/>`_ with the `Swiss Data Science Center <https://www.datascience.ch/>`_ through the "Data Science for Multiplexing Spectrometers" (DS4MS) project supported by
the fifth call for Collaborative Research Data Science Projects.
Badges
------
.. image:: https://gitea.psi.ch/lass_j/AMBER/actions/workflows/test.yaml/badge.svg
:width: 200
:alt: Test Status
Installation
------------
Installation can be done through PyPI using
.. code-block::
python -m pip install AMBER
Alternatively, the newest version can be installed directly from the source repository through
.. code-block::
python -m pip install git https://gitea.psi.ch/lass_j/AMBER.git@master
General Introduction
--------------------
**AMBER** has been developed with multiplexing neutron spectrometers in mind, i.e. a novel version of the triple axis instrument which acquires multiple data points simultaneously.
However, the algorithm is more general and can be utilized on data with other origins.
The main requirements of the data are
#. Rotation independence of the background in two out of three directions.
#. Smooth change of background along all directions
#. The signal is sparse but continuous in all directions
**AMBER** minimizes the following cost function for the signal and background given the set of parameters :math:`\lambda`, :math:`\beta`, and :math:`\mu` on a voxelated data set:
.. math::
\min_{X,b} \frac{1}{2}\lVert Y-X-\mathcal{R}b\rVert_{2}^2+\lambda\vert| X |\vert_{1} +\frac{\beta}{2} \mathrm{Tr} \left( b^T L_{b} b \right) +\frac{\mu}{2} \boldsymbol{1}_{n_x}^TX^T L_{\omega} X\boldsymbol{1}_{n_y}
where :math:`Y`, :math:`X`, and :math:`b` are the measured signal, the subtracted signal and the rotation independent background, respectively. :math:`\mathcal{R}` is a rotation operator taking
the radial :math:`b` to the full space. These three parameters constitute the fitting term while the rest are denoted penalty terms. :math:`\lambda` controls the weighing of sparcity of the subtracted signal gauge through the L-1 norm
:math:`\vert| X |\vert_{1}`, :math:`\beta` controls the smoothness of the background while :math:`\mu` the smoothness of the subtracted signal.
For further details, see the the paper.
Documentation & Tutorials
-------------------------
For **AMBER** the following tutorials have been created
.. toctree::
:maxdepth: 2
:caption: Contents:
tutorials/index.rst
Contribute
----------
Contact
-------

4
source/requirements.txt Normal file
View File

@ -0,0 +1,4 @@
docutils<0.18
ipykernel
nbsphinx
sphinx>5

11
source/tutorials/index.md Normal file
View File

@ -0,0 +1,11 @@
# Tutorials
Below is a list of tutorials utilizing __AMBER__ to perform a background determination and background subtraction. Some of these require additional packages and data to function. For those notebooks, links to the and installation requirements are highlighted.
```{toctree}
---
maxdepth: 1
caption: Tutorials:
---
simulated_data.ipynb
```

File diff suppressed because one or more lines are too long