|
| 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 | + |
| 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’t write ADbasic unless you need to! |
| 69 | + |
| 70 | + |
| 71 | +<a id="org2528e95"></a> |
| 72 | + |
| 73 | +## ’Simple’ |
| 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 ’timeline’, which is, at heart, simply a table of rows and columns. The columns detail ’parameters’, e.g. ’variable’ (the name of a quantity), ’time’, ’value’, ’context’ (a concise description of a real-world situation, e.g. ’OpticalTrap’ ) |
| 113 | + |
| 114 | +- Add more parameters by adding columns |
| 115 | +- Add more operations by adding rows |
| 116 | + |
| 117 | +By boiling the design down to a ’table’ 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’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… |
| 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! |
0 commit comments