Skip to content

Commit ba4eb0d

Browse files
Fuller README and hide WIP docs (#79)
* added figure and text to help describe the system * updates to figures * separated table construction figure from ideas file * 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.
1 parent 201010a commit ba4eb0d

30 files changed

Lines changed: 3227 additions & 107 deletions

README.md

Lines changed: 200 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
![Test Status](https://github.com/WignerQuantumOptics/Wigner_Time/actions/workflows/tests.yml/badge.svg)
22

33
# Wigner_Time
4-
Timeline creation and management for open-loop control in AMO experiments and beyond.
4+
Timeline creation and management for open-loop control in AMO experiments and beyond. Keep scrolling for a quick overview.
55

66
## Status
7-
This is currently an alpha release. Usable, but subject to breaking changes.
8-
We will release the first stable version soon.
7+
This is currently an alpha release. Usable, but subject to breaking changes. We will release the first stable version soon.
98

109

1110
## Optional dependencies (package `extras`)
@@ -17,4 +16,202 @@ We will release the first stable version soon.
1716
Tests can be run from the root folder with
1817
```bash
1918
poetry run pytest
19+
20+
2021
```
22+
23+
# Getting Started
24+
25+
1. [Abstract](#orgfb88e4f)
26+
2. [Why not ADbasic?](#org231a69c)
27+
3. [Why Wigner Time?](#org5e1d714)
28+
1. [Easy (separation of concerns)](#org154d75b)
29+
2. [’Simple’](#org2528e95)
30+
3. [Flexible](#org1877e40)
31+
4. [Portable](#org99c74fd)
32+
5. [Robust](#orgb155d13)
33+
6. [Graphical display](#org6bc654b)
34+
4. [How it works?](#org95dac3d)
35+
5. [Example (For ADwin systems)](#orge8cea69)
36+
6. [Future?](#orge0a7f00)
37+
7. [Status](#org48d7fda)
38+
39+
40+
41+
<a id="orgfb88e4f"></a>
42+
43+
# Abstract
44+
45+
We introduce Wigner Time, an approach and Python package for defining and
46+
manipulating experimental timelines in real-time open-loop control systems.
47+
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.
48+
49+
![An example timeline.](resources/timeline--example.png "A timeline generated and displayed by the package.")
50+
51+
52+
<a id="org231a69c"></a>
53+
54+
# Why not ADbasic?
55+
56+
> **ADbasic** combines the **power and precision** of a low-level programming language with the **intuitive clarity** of a low-level programming languge.
57+
58+
59+
<a id="org5e1d714"></a>
60+
61+
# Why Wigner Time?
62+
63+
64+
<a id="org154d75b"></a>
65+
66+
## Easy (separation of concerns)
67+
68+
So much of physics is choosing the right level of abstraction.
69+
70+
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.
71+
72+
Don&rsquo;t write ADbasic unless you need to!
73+
74+
75+
<a id="org2528e95"></a>
76+
77+
## &rsquo;Simple&rsquo;
78+
79+
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.
80+
81+
82+
<a id="org1877e40"></a>
83+
84+
## Flexible
85+
86+
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.
87+
88+
89+
<a id="org99c74fd"></a>
90+
91+
## Portable
92+
93+
The essential data is always accesible and transferrable to any other language or collaborator
94+
95+
- even a spreadsheet!
96+
97+
98+
<a id="orgb155d13"></a>
99+
100+
## Robust
101+
102+
Implemented ontop of the \`pandas\` system, the most widely-used data science package.
103+
104+
105+
<a id="org6bc654b"></a>
106+
107+
## Graphical display
108+
109+
Easily generate and investigate your timeline.
110+
111+
112+
<a id="org95dac3d"></a>
113+
114+
# How it works?
115+
116+
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; )
117+
118+
- Add more parameters by adding columns
119+
- Add more operations by adding rows
120+
121+
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.
122+
123+
124+
<a id="orge8cea69"></a>
125+
126+
# Example (For ADwin systems)
127+
128+
You want to digitally control an optical shutter and AOM.
129+
130+
For digital channels, simply *name* the ADwin ports using standard Python lists. These keep track of the physical connections.
131+
132+
``` python
133+
from wigner_time.adwin import connection as adcon
134+
from wigner_time import device
135+
from wigner_time import conversion as conv
136+
137+
connections = adcon.new(
138+
["shutter_MOT", 1, 11],
139+
["AOM_MOT", 1, 1])
140+
```
141+
For analogue connections, do the same, but specify a linear factor, conversion function or calibration file.
142+
143+
``` python
144+
devices = device.new(
145+
["lockbox_MOT__MHz", 0.05, -200, 200],
146+
[
147+
"AOM_MOT__transmission",
148+
conv.function_from_file(
149+
"resources/calibration/aom_calibration.dat",
150+
sep=r"\s+",
151+
),
152+
0.0,
153+
1.0,
154+
],
155+
)
156+
```
157+
Specify how you want your experiment to begin and end, using readable options and user-specific keywords.
158+
159+
N.B. The use of *pandas.DataFrame* for convenient edits.
160+
161+
``` python
162+
import timeline as tl
163+
164+
initial = tl.create(
165+
t=1e-6,
166+
context="ADwin_LowInit",
167+
168+
shutter_MOT= 1
169+
AOM_MOT=0,
170+
)
171+
final = init
172+
final['context']="ADwin_Finish"
173+
```
174+
175+
And any key processes&#x2026;
176+
177+
``` python
178+
MOT = tl.update(
179+
shutter_MOT= 0
180+
AOM_MOT=1,
181+
context="MOT",
182+
)
183+
detuned_growth = tl.ramp(
184+
lockbox_MOT__MHz=-5,
185+
duration=10e-3,
186+
),
187+
```
188+
Then combine it all together in readable and modular fashion.
189+
190+
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.
191+
192+
``` python
193+
tline = tl.stack(
194+
initial,
195+
MOT,
196+
detuned_growth,
197+
final
198+
)
199+
200+
```
201+
202+
203+
The timeline can then be exported to an ADwin-compatible format.
204+
205+
``` python
206+
from wigner_time.adwin import core as adwin
207+
208+
adwin.to_data(tline)
209+
```
210+
211+
<a id="orge0a7f00"></a>
212+
213+
# Future?
214+
215+
- Official support for NI systems
216+
- Graphical input
217+
- Feature requests. Post an issue!

doc/doc.org

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#+title: Documentation
2+
3+
Full API documentation and an introductory presentation are currently being finalized. For a brief introduction, please see the README.md file.
4+
5+

resources/timeline--example.png

260 KB
Loading

tests/wigner_time/test_adwin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from wigner_time.internal import dataframe as frame
1111

1212
sys.path.append(str(pl.Path.cwd() / "doc"))
13-
import experimentDemo as ex
13+
# import experimentDemo as ex
1414

1515
print(str(pl.Path.cwd() / "doc"))
1616

tests/wigner_time/test_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import sys
1010

1111

12-
sys.path.append(str(pl.Path.cwd() / "doc"))
12+
sys.path.append(str(pl.Path.cwd() / "wigner_time/internal/doc"))
13+
1314
import experimentDemo as ex
1415

1516
# import importlib

tests/wigner_time/timeline/test_timeline_ramp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pathlib as pl
1010
import sys
1111

12-
sys.path.append(str(pl.Path.cwd() / "doc"))
12+
sys.path.append(str(pl.Path.cwd() / "wigner_time/internal/doc"))
1313
import experimentDemo as ex
1414

1515

doc/diagnosticsDemo.py renamed to wigner_time/internal/doc/diagnosticsDemo.py

File renamed without changes.

doc/experimentDemo.py renamed to wigner_time/internal/doc/experimentDemo.py

File renamed without changes.

0 commit comments

Comments
 (0)