Skip to content

Commit faef4e2

Browse files
Merge pull request #61 from python-accelerator-middle-layer/doc
Doc: changed theme (AT theme) and added draft how-to's from notebooks
2 parents 0ad284b + cb30da2 commit faef4e2

File tree

9 files changed

+452
-29
lines changed

9 files changed

+452
-29
lines changed

.github/workflows/documentation.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
- name: Install package
4848
run: python -m pip install '.[docs]'
4949

50+
- name: Install dependencies
51+
run: pip install -r ./docs/requirements.txt
52+
5053
- name: Build documentation
5154
run: python -m sphinx -b html docs ./docs/_build -d ./docs/_build
5255

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ Disclaimer: the pyAML software is still under development.
1616
```
1717
4. If you want to try the examples using the TANGO bindings you also need [tango-pyaml](https://github.com/python-accelerator-middle-layer/tango-pyaml).
1818
Clone that repository and install the package inside the same virtual environment as the `pyaml` package.
19+
tango-pyaml will automatically install pyaml, so step 3 can be skipped.
20+
5. For tests, you may want to install dummy-cs/tango available in
21+
tests/dummy-cs/tango
22+
23+
#### Documentation
24+
25+
The documentation is hosted on Read the Docs: [pyaml](https://pyaml.readthedocs.io/en/latest/?badge=latest).
26+
27+
#### Examples
28+
29+
Examples are available in the `examples` folder of the repository.
30+
Additionally, in the documentation there are example Jupyter notebooks available.

docs/_static/img/dark.png

20 KB
Loading

docs/conf.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@
4848
'sphinx.ext.doctest',
4949
'sphinx.ext.todo',
5050
'sphinx.ext.coverage',
51-
# 'sphinx.ext.mathjax',
51+
'sphinx.ext.mathjax',
5252
'sphinx.ext.viewcode',
5353
'sphinx.ext.githubpages',
5454
'sphinx.ext.napoleon',
5555
'sphinx.ext.autosectionlabel',
5656
'sphinx.ext.autosummary',
57+
'myst_nb'
5758
]
5859
autosectionlabel_prefix_document = True
5960
autosectionlabel_maxdepth = 2
@@ -111,7 +112,9 @@
111112
# The theme to use for HTML and HTML Help pages. See the documentation for
112113
# a list of builtin themes.
113114
#
114-
html_theme = 'classic'
115+
116+
# html_theme = 'classic'
117+
html_theme = "pydata_sphinx_theme"
115118

116119
# Theme options are theme-specific and customize the look and feel of a theme
117120
# further. For a list of options available for each theme, see the
@@ -120,8 +123,8 @@
120123
'collapse_navigation': False,
121124
'display_version': True,
122125
'logo_only': True,
123-
'navigation_depth': 2,
124-
"rightsidebar": "false",
126+
'navigation_depth': 6,
127+
"rightsidebar": True,
125128
"relbarbgcolor": "black"
126129
}
127130

@@ -131,6 +134,14 @@
131134
# It is placed at the top of the sidebar;
132135
# its width should therefore not exceed 200 pixels.
133136
html_logo = '_static/img/logo.png'
137+
html_copy_source = False
138+
html_theme_options = {
139+
"github_url": "https://github.com/atcollab/at",
140+
"logo": {
141+
"image_light": '_static/img/logo.png',
142+
"image_dark": '_static/img/dark.png',
143+
}
144+
}
134145

135146
# Add any paths that contain custom static files (such as style sheets) here,
136147
# relative to this directory. They are copied after the builtin static files,
@@ -169,9 +180,12 @@
169180
'**': [
170181
'relations.html', # needs 'show_related': True theme option to display
171182
'searchbox.html',
172-
]
183+
],
184+
"index": [],
185+
"common/about": [],
173186
}
174187

188+
175189
# -- Options for HTMLHelp output ------------------------------------------
176190

177191
# Output file base name for HTML help builder.
@@ -231,4 +245,17 @@
231245
# at building time. Here used to have PyQT mocked.
232246
autodoc_mock_imports = ['PyQt5', 'PyQt5.QtGui', 'PyQt5.QtCore', 'PyQt5.QtWidgets',
233247
"matplotlib.backends.backend_qt5agg",
234-
]
248+
]
249+
250+
# -- Options for the myst markdown parser ------------------------------------
251+
252+
myst_enable_extensions = [
253+
"attrs_inline",
254+
"colon_fence",
255+
"dollarmath",
256+
"replacements",
257+
"deflist",
258+
]
259+
myst_heading_anchors = 3
260+
nb_execution_mode = "off" #"auto"
261+
nb_execution_allow_errors = True

docs/index.rst

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
pyAML documentation
2-
======================================
3-
4-
.. contents:: Table of Contents
5-
:depth: 3
6-
2+
===================
3+
74
Introduction
8-
------------------------
5+
------------
96

107
python Accelerator Middle Layer (pyAML) is a joint technology platform to develop common tools for control, tuning and development of storage rings, beam transport lines and linear accelerators.
118

@@ -20,25 +17,45 @@ With pyAML, it WILL be possible to (the software is at conceptualization stage):
2017
- many more features
2118

2219
Installation
23-
------------------------
20+
------------
2421
pip support will be provided later.
2522
for the time being:
2623

2724
git clone https://github.com/python-accelerator-middle-layer/pyaml.git
2825

2926

27+
Documentation
28+
-------------
29+
30+
.. toctree::
31+
:maxdepth: 1
32+
:caption: How to:
33+
:glob:
34+
35+
Load a configuration file <notebooks/load_configuration>
36+
Switch design live <notebooks/live_design>
37+
Select a control system <notebooks/control_system>
38+
39+
.. toctree::
40+
:caption: Modules:
41+
:maxdepth: 1
42+
:glob:
43+
44+
modules/*
45+
46+
3047
Collaboration community
3148
------------------------
3249

3350
Discussion
34-
~~~~~~~~~~~~~~~~~~~~~~~~
51+
~~~~~~~~~~
3552

3653
`Mattermost <https://mattermost.hzdr.de/accelerator-middle-layer/channels/town-square>`_
3754

3855
(please log in using Helmoltz ID, you will be prompt to access with your own lab/university credentials)
3956

4057
Shared documents
41-
~~~~~~~~~~~~~~~~~~~~~~~~
58+
~~~~~~~~~~~~~~~~
4259

4360
to access the shared documents please ask S.Liuzzo for access rigths.
4461

@@ -48,23 +65,13 @@ https://www.overleaf.com/read/hnrqzhfpbvpp#ef8935
4865
to be added to editors list please write to S.Liuzzo
4966

5067
Mailing list:
51-
~~~~~~~~~~~~~~~~~~~~~~~~
68+
~~~~~~~~~~~~~
5269
to be added to the pyAML mailing list please write to S.Liuzzo
5370

5471

55-
Documentation
56-
----------------------
57-
58-
.. toctree::
59-
:caption: Modules
60-
:maxdepth: 1
61-
:glob:
62-
63-
modules/*
64-
6572

6673
Indices and tables
67-
====================================
74+
==================
6875

6976
* :ref:`genindex`
7077
* :ref:`modindex`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "7a473047",
6+
"metadata": {},
7+
"source": [
8+
"# Control System set up"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": null,
14+
"id": "62672006",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"from pyaml.pyaml import pyaml,PyAML"
19+
]
20+
}
21+
],
22+
"metadata": {
23+
"kernelspec": {
24+
"display_name": "Python 3 (ipykernel)",
25+
"language": "python",
26+
"name": "python3"
27+
},
28+
"language_info": {
29+
"codemirror_mode": {
30+
"name": "ipython",
31+
"version": 3
32+
},
33+
"file_extension": ".py",
34+
"mimetype": "text/x-python",
35+
"name": "python",
36+
"nbconvert_exporter": "python",
37+
"pygments_lexer": "ipython3",
38+
"version": "3.12.3"
39+
}
40+
},
41+
"nbformat": 4,
42+
"nbformat_minor": 5
43+
}

docs/notebooks/live_design.ipynb

Lines changed: 204 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "420c1a3c",
6+
"metadata": {},
7+
"source": [
8+
"# Configuration"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": 1,
14+
"id": "7204f09a",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"from pyaml.pyaml import pyaml,PyAML\n",
19+
"\n",
20+
"ml:PyAML = pyaml('../../tests/config/EBSTune.yaml')"
21+
]
22+
},
23+
{
24+
"cell_type": "markdown",
25+
"id": "f6ccb72a",
26+
"metadata": {},
27+
"source": [
28+
"pyaml/tests/config/EBSTune.yaml is an example pyAML yaml configuration file that defines:\n",
29+
"- a 6GeV Storage ring with\n",
30+
" - 1 array (family) of quadrupoles used for tune correction\n",
31+
" - 1 tune device\n",
32+
" - controlled by Tango\n",
33+
" - simulated with AT\n",
34+
"\n",
35+
"It looks like this: \n",
36+
"\n",
37+
"```\n",
38+
"type: pyaml.pyaml\n",
39+
"instruments:\n",
40+
" - type: pyaml.instrument\n",
41+
" name: sr \n",
42+
" energy: 6e9\n",
43+
" simulators:\n",
44+
" - type: pyaml.lattice.simulator\n",
45+
" lattice: sr/lattices/ebs.mat\n",
46+
" name: design\n",
47+
" controls:\n",
48+
" - type: tango.pyaml.controlsystem\n",
49+
" tango_host: ebs-simu-3:10000\n",
50+
" name: live\n",
51+
" data_folder: /data/store\n",
52+
" arrays:\n",
53+
" - type: pyaml.arrays.magnet\n",
54+
" name: QForTune\n",
55+
" elements:\n",
56+
" - QD2E-C04\n",
57+
" - QD2A-C05\n",
58+
" - QD2E-C05\n",
59+
" - QD2A-C06\n",
60+
" - QD2E-C06\n",
61+
" - QD2A-C07\n",
62+
" - ...\n",
63+
" devices: \n",
64+
" - type: pyaml.magnet.quadrupole\n",
65+
" name: QD2A-C03\n",
66+
" model:\n",
67+
" type: pyaml.magnet.linear_model\n",
68+
" calibration_factor: 1.002096389\n",
69+
" crosstalk: 0.99912\n",
70+
" curve:\n",
71+
" type: pyaml.configuration.csvcurve\n",
72+
" file: sr/magnet_models/QD2_strength.csv\n",
73+
" unit: 1/m\n",
74+
" powerconverter:\n",
75+
" type: tango.pyaml.attribute\n",
76+
" attribute: srmag/vps-qd2/c03-a/current\n",
77+
" unit: A\n",
78+
" - ... \n",
79+
" - ...\n",
80+
" - ...\n",
81+
" - type: pyaml.diagnostics.tune_monitor\n",
82+
" name: BETATRON_TUNE\n",
83+
" tune_h:\n",
84+
" type: tango.pyaml.attribute_read_only\n",
85+
" attribute: srdiag/tune/tune_h\n",
86+
" unit: mm\n",
87+
" tune_v:\n",
88+
" type: tango.pyaml.attribute_read_only\n",
89+
" attribute: srdiag/tune/tune_v\n",
90+
" unit: mm\n",
91+
"```\n"
92+
]
93+
},
94+
{
95+
"cell_type": "code",
96+
"execution_count": null,
97+
"id": "0a3805fd-f96d-4ca0-9246-97b30baa1c32",
98+
"metadata": {},
99+
"outputs": [],
100+
"source": []
101+
}
102+
],
103+
"metadata": {
104+
"kernelspec": {
105+
"display_name": "Python 3 (ipykernel)",
106+
"language": "python",
107+
"name": "python3"
108+
},
109+
"language_info": {
110+
"codemirror_mode": {
111+
"name": "ipython",
112+
"version": 3
113+
},
114+
"file_extension": ".py",
115+
"mimetype": "text/x-python",
116+
"name": "python",
117+
"nbconvert_exporter": "python",
118+
"pygments_lexer": "ipython3",
119+
"version": "3.12.3"
120+
}
121+
},
122+
"nbformat": 4,
123+
"nbformat_minor": 5
124+
}

docs/requirements.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ sphinxcontrib-mermaid==1.0.0
77
myst-parser==4.0.0
88
sphinx-hoverxref==1.4.1
99
numpy==2.3.4
10-
pydantic==2.11.0
10+
pydantic==2.12.4
1111
accelerator-toolbox==0.7.1
12-
matplotlib==3.10.7
12+
matplotlib==3.10.7
13+
ipykernel==7.1.0
14+
myst-nb==1.3.0
15+
pydata-sphinx-theme==0.16.1

0 commit comments

Comments
 (0)