Repository navigation
Expand file tree
/
Copy pathAOloopControl.html
More file actions
3083 lines (2969 loc) · 118 KB
/
Copy pathAOloopControl.html
File metadata and controls
3083 lines (2969 loc) · 118 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<meta name="author" content="Olivier Guyon" />
<title>AOloopControl</title>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; background-color: #dddddd; }
td.sourceCode { padding-left: 5px; }
code > span.kw { font-weight: bold; } /* Keyword */
code > span.dt { color: #800000; } /* DataType */
code > span.dv { color: #0000ff; } /* DecVal */
code > span.bn { color: #0000ff; } /* BaseN */
code > span.fl { color: #800080; } /* Float */
code > span.ch { color: #ff00ff; } /* Char */
code > span.st { color: #dd0000; } /* String */
code > span.co { color: #808080; font-style: italic; } /* Comment */
code > span.al { color: #00ff00; font-weight: bold; } /* Alert */
code > span.fu { color: #000080; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #ff0000; font-weight: bold; } /* Warning */
code > span.cn { color: #000000; } /* Constant */
code > span.sc { color: #ff00ff; } /* SpecialChar */
code > span.vs { color: #dd0000; } /* VerbatimString */
code > span.ss { color: #dd0000; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { } /* Variable */
code > span.cf { } /* ControlFlow */
code > span.op { } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { font-weight: bold; } /* Preprocessor */
code > span.at { } /* Attribute */
code > span.do { color: #808080; font-style: italic; } /* Documentation */
code > span.an { color: #808080; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #808080; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #808080; font-weight: bold; font-style: italic; } /* Information */
</style>
<link rel="stylesheet" href="/home/olivier/.css/pandoc.css" type="text/css" />
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full" type="text/javascript"></script>
</head>
<body>
<div id="header">
<h1 class="title">AOloopControl</h1>
<h2 class="author">Olivier Guyon</h2>
<h3 class="date">Oct 1, 2017</h3>
</div>
<div id="TOC">
<ul>
<li><a href="#initial-setup"><span class="toc-section-number">1</span> Initial Setup</a><ul>
<li><a href="#scope"><span class="toc-section-number">1.1</span> Scope</a></li>
<li><a href="#pre-requisites"><span class="toc-section-number">1.2</span> Pre-requisites</a></li>
<li><a href="#installing-the-adaptiveopticscontrol-package"><span class="toc-section-number">1.3</span> Installing the AdaptiveOpticsControl package</a></li>
<li><a href="#setting-up-the-work-directory"><span class="toc-section-number">1.4</span> Setting up the work directory</a></li>
</ul></li>
<li><a href="#software-overview"><span class="toc-section-number">2</span> Software Overview</a><ul>
<li><a href="#high-level-gui"><span class="toc-section-number">2.1</span> High-level GUI</a></li>
<li><a href="#supporting-scripts"><span class="toc-section-number">2.2</span> Supporting Scripts</a></li>
<li><a href="#main-executable"><span class="toc-section-number">2.3</span> Main executable</a></li>
<li><a href="#memory-storage-and-configuration-parameters"><span class="toc-section-number">2.4</span> Memory storage and Configuration Parameters</a></li>
</ul></li>
<li><a href="#hardware-simulation"><span class="toc-section-number">3</span> Hardware Simulation</a><ul>
<li><a href="#overview"><span class="toc-section-number">3.1</span> Overview</a></li>
<li><a href="#method-1-provide-an-external-simulation-that-adheres-to-aoloopcontrol-inputoutput-conventions"><span class="toc-section-number">3.2</span> METHOD 1: Provide an external simulation that adheres to AOloopControl input/output conventions</a></li>
<li><a href="#method-2-physical-hardware-simulation"><span class="toc-section-number">3.3</span> METHOD 2: Physical hardware simulation</a><ul>
<li><a href="#running-method-2"><span class="toc-section-number">3.3.1</span> Running Method 2</a></li>
<li><a href="#method-2-output-streams"><span class="toc-section-number">3.3.2</span> Method 2 output streams</a></li>
<li><a href="#processes-and-scripts-details"><span class="toc-section-number">3.3.3</span> Processes and scripts details</a></li>
<li><a href="#ao-loop-control"><span class="toc-section-number">3.3.4</span> AO loop control</a></li>
<li><a href="#processes-and-scripts-system-ouput"><span class="toc-section-number">3.3.5</span> Processes and scripts: system ouput</a></li>
</ul></li>
<li><a href="#method-3-linear-hardware-simulation"><span class="toc-section-number">3.4</span> METHOD 3: Linear Hardware Simulation</a><ul>
<li><a href="#overview-1"><span class="toc-section-number">3.4.1</span> Overview</a></li>
<li><a href="#setup"><span class="toc-section-number">3.4.2</span> Setup</a></li>
</ul></li>
</ul></li>
<li><a href="#aoloopcontrol-setup-and-overview"><span class="toc-section-number">4</span> AOloopControl setup and overview</a><ul>
<li><a href="#gui-description"><span class="toc-section-number">4.1</span> GUI description</a></li>
<li><a href="#commands-log"><span class="toc-section-number">4.2</span> Commands log</a><ul>
<li><a href="#automatically-generated-internal-command-log-very-detailed"><span class="toc-section-number">4.2.1</span> Automatically generated internal command log (very detailed)</a></li>
<li><a href="#user-provided-usexternal-log-less-verbose"><span class="toc-section-number">4.2.2</span> User-provided UsExternal log (less verbose)</a></li>
<li><a href="#interactive-user-log"><span class="toc-section-number">4.2.3</span> Interactive user log</a></li>
</ul></li>
</ul></li>
<li><a href="#setting-up-the-hardware-interfaces"><span class="toc-section-number">5</span> Setting up the hardware interfaces</a><ul>
<li><a href="#top-level-script"><span class="toc-section-number">5.1</span> Top level script</a></li>
<li><a href="#setting-the-dm-interface"><span class="toc-section-number">5.2</span> Setting the DM interface</a><ul>
<li><a href="#mode-a-connecting-to-an-existing-dm"><span class="toc-section-number">5.2.1</span> Mode [A]: Connecting to an existing DM</a></li>
<li><a href="#mode-b-creating-and-connecting-to-a-dm"><span class="toc-section-number">5.2.2</span> Mode [B]: Creating and Connecting to a DM</a></li>
<li><a href="#mode-c-create-a-new-modal-dm-mapped-to-an-existing-dm-using-another-loops-control-modes"><span class="toc-section-number">5.2.3</span> Mode [C]: Create a new modal DM, mapped to an existing DM using another loop's control modes</a></li>
<li><a href="#mode-d-create-a-new-modal-dm-mapped-to-an-existing-dm-channel-using-a-custom-set-of-modes"><span class="toc-section-number">5.2.4</span> Mode [D]: Create a new modal DM, mapped to an existing DM channel using a custom set of modes</a></li>
<li><a href="#option-wfs-zero-point-offset"><span class="toc-section-number">5.2.5</span> Option: WFS Zero point offset</a></li>
<li><a href="#notes"><span class="toc-section-number">5.2.6</span> Notes</a></li>
</ul></li>
<li><a href="#setting-the-camera-interface"><span class="toc-section-number">5.3</span> Setting the camera interface</a></li>
<li><a href="#setup-script"><span class="toc-section-number">5.4</span> Setup script</a></li>
</ul></li>
<li><a href="#calibration"><span class="toc-section-number">6</span> Calibration</a><ul>
<li><a href="#acquiring-a-zonal-response-matrix"><span class="toc-section-number">6.1</span> Acquiring a zonal response matrix</a></li>
<li><a href="#acquiring-a-modal-response-matrix-optional-for-zonal-dm-only"><span class="toc-section-number">6.2</span> Acquiring a modal response matrix (optional, for ZONAL DM only)</a></li>
<li><a href="#automatic-system-calibration-recommended"><span class="toc-section-number">6.3</span> Automatic system calibration (recommended)</a></li>
<li><a href="#managing-configurations"><span class="toc-section-number">6.4</span> Managing configurations</a></li>
</ul></li>
<li><a href="#building-control-matrix"><span class="toc-section-number">7</span> Building control matrix</a></li>
<li><a href="#running-the-loop-choosing-hardware-mode-cpugpu"><span class="toc-section-number">8</span> Running the loop: Choosing hardware mode (CPU/GPU)</a></li>
<li><a href="#auxilliary-processes"><span class="toc-section-number">9</span> Auxilliary processes</a><ul>
<li><a href="#extract-wfs-modes"><span class="toc-section-number">9.1</span> Extract WFS modes</a></li>
<li><a href="#extract-open-loop-modes"><span class="toc-section-number">9.2</span> Extract open loop modes</a></li>
<li><a href="#running-average-of-dmc"><span class="toc-section-number">9.3</span> Running average of dmC</a></li>
<li><a href="#compute-and-average-wfsres"><span class="toc-section-number">9.4</span> Compute and average wfsres</a></li>
</ul></li>
<li><a href="#offsetting"><span class="toc-section-number">10</span> Offsetting</a><ul>
<li><a href="#converting-dm-offsets-to-wfs-offsets-zonal-cpu-mode"><span class="toc-section-number">10.1</span> Converting DM offsets to WFS offsets (zonal, CPU mode)</a></li>
<li><a href="#converting-dm-offsets-to-wfs-offsets-zonal-gpu-mode"><span class="toc-section-number">10.2</span> Converting DM offsets to WFS offsets (zonal, GPU mode)</a></li>
<li><a href="#modal-offsetting-from-another-loop"><span class="toc-section-number">10.3</span> Modal offsetting from another loop</a></li>
<li><a href="#summing-and-applying-wfs-offsets-to-aoln_wfsref"><span class="toc-section-number">10.4</span> Summing and applying WFS offsets to aolN_wfsref</a></li>
<li><a href="#wfs-average-offset"><span class="toc-section-number">10.5</span> WFS average offset</a></li>
</ul></li>
<li><a href="#controlling-offsets-from-another-loop"><span class="toc-section-number">11</span> Controlling offsets from another loop</a><ul>
<li><a href="#running-the-loop"><span class="toc-section-number">11.1</span> Running the loop</a></li>
</ul></li>
<li><a href="#predictive-control-experimental"><span class="toc-section-number">12</span> Predictive control (experimental)</a><ul>
<li><a href="#overview-2"><span class="toc-section-number">12.1</span> Overview</a></li>
<li><a href="#scripts"><span class="toc-section-number">12.2</span> Scripts</a></li>
<li><a href="#data-flow"><span class="toc-section-number">12.3</span> Data flow</a></li>
</ul></li>
<li><a href="#appendix-a-shared-memory-streams"><span class="toc-section-number">13</span> APPENDIX A: SHARED MEMORY STREAMS</a><ul>
<li><a href="#linking-to-existing-stream"><span class="toc-section-number">13.1</span> Linking to existing stream</a></li>
<li><a href="#loading-images-from-fits-to-shared-memory-stream"><span class="toc-section-number">13.2</span> Loading images from FITS to shared memory stream</a><ul>
<li><a href="#overview-3"><span class="toc-section-number">13.2.1</span> Overview</a></li>
<li><a href="#detailed-description"><span class="toc-section-number">13.2.2</span> Detailed description</a></li>
</ul></li>
</ul></li>
<li><a href="#reference-conf-directory"><span class="toc-section-number">14</span> REFERENCE: CONF DIRECTORY</a><ul>
<li><a href="#overview-4"><span class="toc-section-number">14.1</span> Overview</a></li>
<li><a href="#parameters"><span class="toc-section-number">14.2</span> Parameters</a><ul>
<li><a href="#overall-and-misc"><span class="toc-section-number">14.2.1</span> Overall and misc</a></li>
<li><a href="#linear-hardware-simulator"><span class="toc-section-number">14.2.2</span> Linear Hardware Simulator</a></li>
<li><a href="#dm"><span class="toc-section-number">14.2.3</span> DM</a></li>
<li><a href="#timing"><span class="toc-section-number">14.2.4</span> Timing</a></li>
<li><a href="#response-matrix-acquisition"><span class="toc-section-number">14.2.5</span> Response Matrix acquisition</a></li>
<li><a href="#modess-and-control-matrix-computation"><span class="toc-section-number">14.2.6</span> Modess and Control Matrix computation</a></li>
<li><a href="#loop-control"><span class="toc-section-number">14.2.7</span> Loop Control</a></li>
</ul></li>
<li><a href="#stream-links"><span class="toc-section-number">14.3</span> Stream Links</a></li>
<li><a href="#shared-memory-fits-file-initializations-to-streams"><span class="toc-section-number">14.4</span> Shared memory FITS file initializations to streams</a></li>
<li><a href="#fits-files"><span class="toc-section-number">14.5</span> FITS files</a></li>
</ul></li>
<li><a href="#reference-content-of-.status-directory"><span class="toc-section-number">15</span> REFERENCE: Content of ./status directory</a></li>
<li><a href="#reference-additional-pages"><span class="toc-section-number">16</span> REFERENCE, ADDITIONAL PAGES</a></li>
</ul>
</div>
<div id="initial-setup" class="section level1">
<h1><span class="header-section-number">1</span> Initial Setup</h1>
<div id="scope" class="section level2">
<h2><span class="header-section-number">1.1</span> Scope</h2>
<p>AO loop control package. Includes high-performance CPU/GPU computation engine and higher level scripts.</p>
</div>
<div id="pre-requisites" class="section level2">
<h2><span class="header-section-number">1.2</span> Pre-requisites</h2>
<p>Libraries required :</p>
<ul>
<li>gcc</li>
<li>openMP</li>
<li>fitsio</li>
<li>fftw (single and double precision)</li>
<li>gsl</li>
<li>readline</li>
<li>tmux</li>
</ul>
<p>Recommended:</p>
<ul>
<li>CUDA</li>
<li>Magma</li>
<li>shared memory image viewer (<code>shmimview</code> or similar)</li>
</ul>
</div>
<div id="installing-the-adaptiveopticscontrol-package" class="section level2">
<h2><span class="header-section-number">1.3</span> Installing the AdaptiveOpticsControl package</h2>
<p>Source code is available on the <a href="https://github.com/oguyon/AdaptiveOpticsControl">AdaptiveOpticsControl git hub repository</a>.</p>
<p>Download the latest tar ball (.tar.gz file), uncompress, untar and execute in the source directory (<code>./AdaptiveOpticsControl-<version>/</code>)</p>
<pre><code>./configure</code></pre>
<p>Include recommended high performance compile flags for faster execution speed:</p>
<pre><code>./configure CFLAGS='-Ofast -march=native'</code></pre>
<p>If you have installed CUDA and MAGMA libraries:</p>
<pre><code>./configure CFLAGS='-Ofast -march=native' --enable-cuda --enable-magma</code></pre>
<p>The executable is built with:</p>
<pre><code>make
make install</code></pre>
<p>The executable is <code>./AdaptiveOpticsControl-<version>/bin/AdaptiveOpticsControl</code></p>
</div>
<div id="setting-up-the-work-directory" class="section level2">
<h2><span class="header-section-number">1.4</span> Setting up the work directory</h2>
<p>Conventions:</p>
<ul>
<li><code><srcdir></code> is the source code directory, usually <code>.../AdaptiveOpticsControl-<version></code></li>
<li><code><workdir></code> is the work directory where the program and scripts will be executed. Note that the full path should end with <code>.../AOloop<#></code> where <code><#></code> ranges from 0 to 9. For example, <code>AOloop2</code>.</li>
</ul>
<p>The work directory is where all scripts and high level commands should be run from. You will first need to create the work directory and then load scripts from the source directory to the work directory.</p>
<p>First, execute from the source directory the 'syncscript -e' command to export key install scripts:</p>
<pre><code>mkdir /<workdir>
cd <srcdir>/src/AOloopControl/scripts
./syncscripts -e /<workdir></code></pre>
<p>The 'syncscript' script should now be in the work directory. Execute it to copy all scripts to the work directory:</p>
<pre><code>cd /<workdir>
./syncscripts</code></pre>
<p>Symbolic links to the source scripts and executable are now installed in the work directory (exact links / directories may vary) :</p>
<pre><code>olivier@ubuntu:/data/AOloopControl/AOloopTest$ ls -l
total 32
drwxrwxr-x 2 olivier olivier 4096 Sep 29 19:27 aocscripts
drwxrwxr-x 2 olivier olivier 4096 Sep 29 19:27 aohardsim
lrwxrwxrwx 1 olivier olivier 57 Sep 29 19:27 aolconf -> /home/olivier/src/Cfits/src/AOloopControl/scripts/aolconf
drwxrwxr-x 2 olivier olivier 4096 Sep 29 19:27 aolconfscripts
drwxrwxr-x 2 olivier olivier 4096 Sep 29 19:27 aolfuncs
lrwxrwxrwx 1 olivier olivier 70 Sep 29 19:26 AOloopControl -> /home/olivier/src/Cfits/src/AOloopControl/scripts/../../../bin/cfitsTK
drwxrwxr-x 2 olivier olivier 4096 Sep 29 19:27 aosetup
drwxrwxr-x 2 olivier olivier 4096 Sep 29 19:27 auxscripts
lrwxrwxrwx 1 olivier olivier 61 Sep 29 19:26 syncscripts -> /home/olivier/src/Cfits/src/AOloopControl/scripts/syncscripts</code></pre>
<p>If new scripts are added in the source directory, running <code>./syncscripts</code> again from the work directory will add them to the work directory.</p>
</div>
</div>
<div id="software-overview" class="section level1">
<h1><span class="header-section-number">2</span> Software Overview</h1>
<p>At the low level, most operations are performed by calls to the <a href="#main-executable">main executable</a> which is precompiled C code. The user interacts with a <a href="#high-level-GUI">high level ASCII-based GUI</a>, which performs calls to individual <a href="#supporting-scripts">scripts</a> or directly execute instances of the main executable.</p>
<p>The standard code layers are : <a href="#high-level-gui">GUI</a> calls <a href="#supporting-scripts">SCRIPT</a> calls <a href="#main-executable">PRECOMPILED EXECUTABLE</a></p>
<div id="high-level-gui" class="section level2">
<h2><span class="header-section-number">2.1</span> High-level GUI</h2>
<p>The top level script is <code>aolconf</code>. Run it with <code>-h</code> option for a quick help</p>
<pre><code>./aolconf -h</code></pre>
<p>The <code>aolconf</code> script starts the main GUI screen from which sub-screens can be accessed. ASCII control GUI scripts are in the <code>aolconfscripts</code> directory.</p>
<p>The scripts are listed below in the order they appear in the GUI menu. Boldface scripts corresponds to GUI screens. Supporting scripts (holding frequently used functions) are boldface italic.</p>
<table>
<colgroup>
<col width="38%" />
<col width="61%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">Script</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left"><strong>aolconf_menutop</strong></td>
<td align="left"><strong>GUI</strong>: Top level menu</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_funcs</em></strong></td>
<td align="left">Misc functions</td>
</tr>
<tr class="odd">
<td align="left"><strong><em>aolconf_DMfuncs</em></strong></td>
<td align="left">DM Functions</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_readconf</em></strong></td>
<td align="left">Configuration read functions</td>
</tr>
<tr class="odd">
<td align="left"><strong><em>aolconf_menuview</em></strong></td>
<td align="left"><strong>GUI</strong>: Data view menu</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_template</em></strong></td>
<td align="left">Template (use to create additional GUI screens)</td>
</tr>
<tr class="odd">
<td align="left">----CONFIGURATION-------------------</td>
<td align="left">setup configuration, links to hardware</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_menuconfigureloop</strong></td>
<td align="left"><strong>GUI</strong>: Configure loop menu. Called from main menu</td>
</tr>
<tr class="odd">
<td align="left"><strong><em>aolconf_configureloop_funcs</em></strong></td>
<td align="left">Functions used within the configureloop GUI screen</td>
</tr>
<tr class="even">
<td align="left">----CONTROL MATRIX------------------</td>
<td align="left">compute control matrix</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menucontrolmatrix</strong></td>
<td align="left"><strong>GUI</strong>: Control matrix menu. Called from main menu</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_controlmatrix_funcs</em></strong></td>
<td align="left">Functions used within the controlmatrix GUI screen</td>
</tr>
<tr class="odd">
<td align="left"><strong><em>aolconf_menu_mkFModes</em></strong></td>
<td align="left">Make modes</td>
</tr>
<tr class="even">
<td align="left">----LOOP CONTROL--------------------</td>
<td align="left">control AO loop</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menucontrolloop</strong></td>
<td align="left"><strong>GUI</strong>: Control loop menu. Called from main menu</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_controlloop_funcs</em></strong></td>
<td align="left">Functions used within the controlloop GUI screen</td>
</tr>
<tr class="odd">
<td align="left">----PREDICTIVE CONTROL--------------</td>
<td align="left">WFS telemetry prediction and related AO control</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_menupredictivecontrol</em></strong></td>
<td align="left"><strong>GUI</strong>:Predictive control</td>
</tr>
<tr class="odd">
<td align="left">----TESTING-------------------------</td>
<td align="left">AO loop tests</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_menutestmode</strong></td>
<td align="left"><strong>GUI</strong>: test mode menu</td>
</tr>
<tr class="odd">
<td align="left"><strong><em>aolconf_DMturb</em></strong></td>
<td align="left">DM turbulence functions</td>
</tr>
<tr class="even">
<td align="left">----LOGGING-------------------------</td>
<td align="left">Log telemetry</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menurecord</strong></td>
<td align="left"><strong>GUI</strong>: Record / log telemetry</td>
</tr>
<tr class="even">
<td align="left"><strong><em>aolconf_logfuncs</em></strong></td>
<td align="left">Data and command logging</td>
</tr>
</tbody>
</table>
</div>
<div id="supporting-scripts" class="section level2">
<h2><span class="header-section-number">2.2</span> Supporting Scripts</h2>
<p>Scripts are organized in directories according to their purpose</p>
<table>
<colgroup>
<col width="34%" />
<col width="65%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">Directory</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">aolconfscripts</td>
<td align="left">GUI scripts (see previous section)</td>
</tr>
<tr class="even">
<td align="left">aolfuncs</td>
<td align="left">Frequently used functions</td>
</tr>
<tr class="odd">
<td align="left">auxscripts</td>
<td align="left">Auxillary scripts. Essential high level scripts in this directory.</td>
</tr>
<tr class="even">
<td align="left">aohardsim</td>
<td align="left">Hardware simulation</td>
</tr>
<tr class="odd">
<td align="left">aocscripts</td>
<td align="left">Custom user-provided scripts to interact with non real-time hardware</td>
</tr>
</tbody>
</table>
<p>The <code>auxscripts</code> directory are called by aolconf to perform various tasks. To list all commands, type in the <code>auxscripts</code> directory :</p>
<pre><code>./listcommands</code></pre>
<p>For each script, the <code>-h</code> option will print help.</p>
</div>
<div id="main-executable" class="section level2">
<h2><span class="header-section-number">2.3</span> Main executable</h2>
<p>The main precompiled executable is <code>./AOloopControl</code>, which provides a command line interface (CLI) to all compiled code. Type <code>AOloopControl -h</code> for help. You can enter the CLI and list the available libraries (also called modules) that are linked to the CLI. You can also list the functions available within each module (<code>m? <module.c></code>) and help for each function (<code>cmd? <functionname></code>). Type <code>help</code> within the CLI for additional directions, and <code>exit</code> or <code>exitCLI</code> to exit the command line.</p>
<pre><code>olivier@ubuntu:/data/AOloopControl/AOloop1$ ./AOloopControl
type "help" for instructions
Running with openMP, max threads = 8 (defined by environment variable OMP_NUM_THREADS)
LOADED: 21 modules, 269 commands
./AOloopControl > exitCLI
Closing PID 5291 (prompt process)</code></pre>
</div>
<div id="memory-storage-and-configuration-parameters" class="section level2">
<h2><span class="header-section-number">2.4</span> Memory storage and Configuration Parameters</h2>
<p>AOCCE adopts a common shared memory data format for all data streams. The data structure is defined in file <code><srcdir>/src/ImageStruct.h</code>.</p>
<p>Configurations parameters are stored in directory <code><workdir>/conf</code> as ASCII files. When AOCCEE is launched, it can load all required parameters and populate required shared memory streams from information contained in the <code><workdir>/conf</code> directory.</p>
</div>
</div>
<div id="hardware-simulation" class="section level1">
<h1><span class="header-section-number">3</span> Hardware Simulation</h1>
<div id="overview" class="section level2">
<h2><span class="header-section-number">3.1</span> Overview</h2>
<p>There are 3 methods for users to simulate hardware</p>
<ul>
<li><p>METHOD 1: Provide an external simulation that adheres to AOloopControl input/output conventions</p></li>
<li><p>METHOD 2: Use the physical hardware simulation provided by the package</p></li>
<li><p>METHOD 3: Use the linear hardware simulation: this option is fastest, but only captures linear relationships between DM actuators and WFS signals</p></li>
</ul>
</div>
<div id="method-1-provide-an-external-simulation-that-adheres-to-aoloopcontrol-inputoutput-conventions" class="section level2">
<h2><span class="header-section-number">3.2</span> METHOD 1: Provide an external simulation that adheres to AOloopControl input/output conventions</h2>
<p>The user runs a loop that updates the wavefront sensor image when the DM input changes. Both the DM and WFS are represented as shared memory image streams. When a new DM shape is written, the DM stream semaphores are posted by the user, triggering the WFS image computation. When the WFS image is computed, its semaphores are posted.</p>
</div>
<div id="method-2-physical-hardware-simulation" class="section level2">
<h2><span class="header-section-number">3.3</span> METHOD 2: Physical hardware simulation</h2>
<p>The AOsim simulation architecture relies on individual processes that simulate subsystems. Each process is launched by a bash script. ASCII configuration files are read by each process. Data I/O can be done with low latency using shared memory and semaphores: a process operation (for example, the wavefront sensor process computing WFS signals) is typically triggered by a semaphore contained in the shared memory wavefront stream. A low-speed file system based alternative to shared memory and semaphores is also provided.</p>
<p>Method 2 simulates incoming atmospheric WFs, a pyramid WFS based loop feeding a DM, a coronagraphic LOWFS and coronagraphic PSFs.</p>
<div id="running-method-2" class="section level3">
<h3><span class="header-section-number">3.3.1</span> Running Method 2</h3>
<p>Launch the simulator with the following steps:</p>
<ul>
<li><p>Create a series of atmospheric wavefronts (do this only once, this step can take several hrs):</p>
<pre><code>./aohardsim/aosimmkwf</code></pre>
<p>Stop the process when a few wavefront files have been created (approximately 10 minimum). The AO code will loop through the list of files created, so a long list is preferable to reduce the frequency at which the end-of-sequence discontinuity occurs. The current wavefront file index is displayed as the process runs; in this example, the process is working on file #2:</p>
<pre><code>Layer 0/ 7, Frame 99/ 100, File 0/100000000 [TIME = 0.0990 s] WRITING SCIENCE WAVEFRONT ... -
Layer 0/ 7, Frame 99/ 100, File 1/100000000 [TIME = 0.1990 s] WRITING SCIENCE WAVEFRONT ... -
Layer 1/ 7, Frame 42/ 100, File 2/100000000 [TIME = 0.2420 s] </code></pre>
<p>Type <code>CTRL-C</code> to stop the process. Note that you can relaunch the script later to build additional wavefront files.</p>
<p>By default, the wavefront files are stored in the work directory. You may choose to move them to another location (useful if you have multiple work directories sharing the same wavefront files). You can then create a symbolic link <code>atmwf</code> to an existing atmospheric wavefront simulation directory. For example:</p>
<pre><code>ln -s /data/AtmWF/wdir00/ atmwf</code></pre></li>
<li><p>Execute master script <code>./aohardsim/runAOhsim</code></p></li>
<li><p>To stop the physical simulator: <code>./aohardsim/runAOhsim -k</code></p></li>
</ul>
<p>Important notes:</p>
<ul>
<li><p>Parameters for the simulation can be changed by editing the <code>.conf</code> files in the <code>aohardsim</code> directory</p></li>
<li><p>You may need to kill and relaunch the main script twice after changing parameters</p></li>
</ul>
</div>
<div id="method-2-output-streams" class="section level3">
<h3><span class="header-section-number">3.3.2</span> Method 2 output streams</h3>
<table>
<colgroup>
<col width="26%" />
<col width="73%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">Stream</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left"><strong>wf0opd</strong></td>
<td align="left">Atmospheric WF OPD</td>
</tr>
<tr class="even">
<td align="left"><strong>wf0amp</strong></td>
<td align="left">Atmospheric WF amplitude</td>
</tr>
<tr class="odd">
<td align="left"><strong>wf1opd</strong></td>
<td align="left">Wavefront OPD after correction [um] ( = wf0opd - 2 x dm05dispmap )</td>
</tr>
<tr class="even">
<td align="left"><strong>dm05disp</strong></td>
<td align="left">DM actuators positions</td>
</tr>
<tr class="odd">
<td align="left"><strong>dm05dispmap</strong></td>
<td align="left">DM OPD map</td>
</tr>
<tr class="even">
<td align="left"><strong>WFSinst</strong></td>
<td align="left">Instantaneous WFS intensity</td>
</tr>
<tr class="odd">
<td align="left"><strong>pWFSint</strong></td>
<td align="left">WFS intensity frame, time averaged to WFS frame rate and sampled to WFS camera pixels</td>
</tr>
<tr class="even">
<td align="left"><strong>aosim_foc0_amp</strong></td>
<td align="left">First focal plane (before coronagraph), amplitude</td>
</tr>
<tr class="odd">
<td align="left"><strong>aosim_foc0_pha</strong></td>
<td align="left">First focal plane (before coronagraph), phase</td>
</tr>
<tr class="even">
<td align="left"><strong>aosim_foc1_amp</strong></td>
<td align="left">First focal plane (after coronagraph), amplitude</td>
</tr>
<tr class="odd">
<td align="left"><strong>aosim_foc1_pha</strong></td>
<td align="left">First focal plane (after coronagraph), phase</td>
</tr>
<tr class="even">
<td align="left"><strong>aosim_foc2_amp</strong></td>
<td align="left">Post-coronagraphic focal plane, amplitude</td>
</tr>
<tr class="odd">
<td align="left"><strong>aosim_foc2_pha</strong></td>
<td align="left">Post-coronagraphic focal plane, phase</td>
</tr>
</tbody>
</table>
</div>
<div id="processes-and-scripts-details" class="section level3">
<h3><span class="header-section-number">3.3.3</span> Processes and scripts details</h3>
<div id="process-aosimmkwf" class="section level4">
<h4><span class="header-section-number">3.3.3.1</span> Process <code>aosimmkWF</code></h4>
<p><code>aosimmkWF</code> reads precomputed wavefronts and formats them for the simulation parameters (pixel scale, temporal sampling).</p>
<p>Parameters for <code>aosimmkWF</code> are stored in configuration file:</p>
<p>File <code>aosimmkWF.conf.default</code> :</p>
<div class="sourceCode"><table class="sourceCode numberLines"><tr class="sourceCode"><td class="lineNumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="sourceCode"><pre><code class="sourceCode"># ======== AO simulation : creating atmospheric wavefronts stream =================
# script relies on pre-computed physical atmospheric wavefronts
MODE 0 # 0: read pre-computed WFs, 1: empty WFs
WFDIR ./atmwf # atmospheric wavefronts directory
LAMBDANM 1650 # wavelength [nm]
# ============== OUTPUT TYPE (OPD unit = um) ====================
OUT0FITSFILE 0 # 0: none, 1 if FITS file output OPD only, 2 if OPD+AMP
OUT0FITSFILENAMEOPD wf0opd.fits # FITS file name output (OPD)
OUT0FITSFILENAMEAMP wf0amp.fits # FITS file name output (AMP)
OUTPHYSTIME aosim_phystime # physical time [s]
OUT0STREAM 2 # 1 if shared memory stream OPD only, 2 if OPD+AMP
OUT0STREAMNAMEOPD wf0opd # output WF stream name (OPD)
OUT0STREAMNAMEAMP wf0amp # output WF stream name (AMP)
# ============== PROCESS TRIGGER ==================================
TRIGGERMODE 2 # 0: file, 1: semaphore from stream, 2: time interval
TRIGGERFILE wfup.txt # update file name (TRIGGERMODE=0,1
TRIGGERDT 0.01 # update interval (TRIGGERMODE=0,2)
TRIGGER0STREAM WFSinst # trigger stream
TRIGGER0SEM 5 # trigger semaphore in TRIGGERSTREAM
TRIGGER1STREAM dm05dispmap # trigger stream
TRIGGER1SEM 5 # trigger semaphore in TRIGGERSTREAM
# ============== PARAMETERS ======================================
DT 0.0000625 # time interval between computed wavefronts
OPDMFACT 1.0 # OPD multiplicative factor
AMPMFACT 1.0 # AMP multiplicative factor
ARRAYSIZE 128 # output size [pix]
PIXSCALEMODE 2 # 0: adopt input WF pixel scale, 1: custom pixel scale, 2: bin
PIXSCALECUSTOM 0.1 # custom pixel size
PIXBINFACTOR 4 # bin factor
PUPDIAMM 8 # Pupil diameter [m]
# ============== POST-PROCESSING =============================
DM0MODE 1 # 0 if no DM0, 1 if OPD DMn
DM0NAME dm05dispmap # DM displacement map stream
OUT1FITSFILENAMEOPD wf1opd.fits # FITS file name output (OPD)
OUT1FITSFILENAMEAMP wf1amp.fits # FITS file name output (AMP)
OUT1STREAM 1 # 1 if shared memory stream OPD only, 2 if OPD+AMP
OUT1STREAMNAMEOPD wf1opd # output WF stream name (OPD)
OUT1STREAMNAMEAMP wf1amp # output WF stream name (AMP)
</code></pre></td></tr></table></div>
</div>
<div id="process-aosimdmrun" class="section level4">
<h4><span class="header-section-number">3.3.3.2</span> Process <code>aosimDMrun</code></h4>
<p>File <code>aosimDMrun.conf.default</code> :</p>
<div class="sourceCode"><table class="sourceCode numberLines"><tr class="sourceCode"><td class="lineNumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="sourceCode"><pre><code class="sourceCode">
# ============== AOsim: DM process =============================
# DM process is triggered by WF OPD, not by DM command
# ============== INPUT & TRIGGER (OPD unit = um) ===============
INMODE 0 # 0:stream, 1:file system (FITS)
INSTREAMNAMEDM dm05disp # input DM command stream
INFITSFILENAMEDM dm05disp.fits # input FITS file name (DM command)
INTRIGSTREAMNAME wf1opd # input trigger stream
INTRIGSEMCHAN 6 # input semaphore channel (using OPD input)
INTRIGGERFILE inwf.txt # input trigger file
# ============== OUTPUT TYPE ===================================
OUTMODE 0 # 0: stream, 1: file system
OUTSTREAMNAMEDM dm05dispmap # output WF stream name
OUTFITSFILENAMEDM dm05dispmap.fits # FITS file name output [um]
OUTTRIGGERFILE outdm.txt # output trigger file
# ============== GEOMETRY, TIME =============================
ARRAYSIZE 128 # array size, pix
DMRAD 52 # DM radius on array
DMDT 0.0003 # DM time sampling
NBTSAMPLES 100 # number of time samples
DMLAGSTART 0.0003 # time lag start
DMTIMECST 0.0001 # DM time constant</code></pre></td></tr></table></div>
</div>
<div id="process-aosimpyrwfs" class="section level4">
<h4><span class="header-section-number">3.3.3.3</span> Process <code>aosimPyrWFS</code></h4>
<p>File <code>aosimPyrWFS.conf.default</code> :</p>
<div class="sourceCode"><table class="sourceCode numberLines"><tr class="sourceCode"><td class="lineNumbers"><pre></pre></td><td class="sourceCode"><pre><code class="sourceCode"></code></pre></td></tr></table></div>
</div>
</div>
<div id="ao-loop-control" class="section level3">
<h3><span class="header-section-number">3.3.4</span> AO loop control</h3>
<p>The <code>aolconf</code> script is used to configure and launch the AO control loop. It can be configured with input/output from real hardware or a simulation of real hardware.</p>
<div id="shared-memory-streams" class="section level4">
<h4><span class="header-section-number">3.3.4.1</span> Shared memory streams</h4>
<table>
<colgroup>
<col width="34%" />
<col width="65%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">Script</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left"><strong>wf0opd</strong></td>
<td align="left">Wavefront OPD prior to wavefront correction [um]</td>
</tr>
<tr class="even">
<td align="left"><strong>wf1opd</strong></td>
<td align="left">Wavefront OPD after correction [um] ( = wf0opd - 2 x dm05dispmap )</td>
</tr>
<tr class="odd">
<td align="left"><strong>dm05disp</strong></td>
<td align="left">DM actuators positions</td>
</tr>
<tr class="even">
<td align="left"><strong>dm05dispmap</strong></td>
<td align="left">DM OPD map</td>
</tr>
<tr class="odd">
<td align="left"><strong>WFSinst</strong></td>
<td align="left">Instantaneous WFS intensity</td>
</tr>
<tr class="even">
<td align="left"><strong>pWFSint</strong></td>
<td align="left">WFS intensity frame, time averaged to WFS frame rate and sampled to WFS camera pixels</td>
</tr>
</tbody>
</table>
</div>
<div id="hardware-simulation-architecture" class="section level4">
<h4><span class="header-section-number">3.3.4.2</span> Hardware simulation architecture</h4>
<div class="figure">
<img src="./figures/aosimlink.jpg" title="aosim data flow" alt="data flow" />
<p class="caption">data flow</p>
</div>
<p>Close-loop simulation requires the following scripts to be launched to simulate the hardware, in the following order :</p>
<ul>
<li><code>aosimDMstart</code>: This script creates DM channels (uses dm index 5 for simulation). Shared memory arrays <code>dm05disp00</code> to <code>dm05disp11</code> are created, along with the total displacement <code>dm05disp</code>. Also creates the <code>wf1opd</code> shared memory stream which is needed by <code>aosimDMrun</code> and will be updated by runWF. <code>wf1opd</code> is the master clock for the whole simulation, as it triggers DM shape computation and WFS image computation.</li>
<li><code>aosimDMrun</code>: Simulates physical deformable mirror (DM)</li>
<li><code>aosimmkWF</code>: Creates atmospheric wavefronts</li>
<li><code>aosimWFS</code>: Simulates WFS</li>
</ul>
<p>Some key script variables need to coordinated between scripts. The following WF array size should match :</p>
<ul>
<li><code>WFsize</code> in script <code>aosimDMstart</code></li>
<li><code>ARRAYSIZE</code> in <code>aosimmkWF.conf</code></li>
<li><code>ARRAYSIZE</code> in <code>aosimDMrun.conf</code></li>
</ul>
<p>The main hardware loop is between <code>aosimmkWF</code> and <code>aosimWFS</code>: computation of a wavefront by <code>aosimmkWF</code> is <em>triggered</em> by completion of a WFS instantaneous image computation by <code>aosimWFS</code>. The configuration files are configured for this link.</p>
</div>
<div id="dm-temporal-response" class="section level4">
<h4><span class="header-section-number">3.3.4.3</span> DM temporal response</h4>
<p>The DM temporal response is assumed to be such that the distance between the current position <span class="math inline">\(p\)</span> and desired displacement <span class="math inline">\(c\)</span> values is multiplided by coefficient <span class="math inline">\(a<1\)</span> at each time step <span class="math inline">\(dt\)</span>. The corresponding step response is :</p>
<p><span class="math inline">\(c - p((k+1) dt) = (c - p(k dt)) a\)</span></p>
<p><span class="math inline">\(c - p(k dt) = (c-p0) a^k\)</span></p>
<p><span class="math inline">\(p(k dt) = 1-a^k\)</span></p>
<p>The corresponding time constant is</p>
<p><span class="math inline">\(a^{\frac{t0}{dt}} = 0.5\)</span></p>
<p><span class="math inline">\(\frac{t0}{dt} ln(a) = ln(0.5)\)</span></p>
<p><span class="math inline">\(ln(a) = ln(0.5) dt/t0\)</span></p>
<p><span class="math inline">\(a = 0.5^{\frac{dt}{t0}}\)</span></p>
</div>
</div>
<div id="processes-and-scripts-system-ouput" class="section level3">
<h3><span class="header-section-number">3.3.5</span> Processes and scripts: system ouput</h3>
<p>The output (corrected) wavefront is processed to compute ouput focal plane images, and optionally LOWFS image.</p>
<div id="process-aosimcorolowfs" class="section level4">
<h4><span class="header-section-number">3.3.5.1</span> Process <code>aosimcoroLOWFS</code></h4>
<p>Computes coronagraphic image output and LOWFS image</p>
<p>File <code>aosimcoroLOWFS.conf.default</code>:</p>
<div class="sourceCode"><table class="sourceCode numberLines"><tr class="sourceCode"><td class="lineNumbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="sourceCode"><pre><code class="sourceCode">
# ============== AOsim: coro LOWFS process =============================
# LOWFS process is triggered by WF OPD
# ============== INPUT & TRIGGER (OPD unit = um) ===============
INMODE 0 # 0:stream, 1:file system (FITS)
INAMPSTREAMNAME wf1amp # input AMP stream
INOPDSTREAMNAME wf1opd # input OPD stream
INAMPFITSFILENAME wf1amp.fits # input FITS file name
INOPDFITSFILENAME wf1opd.fits # input FITS file name
INTRIGSTREAMNAME wf1opd # input trigger stream
INTRIGSEMCHAN 4 # input semaphore channel (using OPD input)
INTRIGGERFILE inwf.txt # input trigger file
INPHYSTIME aosim_phystime # physical time
# ============== OUTPUT TYPE ===================================
OUTMODE 0 # 0: stream, 1: file system
OUTLOWFSARRAYSIZE 16 # output LOWFS array size, pix
OUTLOWFSSTREAMNAME aosim_imcamLOWFS # output WF stream name
OUTLOWFSFITSFILENAME aosim_imcamLOWFS.fits # FITS file name output [um]
OUTTRIGGERFILE outLOWFS.txt # output trigger file
# ============== GEOMETRY, OPTICAL DESIGN =============================
LAMBDAum 1.65 # wavelength [um]
ARRAYSIZE 256 # array size, pix, used for internal computations
COROFPMAMP corofpmamp # coronagraph focal plane mask amplitude
COROFPMPHA corofpmpha # coronagraph focal plane mask amplitude
LYOTSTOPREFLAMP lyotstopreflamp # LYOT stop reflectivity map (amp)
LYOTSTOPREFLPHA lyotstopreflpha # LYOT stop reflectivity map (pha)
LYOTSTOPTRANSMAMP lyotstoptransmamp # LYOT stop transmission map (amp)
LYOTSTOPTRANSMPHA lyotstoptransmpha # LYOT stop transmission map (pha)
# ============== LOWFS =============================
LOWFSOPDMAP lowfsopdmap # LOWFS defocus map [um]
LOWFSCAMETIME 0.01 # LOWFS camera exposure time [s]</code></pre></td></tr></table></div>
</div>
<div id="ouput-simulation-architecture" class="section level4">
<h4><span class="header-section-number">3.3.5.2</span> Ouput simulation architecture</h4>
<div class="figure">
<img src="./figures/aosimlink_coroLOWFS.jpg" title="coroLOWFS data flow" alt="coroLOWFS data flow" />
<p class="caption">coroLOWFS data flow</p>
</div>
</div>
</div>
</div>
<div id="method-3-linear-hardware-simulation" class="section level2">
<h2><span class="header-section-number">3.4</span> METHOD 3: Linear Hardware Simulation</h2>
<div id="overview-1" class="section level3">
<h3><span class="header-section-number">3.4.1</span> Overview</h3>
<p>The Linear Hardware Simulation (LHS) uses a linear response matrix to compute the WFS image from the DM state. It is significantly faster than the Physical Hardware Simulation (PHS) but does not capture non-linear effects.</p>
</div>
<div id="setup" class="section level3">
<h3><span class="header-section-number">3.4.2</span> Setup</h3>
<ul>
<li>Create directory LHScalib:</li>
</ul>
<pre><code>mkdir LHScalib</code></pre>
<ul>
<li><p>Download response matrix and reference, place them in directory <code>LHScalib</code>.</p></li>
<li><p>Start GUI, loop 5, name simLHS</p></li>
</ul>
<pre><code>./aolconf -L 5 -N simLHS</code></pre>
<ul>
<li><p>Start DM: index 04, 50 x 50; Auto-configure: main DM (no link); STOP -> (re-)START DM comb process</p></li>
<li><p>Go to <code>TEST MODE</code> GUI</p></li>
<li><p>Enter linear simulation zonal response matrix and linear simulation WFS reference (<code>zrespMlinsim</code> and <code>wfsref0linsim</code> selections at top of screen).</p></li>
<li><p><strong>Start linear simulator</strong> (<code>lsimon</code> selection). The simulator reacts to changes in aol5_dmdisp (= dm04disp)</p></li>
</ul>
</div>
</div>
</div>
<div id="aoloopcontrol-setup-and-overview" class="section level1">
<h1><span class="header-section-number">4</span> AOloopControl setup and overview</h1>
<div id="gui-description" class="section level2">
<h2><span class="header-section-number">4.1</span> GUI description</h2>
<p>The script <code>aolconf</code> starts the main GUI, from which all setup and control can be done. The GUI consists of several main screens, as shown below.</p>
<div class="figure">
<img src="./figures/aolconfGUIscreens.jpg" title="GUI screens" alt="aolconf GUI screens" />
<p class="caption">aolconf GUI screens</p>
</div>
</div>
<div id="commands-log" class="section level2">
<h2><span class="header-section-number">4.2</span> Commands log</h2>
<p>ALL commands are logged by the script :</p>
<pre><code>./aolconfscripts/aollog</code></pre>
<div id="automatically-generated-internal-command-log-very-detailed" class="section level3">
<h3><span class="header-section-number">4.2.1</span> Automatically generated internal command log (very detailed)</h3>
<p><code>aolconf</code> uses the script <code>aolconfscripts/aollog</code> to log commands and status into file <code>./logdir/<UTDATE>/logging/<LOOPNAME>.log</code>. A sym link to <code>aolconf.log</code> is created for convenience, so the log content can be viewed with:</p>
<pre><code>tail -f aolconf.log</code></pre>
<p>Inside the bash script, function <code>aoconflog</code> is used to call <code>aolconfscripts/aollog</code> with the proper loop name, as defined in the main <code>aolconf</code> script:</p>
<pre><code># internal log - logs EVERYTHING
function aoconflog {
./aolconfscripts/aollog "$LOOPNAME" "$@"
}</code></pre>
</div>
<div id="user-provided-usexternal-log-less-verbose" class="section level3">
<h3><span class="header-section-number">4.2.2</span> User-provided UsExternal log (less verbose)</h3>
<p>More important commands are logged simultaneously to the internal log and an external log. The user provides the command to externally log commands. The executable should be in the path, and named <code>aollogext</code>. The syntax is:</p>
<pre><code>./aollogext <string></code></pre>
<p>The string usually consists of the loop name followed by comments.</p>
<p>Inside the bash script, function <code>aoconflogext</code> is used to call <code>aolconfscripts/aollog</code> with the proper loop name, as defined in the main <code>aolconf</code> script:</p>
<pre><code># external log, use for less verbose log
function aoconflogext {
./aolconfscripts/aollog -e "$LOOPNAME" "$@"
}</code></pre>
</div>
<div id="interactive-user-log" class="section level3">
<h3><span class="header-section-number">4.2.3</span> Interactive user log</h3>
<p>To start the interactive log script:</p>
<pre><code>./aolconfscripts/aollog -i <LOOPNAME> NULL</code></pre>
<p>Entries will be logged in the <code>./logdir/<UTDATE>/logging/<LOOPNAME>.log</code> file (with sym link to <code>aolconf.log</code>).</p>
<p>It is also common practice to start a <code>MISC</code> log for misc comments, also to be included in the external log:</p>
<pre><code>./aolconfscripts/aollog -ie MISC NULL</code></pre>
<p>The corresponding log can be viewed by:</p>
<pre><code>tail -f logdit/<UTDATE>/logging/MISC.log</code></pre>
</div>
</div>
</div>
<div id="setting-up-the-hardware-interfaces" class="section level1">
<h1><span class="header-section-number">5</span> Setting up the hardware interfaces</h1>
<div id="top-level-script" class="section level2">
<h2><span class="header-section-number">5.1</span> Top level script</h2>
<p>Start aolconf with loop number and loop name (you can ommit these arguments when launching the script again):</p>
<pre><code>./aolconf -L 3 -N testsim</code></pre>
<p>The loop name (<code>testsim</code> in the above example) will both allocate a name for the loop and execute an optional custom setup script. The software package comes with a few such pre-made custom scripts for specific systems / examples. When the <code>-N</code> option is specified, the custom setup script <code>./setup/setup_<name></code> is ran. The script may make some of the steps described below optional.</p>
<p>You can check the current loop number and name settings with:</p>
<pre><code>./aolconf -h</code></pre>
<p>The script can also launch a pre-written CPU/OS configuration script named <code>./aocscripts/cpuconfig_<LOOPNAME></code> :</p>
<pre><code>./aolconf -C</code></pre>
</div>
<div id="setting-the-dm-interface" class="section level2">
<h2><span class="header-section-number">5.2</span> Setting the DM interface</h2>
<p>There are four options for setting up the DM:</p>
<ul>
<li><p>[A] Connect to an existing DM</p></li>
<li><p>[B] Create a new DM and connect to it</p></li>
<li><p>[C] Create a new modal DM, mapped to an existing DM using another loop's control modes</p></li>
<li><p>[D] Create a new modal DM, mapped to an existing DM channel using a custom set of modes</p></li>
</ul>
<p>Before choosing an option, select if the DM to be controlled is <code>MODAL</code> or <code>ZONAL</code>. A zonal DM is one where the DM pixel locations map to physical actuator locations on the DM, allowing spatial filtering when creating control modes. With a zonal DM, each pixel of the DM map corresponds to a wavefront control mode, and spatial filtering functions are turned off.</p>
<p>Options [C] and [D] are <code>MODAL</code> options, as the DM does not represent physical spatial actuators. These options build a virtual DM which controls another DM.</p>
<div id="mode-a-connecting-to-an-existing-dm" class="section level3">
<h3><span class="header-section-number">5.2.1</span> Mode [A]: Connecting to an existing DM</h3>
<ol style="list-style-type: decimal">
<li><p><strong>Set DM number</strong> (<code>S</code> command in <code>Top Menu</code> screen). You should see its x and y size in the two lines below. If not, the DM does not exist yet (see next section).</p></li>
<li><strong>autoconfigure DM: main DM (nolink)</strong> (<code>nolink</code> in <code>Top Menu</code> screen). This command automactically sets up the following symbolic links:
<ul>
<li>dm##disp00 is linked to aol#_dmO (flat offset channel)</li>
<li>dm##disp02 is linked to aol#_dmRM (response matrix actuation channel)</li>
<li>dm##disp03 is linked to aol#_dmC (loop dm control channel)</li>
<li>dm##disp04 is linked to aol#_dmZP0 (zero point offset 0 actuation channel)</li>
<li>dm##disp05 is linked to aol#_dmZP1 (zero point offset 1 actuation channel)</li>
<li>dm##disp06 is linked to aol#_dmZP2 (zero point offset 2 actuation channel)</li>
<li>dm##disp07 is linked to aol#_dmZP3 (zero point offset 3 actuation channel)</li>
<li>dm##disp08 is linked to aol#_dmZP4 (zero point offset 4 actuation channel)</li>
<li>dm##disp is linked to aol#_dmdisp (total dm displacement channel)</li>
</ul></li>
<li><p><strong>load Memory</strong> (<code>M</code> in <code>Top Menu</code> screen). The dm performs the symbolic links to the DM channels.</p></li>
</ol>
</div>
<div id="mode-b-creating-and-connecting-to-a-dm" class="section level3">
<h3><span class="header-section-number">5.2.2</span> Mode [B]: Creating and Connecting to a DM</h3>
<ol style="list-style-type: decimal">
<li><p>Set <strong>DM number</strong> (<code>S</code> command in <code>Top Menu</code> screen).</p></li>
<li><p>Enter the desired <strong>DM size</strong> with the <code>dmxs</code> and <code>dmys</code> commands.</p></li>
</ol>
<ul>
<li>OPTIONAL: <strong>set DM delay</strong> ('setDMdelayON' and 'setDMdelayval' in <code>Top Menu</code> screen)</li>
</ul>
<ol start="3" style="list-style-type: decimal">
<li><p><strong>Create the DM streams</strong> with the <code>initDM</code> command in the <code>Top Menu</code>. You may need to run the <code>stopDM</code> command first.</p></li>
<li><strong>autoconfigure DM: main DM (nolink)</strong> (<code>nolink</code> in <code>Top Menu</code> screen). This command automactically sets up the following symbolic links:
<ul>
<li>dm##disp00 is linked to aol#_dmO (flat offset channel)</li>
<li>dm##disp02 is linked to aol#_dmRM (response matrix actuation channel)</li>
<li>dm##disp03 is linked to aol#_dmC (loop dm control channel)</li>
<li>dm##disp04 is linked to aol#_dmZP0 (zero point offset 0 actuation channel)</li>
<li>dm##disp05 is linked to aol#_dmZP1 (zero point offset 1 actuation channel)</li>
<li>dm##disp06 is linked to aol#_dmZP2 (zero point offset 2 actuation channel)</li>
<li>dm##disp07 is linked to aol#_dmZP3 (zero point offset 3 actuation channel)</li>
<li>dm##disp08 is linked to aol#_dmZP4 (zero point offset 4 actuation channel)</li>
<li>dm##disp is linked to aol#_dmdisp (total dm displacement channel)</li>
</ul></li>
<li><p><strong>Load Memory</strong> (<code>M</code> in <code>Top Menu</code> screen). The dm performs the symbolic links to the DM channels.</p></li>
</ol>
</div>
<div id="mode-c-create-a-new-modal-dm-mapped-to-an-existing-dm-using-another-loops-control-modes" class="section level3">
<h3><span class="header-section-number">5.2.3</span> Mode [C]: Create a new modal DM, mapped to an existing DM using another loop's control modes</h3>
<p>In this mode, the AO loop controls a virtual DM. The virtual actuators are correspond to modes controlling the zero point offset of another loop. In this section, I assume that <strong>loopA</strong> is the main loop (directly controls a physical DM) and that <strong>loopB</strong> is the virtual loop (this is the loop we are setting up).</p>
<ol style="list-style-type: decimal">
<li><p>Select <strong>MODAL</strong> DM (<code>DMmodeZ</code> in <code>Top Menu</code> screen)</p></li>
<li><p>Set <strong>DM number</strong> (<code>S</code> command in <code>Top Menu</code> screen). This is the DM index for loopB.</p></li>
<li><p>Set <strong>DM x size</strong> to the number of modes of loop A to be addressed by loop B's virtual DM</p></li>
<li><p>Set <strong>DM y size</strong> to 1</p></li>
<li><strong>Auto-configure: DM output linked to other loop</strong> (<code>dmolink</code> in <code>Top Menu</code> screen).
<ol style="list-style-type: decimal">
<li>choose loop index from which modes will be extracted (loop A index)</li>
<li>choose offset channel in output loop This will set up several key parameters and files:</li>
</ol>
<ul>
<li><strong>DM-to-DM</strong> mode will be set to 1, and associated streams:
<ul>
<li><strong>dm2dmM</strong> : <strong>loopA</strong> modes controlled by <strong>loopB</strong></li>
<li><strong>dm2dmO</strong> : symbolic link to <strong>loopA</strong> DM channel controlled by <strong>loopB</strong></li>