Skip to content

Commit fb4fffb

Browse files
Doc (#82)
* added figure and text to help describe the system * updates to figures * separated table construction figure from ideas file * poster summary * quick tidy-up of docs Since these files are still a work in progress, it's probably better to hide them from the user for now. * upgraded code blocks * fixing demo dependency * Added timeline example to the README. * automated docs
1 parent ba4eb0d commit fb4fffb

7 files changed

Lines changed: 305 additions & 1 deletion

File tree

.github/workflows/docs.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
31+
- name: Install Poetry
32+
uses: snok/install-poetry@v1
33+
34+
- name: Install dependencies
35+
run: poetry install
36+
37+
- name: Build docs
38+
run: poetry run mkdocs build
39+
40+
- name: Upload Pages artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: site
44+
45+
deploy:
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
needs: build
51+
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ This is currently an alpha release. Usable, but subject to breaking changes. We
1616
Tests can be run from the root folder with
1717
```bash
1818
poetry run pytest
19+
```
1920

21+
and documentation can be generated locally using
2022

23+
``` bash
24+
poetry run mkdocs serve
2125
```
2226

2327
# Getting Started

docs/api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# API Reference
2+
3+
::: wigner_time
4+

docs/index.md

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
# Wigner_Time
2+
Timeline creation and management for open-loop control in AMO experiments and beyond. Keep scrolling for a quick overview.
3+
4+
## Status
5+
This is currently an alpha release. Usable, but subject to breaking changes. We will release the first stable version soon.
6+
7+
8+
## Optional dependencies (package `extras`)
9+
- `performance_and_export` (Recommended): Installs `pyarrow` for memory management, sharing between systems and export to `parquet`.
10+
- `display`: Installs `matplotlib` and `pyqt` for visualization.
11+
- `parallel_processing`: Installs `polars` for parallel dataframe manipulation. (WARNING: This is currently not used, but will be in the future)
12+
13+
## Developer Notes
14+
Tests can be run from the root folder with
15+
```bash
16+
poetry run pytest
17+
```
18+
19+
# Getting Started
20+
21+
1. [Abstract](#orgfb88e4f)
22+
2. [Why not ADbasic?](#org231a69c)
23+
3. [Why Wigner Time?](#org5e1d714)
24+
1. [Easy (separation of concerns)](#org154d75b)
25+
2. [’Simple’](#org2528e95)
26+
3. [Flexible](#org1877e40)
27+
4. [Portable](#org99c74fd)
28+
5. [Robust](#orgb155d13)
29+
6. [Graphical display](#org6bc654b)
30+
4. [How it works?](#org95dac3d)
31+
5. [Example (For ADwin systems)](#orge8cea69)
32+
6. [Future?](#orge0a7f00)
33+
7. [Status](#org48d7fda)
34+
35+
36+
37+
<a id="orgfb88e4f"></a>
38+
39+
# Abstract
40+
41+
We introduce Wigner Time, an approach and Python package for defining and
42+
manipulating experimental timelines in real-time open-loop control systems.
43+
Fundamentally, procedures are expressed functionally and implemented tabularly, such that the core timelines can be represented with in-memory databases, e.g. `pandas.DataFrame`. The associated functional-style API is clear, flexible, and integrates well with the broader scientific Python ecosystem. The package has been optimized for ADwin-based quantum-optics experiments, but is broadly applicable to any experimental domain requiring precisely timed, multi-device control.
44+
45+
![An example timeline.](resources/timeline--example.png "A timeline generated and displayed by the package.")
46+
47+
48+
<a id="org231a69c"></a>
49+
50+
# Why not ADbasic?
51+
52+
> **ADbasic** combines the **power and precision** of a low-level programming language with the **intuitive clarity** of a low-level programming languge.
53+
54+
55+
<a id="org5e1d714"></a>
56+
57+
# Why Wigner Time?
58+
59+
60+
<a id="org154d75b"></a>
61+
62+
## Easy (separation of concerns)
63+
64+
So much of physics is choosing the right level of abstraction.
65+
66+
Wigner Time allows you to use a normal and popular programming language to design your experimental timelines, while still utilizing the low-level features of other languages when you really need it.
67+
68+
Don&rsquo;t write ADbasic unless you need to!
69+
70+
71+
<a id="org2528e95"></a>
72+
73+
## &rsquo;Simple&rsquo;
74+
75+
Easy tools often become complicated, but Wigner Time has been carefully designed so that all conveniences are **optional**. You can always drop down a level of abstraction to manually implement a new feature - to the point of just adding CSV tables.
76+
77+
78+
<a id="org1877e40"></a>
79+
80+
## Flexible
81+
82+
By using a functional, data-oriented and bottom-up programming approach to timeline creation, Wigner Time makes it very easy to add and substract changes from the timeline and so can repsond to fast-changing lab requirements.
83+
84+
85+
<a id="org99c74fd"></a>
86+
87+
## Portable
88+
89+
The essential data is always accesible and transferrable to any other language or collaborator
90+
91+
- even a spreadsheet!
92+
93+
94+
<a id="orgb155d13"></a>
95+
96+
## Robust
97+
98+
Implemented ontop of the \`pandas\` system, the most widely-used data science package.
99+
100+
101+
<a id="org6bc654b"></a>
102+
103+
## Graphical display
104+
105+
Easily generate and investigate your timeline.
106+
107+
108+
<a id="org95dac3d"></a>
109+
110+
# How it works?
111+
112+
Wigner Time is based around the idea of a &rsquo;timeline&rsquo;, which is, at heart, simply a table of rows and columns. The columns detail &rsquo;parameters&rsquo;, e.g. &rsquo;variable&rsquo; (the name of a quantity), &rsquo;time&rsquo;, &rsquo;value&rsquo;, &rsquo;context&rsquo; (a concise description of a real-world situation, e.g. &rsquo;OpticalTrap&rsquo; )
113+
114+
- Add more parameters by adding columns
115+
- Add more operations by adding rows
116+
117+
By boiling the design down to a &rsquo;table&rsquo; as the foundation, then we can benfit from decades of database development, particularly in-memory database-like systems like \`pandas\`. Therefore, when in doubt, the user can simply manipulate their timeline using the well-developed \`pandas\` ecosystem. For most operations however, even this won&rsquo;t be necessary as wigner<sub>time</sub> provides layers of conveninece functions ontop of this for designing open-loop experiments.
118+
119+
120+
<a id="orge8cea69"></a>
121+
122+
# Example (For ADwin systems)
123+
124+
You want to digitally control an optical shutter and AOM.
125+
126+
For digital channels, simply *name* the ADwin ports using standard Python lists. These keep track of the physical connections.
127+
128+
``` python
129+
from wigner_time.adwin import connection as adcon
130+
from wigner_time import device
131+
from wigner_time import conversion as conv
132+
133+
connections = adcon.new(
134+
["shutter_MOT", 1, 11],
135+
["AOM_MOT", 1, 1])
136+
```
137+
For analogue connections, do the same, but specify a linear factor, conversion function or calibration file.
138+
139+
``` python
140+
devices = device.new(
141+
["lockbox_MOT__MHz", 0.05, -200, 200],
142+
[
143+
"AOM_MOT__transmission",
144+
conv.function_from_file(
145+
"resources/calibration/aom_calibration.dat",
146+
sep=r"\s+",
147+
),
148+
0.0,
149+
1.0,
150+
],
151+
)
152+
```
153+
Specify how you want your experiment to begin and end, using readable options and user-specific keywords.
154+
155+
N.B. The use of *pandas.DataFrame* for convenient edits.
156+
157+
``` python
158+
import timeline as tl
159+
160+
initial = tl.create(
161+
t=1e-6,
162+
context="ADwin_LowInit",
163+
164+
shutter_MOT= 1
165+
AOM_MOT=0,
166+
)
167+
final = init
168+
final['context']="ADwin_Finish"
169+
```
170+
171+
And any key processes&#x2026;
172+
173+
``` python
174+
MOT = tl.update(
175+
shutter_MOT= 0
176+
AOM_MOT=1,
177+
context="MOT",
178+
)
179+
detuned_growth = tl.ramp(
180+
lockbox_MOT__MHz=-5,
181+
duration=10e-3,
182+
),
183+
```
184+
Then combine it all together in readable and modular fashion.
185+
186+
Due to the (hopefully) sensible defaults, each component, e.g. \`ramp\`, will automatically join onto the end of the previous operation in a causal chain.
187+
188+
``` python
189+
tline = tl.stack(
190+
initial,
191+
MOT,
192+
detuned_growth,
193+
final
194+
)
195+
196+
```
197+
198+
199+
The timeline can then be exported to an ADwin-compatible format.
200+
201+
``` python
202+
from wigner_time.adwin import core as adwin
203+
204+
adwin.to_data(tline)
205+
```
206+
207+
<a id="orge0a7f00"></a>
208+
209+
# Future?
210+
211+
- Official support for NI systems
212+
- Graphical input
213+
- Feature requests. Post an issue!

mkdocs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
site_name: Wigner Time
2+
3+
theme:
4+
name: material
5+
6+
plugins:
7+
- search
8+
- mkdocstrings:
9+
handlers:
10+
python:
11+
options:
12+
docstring_style: numpy
13+
show_source: true
14+
show_submodules: true
15+
16+
nav:
17+
- Home: index.md
18+
- API: api.md
19+
20+
markdown_extensions:
21+
- pymdownx.highlight
22+
- pymdownx.superfences
23+
24+
extra:
25+
version:
26+
provider: mike

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ parallel_processing = ["polars"]
2626
jupyter = "^1.1.1"
2727
black = "^24.10.0"
2828
pytest = "^7.3.1"
29+
mkdocstrings = {version = "^1.0.3", extras = ["python"]}
30+
mkdocs-material = "^9.7.6"
31+
mike = "^2.1.4"
2932

3033
[build-system]
3134
requires = ["poetry-core"]

wigner_time/timeline.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"""
1111

1212
from copy import deepcopy
13-
import inspect
1413
from typing import Callable
1514

1615
import funcy

0 commit comments

Comments
 (0)