Skip to content

Commit a393163

Browse files
committed
Docs tidyup. Added image/code styling, reorganised page order
1 parent 60e2567 commit a393163

File tree

10 files changed

+97
-58
lines changed

10 files changed

+97
-58
lines changed

docs/_static/custom.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
img[src*='#left'] {
2+
float: left;
3+
}
4+
5+
img[src*='#right'] {
6+
float: right;
7+
}
8+
9+
img[src*='#center'] {
10+
display: block;
11+
margin: auto;
12+
}

docs/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,12 @@
189189
# Logo
190190
html_logo = "images/dls-logo.svg"
191191
html_favicon = html_logo
192+
193+
# These folders are copied to the documentation's HTML output
194+
html_static_path = ["_static"]
195+
196+
# These paths are either relative to html_static_path
197+
# or fully qualified paths (eg. https://...)
198+
html_css_files = [
199+
"custom.css",
200+
]

docs/explanations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ Explanations of how it works and why it works that way.
66
:maxdepth: 1
77
:glob:
88
9+
explanations/implementation_details
910
explanations/*
1011
```
File renamed without changes.
File renamed without changes.

docs/tutorials.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ Tutorials for installation and typical usage. New users start here.
66
:maxdepth: 1
77
:glob:
88
9-
tutorials/*
9+
tutorials/installation
10+
tutorials/overview
11+
tutorials/atip_example
12+
tutorials/virtac_example
1013
```

docs/tutorials/ATIP_example.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/tutorials/atip_example.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ATIP example
2+
3+
## Simmulating accelerator physics using ATIP as a data source for Pytac
4+
5+
Note that you need an AT lattice that is compatible with Pytac. Some are provided
6+
in ``atip/rings/``, otherwise try running the Matlab function
7+
``atip/rings/create_lattice_matfile.m`` with an AT lattice loaded.
8+
9+
:::{code-block} python
10+
11+
>>> import pytac
12+
>>> import atip
13+
>>> # Load the DIAD lattice from Pytac.
14+
>>> lat = pytac.load_csv.load('DIAD')
15+
>>> # Load the AT sim into the Pytac lattice.
16+
>>> atip.load_sim.load_from_filepath(lat, 'atip/rings/DIAD.mat')
17+
>>> # Use the sim by default.
18+
>>> lat.set_default_data_source(pytac.SIM)
19+
>>> # The initial beam position is zero.
20+
>>> lat.get_value('x')
21+
array([0., 0., 0., ..., 0., 0., 0.])
22+
>>> # Get the first horizontal corrector magnet and set its current to 1A.
23+
>>> hcor1 = lat.get_elements('HSTR')[0]
24+
>>> hcor1.set_value('x_kick', 1, units=pytac.ENG)
25+
>>> # Now the x beam position has changed.
26+
>>> lat.get_value('x')
27+
array([0.00240101, 0.00240101, 0.00239875, ..., 0.00240393, 0.00240327,
28+
0.00240327])
29+
:::

docs/tutorials/overview.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ The python implementation of
1212
[Accelerator Toolbox](<https://github.com/atcollab/at>) (pyAT) is used
1313
for the simulation.
1414

15-
![How ATIP fits into the combined control structure.](../images/control_structure.png)
15+
:::sidebar
16+
<img src="../_images/control_structure.png" alt="How ATIP fits into the combined control structure." width="300px" class="bg-primary" align="right">
17+
:::
1618

1719
ATIP allows an AT lattice to be fitted into the simulation data source of a
1820
Pytac lattice. This integrated lattice acts like a normal Pytac lattice, and

docs/tutorials/virtac_example.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,39 @@ PVs on the live machine.
1717

1818
Run the virtac under the development EPICS port::
1919

20-
$ export EPICS_CA_SERVER_PORT=6064
21-
$ export EPICS_CAS_SERVER_PORT=6064
22-
$ export EPICS_CA_REPEATER_PORT=6065
23-
$ # at Diamond the above can be set in one go using: . changeports 6064
24-
$ pipenv run virtac
20+
:::{code-block} bash
21+
$ export EPICS_CA_SERVER_PORT=6064
22+
$ export EPICS_CAS_SERVER_PORT=6064
23+
$ export EPICS_CA_REPEATER_PORT=6065
24+
$ # at Diamond the above can be set in one go using: . changeports 6064
25+
$ pipenv run virtac
26+
:::
2527

2628
It takes 10 seconds or so to load the interactive console::
2729

28-
Starting record creation.
29-
~*~*Woah, we're halfway there, Wo-oah...*~*~
30-
Finished creating all 2981 records.
31-
Starting iocInit
32-
############################################################################
33-
## EPICS 7.0.6.0
34-
## Rev. 7.0.6.99.1.0
35-
############################################################################
36-
iocRun: All initialization complete
37-
Python 3.7.2 (default, Jan 20 2020, 11:03:41)
38-
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
39-
Type "help", "copyright", "credits" or "license" for more information.
40-
(InteractiveConsole)
41-
>>>
30+
:::{code-block} bash
31+
Starting record creation.
32+
~*~*Woah, were halfway there, Wo-oah...*~*~
33+
Finished creating all 2981 records.
34+
Starting iocInit
35+
############################################################################
36+
## EPICS 7.0.6.0
37+
## Rev. 7.0.6.99.1.0
38+
############################################################################
39+
iocRun: All initialization complete
40+
Python 3.7.2 (default, Jan 20 2020, 11:03:41)
41+
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
42+
Type "help", "copyright", "credits" or "license" for more information.
43+
(InteractiveConsole)
44+
>>>
45+
:::
4246

4347
Leave the server running and in a new terminal update the EPICS port::
4448

45-
$ export EPICS_CA_SERVER_PORT=6064
46-
$ # or: . changeports 6064
49+
:::{code-block} bash
50+
$ export EPICS_CA_SERVER_PORT=6064
51+
$ # or: . changeports 6064
52+
:::
4753

4854
In this new terminal you are then free to address the simulator as you would
4955
the live machine, either through Pytac or by directly accessing the PVs.
@@ -93,11 +99,15 @@ This is done inside the server console, in the terminal where one you ran
9399

94100
For example disabling SOFB on the first BPM::
95101

96-
>>> server.set_feedback_record(3, 'enabled', 0)
102+
:::{code-block} bash
103+
>>> server.set_feedback_record(3, 'enabled', 0)
104+
:::
97105

98106
or reducing the beam current::
99107

100-
>>> server.set_feedback_record(0, 'beam_current', 280)
108+
:::{code-block} bash
109+
>>> server.set_feedback_record(0, 'beam_current', 280)
110+
:::
101111

102112
For further information on working with feedback systems, please refer to
103113
``FEEDBACK_SYSTEMS.rst``.
@@ -116,7 +126,9 @@ If none of these is set then the virtual accelerator will default to 'I04'.
116126

117127
For example::
118128

119-
$ pipenv run virtac I04
120-
$ export RINGMODE=I04
121-
$ caput SR-CS-RING-01:MODE 3
122-
$ # Having none of these set would also start in mode 'I04'.
129+
:::{code-block} bash
130+
$ pipenv run virtac I04
131+
$ export RINGMODE=I04
132+
$ caput SR-CS-RING-01:MODE 3
133+
$ # Having none of these set would also start in mode 'I04'.
134+
:::

0 commit comments

Comments
 (0)