-
Notifications
You must be signed in to change notification settings - Fork 1
/
AOloopControl.html
3306 lines (3192 loc) · 123 KB
/
AOloopControl.html
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">Aug 28, 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>
<li><a href="#supporting-scripts-aolconfscripts-directory"><span class="toc-section-number">1.5</span> Supporting scripts, aolconfscripts directory</a></li>
<li><a href="#supporting-scripts-.auxscripts-directory"><span class="toc-section-number">1.6</span> Supporting scripts (./auxscripts directory)</a></li>
<li><a href="#hardware-simulation-scripts"><span class="toc-section-number">1.7</span> Hardware simulation scripts</a></li>
</ul></li>
<li><a href="#hardware-simulation"><span class="toc-section-number">2</span> Hardware Simulation</a><ul>
<li><a href="#overview"><span class="toc-section-number">2.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">2.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">2.3</span> METHOD 2: Physical hardware simulation</a><ul>
<li><a href="#running-method-2"><span class="toc-section-number">2.3.1</span> Running Method 2</a></li>
<li><a href="#method-2-output-streams"><span class="toc-section-number">2.3.2</span> Method 2 output streams</a></li>
<li><a href="#processes-and-scripts-details"><span class="toc-section-number">2.3.3</span> Processes and scripts details</a></li>
<li><a href="#ao-loop-control"><span class="toc-section-number">2.3.4</span> AO loop control</a></li>
<li><a href="#processes-and-scripts-system-ouput"><span class="toc-section-number">2.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">2.4</span> METHOD 3: Linear Hardware Simulation</a><ul>
<li><a href="#overview-1"><span class="toc-section-number">2.4.1</span> Overview</a></li>
<li><a href="#setup"><span class="toc-section-number">2.4.2</span> Setup</a></li>
</ul></li>
</ul></li>
<li><a href="#aoloopcontrol-setup-and-overview"><span class="toc-section-number">3</span> AOloopControl setup and overview</a><ul>
<li><a href="#gui-description"><span class="toc-section-number">3.1</span> GUI description</a></li>
<li><a href="#commands-log"><span class="toc-section-number">3.2</span> Commands log</a><ul>
<li><a href="#automatically-generated-internal-command-log-very-detailed"><span class="toc-section-number">3.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">3.2.2</span> User-provided UsExternal log (less verbose)</a></li>
<li><a href="#interactive-user-log"><span class="toc-section-number">3.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">4</span> Setting up the hardware interfaces</a><ul>
<li><a href="#top-level-script"><span class="toc-section-number">4.1</span> Top level script</a></li>
<li><a href="#setting-the-dm-interface"><span class="toc-section-number">4.2</span> Setting the DM interface</a><ul>
<li><a href="#mode-a-connecting-to-an-existing-dm"><span class="toc-section-number">4.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">4.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">4.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">4.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">4.2.5</span> Option: WFS Zero point offset</a></li>
<li><a href="#notes"><span class="toc-section-number">4.2.6</span> Notes</a></li>
</ul></li>
<li><a href="#setting-the-camera-interface"><span class="toc-section-number">4.3</span> Setting the camera interface</a></li>
<li><a href="#setup-script"><span class="toc-section-number">4.4</span> Setup script</a></li>
</ul></li>
<li><a href="#calibration"><span class="toc-section-number">5</span> Calibration</a><ul>
<li><a href="#acquiring-a-zonal-response-matrix"><span class="toc-section-number">5.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">5.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">5.3</span> Automatic system calibration (recommended)</a></li>
<li><a href="#managing-configurations"><span class="toc-section-number">5.4</span> Managing configurations</a></li>
</ul></li>
<li><a href="#building-control-matrix"><span class="toc-section-number">6</span> Building control matrix</a></li>
<li><a href="#running-the-loop-choosing-hardware-mode-cpugpu"><span class="toc-section-number">7</span> Running the loop: Choosing hardware mode (CPU/GPU)</a></li>
<li><a href="#auxilliary-processes"><span class="toc-section-number">8</span> Auxilliary processes</a><ul>
<li><a href="#extract-wfs-modes"><span class="toc-section-number">8.1</span> Extract WFS modes</a></li>
<li><a href="#extract-open-loop-modes"><span class="toc-section-number">8.2</span> Extract open loop modes</a></li>
<li><a href="#running-average-of-dmc"><span class="toc-section-number">8.3</span> Running average of dmC</a></li>
<li><a href="#compute-and-average-wfsres"><span class="toc-section-number">8.4</span> Compute and average wfsres</a></li>
</ul></li>
<li><a href="#offsetting"><span class="toc-section-number">9</span> Offsetting</a><ul>
<li><a href="#converting-dm-offsets-to-wfs-offsets-zonal-cpu-mode"><span class="toc-section-number">9.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">9.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">9.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">9.4</span> Summing and applying WFS offsets to aolN_wfsref</a></li>
<li><a href="#wfs-average-offset"><span class="toc-section-number">9.5</span> WFS average offset</a></li>
</ul></li>
<li><a href="#controlling-offsets-from-another-loop"><span class="toc-section-number">10</span> Controlling offsets from another loop</a><ul>
<li><a href="#running-the-loop"><span class="toc-section-number">10.1</span> Running the loop</a></li>
</ul></li>
<li><a href="#predictive-control-experimental"><span class="toc-section-number">11</span> Predictive control (experimental)</a><ul>
<li><a href="#overview-2"><span class="toc-section-number">11.1</span> Overview</a></li>
<li><a href="#scripts"><span class="toc-section-number">11.2</span> Scripts</a></li>
<li><a href="#data-flow"><span class="toc-section-number">11.3</span> Data flow</a></li>
</ul></li>
<li><a href="#reference-conventions"><span class="toc-section-number">12</span> REFERENCE, CONVENTIONS</a><ul>
<li><a href="#linking-to-existing-stream"><span class="toc-section-number">12.1</span> Linking to existing stream</a></li>
<li><a href="#loading-images-from-fits-to-shared-memory-stream"><span class="toc-section-number">12.2</span> Loading images from FITS to shared memory stream</a><ul>
<li><a href="#overview-3"><span class="toc-section-number">12.2.1</span> Overview</a></li>
<li><a href="#detailed-description"><span class="toc-section-number">12.2.2</span> Detailed description</a></li>
</ul></li>
</ul></li>
<li><a href="#reference-content-of-.conf-directory"><span class="toc-section-number">13</span> REFERENCE: Content of ./conf directory</a><ul>
<li><a href="#overview-4"><span class="toc-section-number">13.1</span> Overview</a></li>
<li><a href="#parameters"><span class="toc-section-number">13.2</span> Parameters</a><ul>
<li><a href="#overall-and-misc"><span class="toc-section-number">13.2.1</span> Overall and misc</a></li>
<li><a href="#linear-hardware-simulator"><span class="toc-section-number">13.2.2</span> Linear Hardware Simulator</a></li>
<li><a href="#dm"><span class="toc-section-number">13.2.3</span> DM</a></li>
<li><a href="#timing"><span class="toc-section-number">13.2.4</span> Timing</a></li>
<li><a href="#response-matrix-acquisition"><span class="toc-section-number">13.2.5</span> Response Matrix acquisition</a></li>
<li><a href="#modess-and-control-matrix-computation"><span class="toc-section-number">13.2.6</span> Modess and Control Matrix computation</a></li>
<li><a href="#loop-control"><span class="toc-section-number">13.2.7</span> Loop Control</a></li>
</ul></li>
<li><a href="#stream-links"><span class="toc-section-number">13.3</span> Stream Links</a></li>
<li><a href="#shared-memory-fits-file-initializations-to-streams"><span class="toc-section-number">13.4</span> Shared memory FITS file initializations to streams</a></li>
<li><a href="#fits-files"><span class="toc-section-number">13.5</span> FITS files</a></li>
</ul></li>
<li><a href="#reference-content-of-.status-directory"><span class="toc-section-number">14</span> REFERENCE: Content of ./status directory</a></li>
<li><a href="#reference-additional-pages"><span class="toc-section-number">15</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</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 by executing from the source directory the 'syncscript -e' command:</p>
<pre><code>mkdir /<workdir>
cd <srcdir>/src/AOloopControl/scripts
./syncscripts -e /<workdir>
cd /<workdir>
./syncscripts</code></pre>
<p>Symbolic links to the source scripts and executable are now installed in the work directory :</p>
<pre><code>olivier@ubuntu:/data/AOloopControl/AOloop1$ ls -l
total 28
drwxrwxr-x 2 olivier olivier 4096 Feb 21 18:14 aocustomscripts
drwxrwxr-x 2 olivier olivier 4096 Feb 21 18:14 aohardsim
lrwxrwxrwx 1 olivier olivier 57 Feb 21 18:14 aolconf -> /home/olivier/src/Cfits/src/AOloopControl/scripts/aolconf
drwxrwxr-x 2 olivier olivier 4096 Feb 21 18:14 aolconfscripts
lrwxrwxrwx 1 olivier olivier 70 Feb 21 19:08 AOloopControl -> /home/olivier/src/Cfits/src/AOloopControl/scripts/../../../bin/cfitsTK
drwxrwxr-x 2 olivier olivier 4096 Feb 21 18:14 aosetup
drwxrwxr-x 2 olivier olivier 4096 Feb 21 18:14 auxscripts
lrwxrwxrwx 1 olivier olivier 61 Feb 21 18:13 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>
<p>The main 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.</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 > m?
0 cudacomp.c CUDA wrapper for AO loop
1 AtmosphericTurbulence.c Atmospheric Turbulence
2 AtmosphereModel.c Atmosphere Model
3 psf.c memory management for images and variables
4 AOloopControl.c AO loop control
5 AOsystSim.c conversion between image format, I/O
6 AOloopControl_DM.c AO loop Control DM operation
7 OptSystProp.c Optical propagation through system
8 ZernikePolyn.c create and fit Zernike polynomials
9 WFpropagate.c light propagation
10 image_basic.c basic image routines
11 image_filter.c image filtering
12 image_gen.c creating images (shapes, useful functions and patterns)
13 linopt_imtools.c image linear decomposition and optimization tools
14 statistic.c statistics functions and tools
15 fft.c FFTW wrapper
16 info.c image information and statistics
17 COREMOD_arith.c image arithmetic operations
18 COREMOD_iofits.c FITS format input/output
19 COREMOD_memory.c memory management for images and variables
20 COREMOD_tools.c image information and statistics
./AOloopControl > exit
Closing PID 5291 (prompt process)</code></pre>
<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>
</div>
<div id="supporting-scripts-aolconfscripts-directory" class="section level2">
<h2><span class="header-section-number">1.5</span> Supporting scripts, aolconfscripts directory</h2>
<p>Scripts in the <code>aolconfscripts</code> directory are part of the high-level ASCII control GUI</p>
<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>aolconf_DMfuncs</strong></td>
<td align="left">DM functions</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_DMturb</strong></td>
<td align="left">DM turbulence functions</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_funcs</strong></td>
<td align="left">Misc functions</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_logfuncs</strong></td>
<td align="left">data and command logging</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menuconfigureloop</strong></td>
<td align="left">configure loop menu</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_menucontrolloop</strong></td>
<td align="left">control loop menu</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menucontrolmatrix</strong></td>
<td align="left">control matrix menu</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_menu_mkFModes</strong></td>
<td align="left">Make modes</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menurecord</strong></td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_menutestmode</strong></td>
<td align="left">Test mode menu</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_menutop</strong></td>
<td align="left">Top level menu</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_menuview</strong></td>
<td align="left">Data view menu</td>
</tr>
<tr class="odd">
<td align="left"><strong>aolconf_readconf</strong></td>
<td align="left">Configuration read functions</td>
</tr>
<tr class="even">
<td align="left"><strong>aolconf_template</strong></td>
<td align="left">Template (not used)</td>
</tr>
</tbody>
</table>
</div>
<div id="supporting-scripts-.auxscripts-directory" class="section level2">
<h2><span class="header-section-number">1.6</span> Supporting scripts (./auxscripts directory)</h2>
<p>Scripts in 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>The available commands are listed in the table below. Running the command with the <code>-h</code> option prints a short help.</p>
<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">./mkDMslaveActprox</td>
<td align="left">Create DM slaved actuators map</td>
</tr>
<tr class="even">
<td align="left">./aolctr</td>
<td align="left">AO control process</td>
</tr>
<tr class="odd">
<td align="left">./aolPFcoeffs2dmmap</td>
<td align="left">GPU-based predictive filter coeffs -> DM MAP</td>
</tr>
<tr class="even">
<td align="left">./aolInspectDMmap</td>
<td align="left">Inspect DM map</td>
</tr>
<tr class="odd">
<td align="left">./acquRespM</td>
<td align="left">Acquire response matrix</td>
</tr>
<tr class="even">
<td align="left">./waitonfile</td>
<td align="left">Wait for file to disappear</td>
</tr>
<tr class="odd">
<td align="left">./aolRM2CM</td>
<td align="left">Align Pyramid camera</td>
</tr>
<tr class="even">
<td align="left">./aolMeasureLOrespmat</td>
<td align="left">Acquire modal response matrix</td>
</tr>
<tr class="odd">
<td align="left">./aollinsimDelay</td>
<td align="left">Introduce DM delay</td>
</tr>
<tr class="even">
<td align="left">./aolrun</td>
<td align="left">Run AO control loop</td>
</tr>
<tr class="odd">
<td align="left">./aolMeasureZrespmat</td>
<td align="left">Acquire zonal response matrix</td>
</tr>
<tr class="even">
<td align="left">./shmimzero</td>
<td align="left">Set shared memory image stream to zero</td>
</tr>
<tr class="odd">
<td align="left">./aolLinSim</td>
<td align="left">AO Linear Simulator</td>
</tr>
<tr class="even">
<td align="left">./aolmcoeffs2dmmap</td>
<td align="left">GPU-based MODE COEFFS -> DM MAP</td>
</tr>
<tr class="odd">
<td align="left">./MeasDMmodesRec</td>
<td align="left">Measure AO loop DM modes recovery</td>
</tr>
<tr class="even">
<td align="left">./xp2test</td>
<td align="left">Compute cross-product of two data cubes</td>
</tr>
<tr class="odd">
<td align="left">./aolmkLO_DMmodes</td>
<td align="left">Create LO DM modes for AO loop</td>
</tr>
<tr class="even">
<td align="left">./xptest</td>
<td align="left">Compute cross-product of a data cube</td>
</tr>
<tr class="odd">
<td align="left">./aolblockstats</td>
<td align="left">Extract mode values from WFS images, sort per block</td>
</tr>
<tr class="even">
<td align="left">./aolMergeRMmat</td>
<td align="left">Merge HO and LO resp matrices</td>
</tr>
<tr class="odd">
<td align="left">./aolscangain</td>
<td align="left">AO scan gain for optimal value</td>
</tr>
<tr class="even">
<td align="left">./aolARPFautoUpdate</td>
<td align="left">Automatic update of AR linear predictive filter</td>
</tr>
<tr class="odd">
<td align="left">./aolMeasureLOrespmat2</td>
<td align="left">Acquire modal response matrix</td>
</tr>
<tr class="even">
<td align="left">./aolgetshmimsize</td>
<td align="left">Get shared memory image size</td>
</tr>
<tr class="odd">
<td align="left">./aolWFSresoffloadloop</td>
<td align="left">Compute real-time WFS residual image</td>
</tr>
<tr class="even">
<td align="left">./alignPyrTT</td>
<td align="left">Align Pyramid TT</td>
</tr>
<tr class="odd">
<td align="left">./aolmkmodes2</td>
<td align="left">Create modes for AO loop</td>
</tr>
<tr class="even">
<td align="left">./aolmkMasks</td>
<td align="left">Create AO wfs and DM masks</td>
</tr>
<tr class="odd">
<td align="left">./modesextractwfs</td>
<td align="left">Extract mode values from WFS images</td>
</tr>
<tr class="even">
<td align="left">./aolARPFautoApply</td>
<td align="left">Apply real-time AR linear predictive filter</td>
</tr>
<tr class="odd">
<td align="left">./aolmon</td>
<td align="left">Display AO loop stats</td>
</tr>
<tr class="even">
<td align="left">./aolRMmeas_sensitivity</td>
<td align="left">Measure photon sensitivity of zonal response matrix</td>
</tr>
<tr class="odd">
<td align="left">./mkHpoke</td>
<td align="left">Compute real-time WFS residual image</td>
</tr>
<tr class="even">
<td align="left">./aoloffloadloop</td>
<td align="left">DM offload loop</td>
</tr>
<tr class="odd">
<td align="left">./Fits2shm</td>
<td align="left">Copy FITS files to shared memor</td>
</tr>
<tr class="even">
<td align="left">./aolMeasureZrespmat2</td>
<td align="left">Acquire zonal response matrix</td>
</tr>
<tr class="odd">
<td align="left">./aolApplyARPF</td>
<td align="left">Apply AR linear predictive filter</td>
</tr>
<tr class="even">
<td align="left">./selectLatestTelemetry</td>
<td align="left">Compute real-time WFS residual image</td>
</tr>
<tr class="odd">
<td align="left">./aolReadConfFile</td>
<td align="left">AOloop load file to stream</td>
</tr>
<tr class="even">
<td align="left">./predFiltApplyRT</td>
<td align="left">Apply predictive filter to stream</td>
</tr>
<tr class="odd">
<td align="left">./aolCleanZrespmat2</td>
<td align="left">Cleans zonal resp matrix</td>
</tr>
<tr class="even">
<td align="left">./processTelemetryPSDs</td>
<td align="left">Process telemetry: create open and closed loop PSDs</td>
</tr>
<tr class="odd">
<td align="left">./listrunproc</td>
<td align="left">List running AOloop processes</td>
</tr>
<tr class="even">
<td align="left">./aolmkmodesM</td>
<td align="left">CREATE CM MODES FOR AO LOOP, MODAL DM</td>
</tr>
<tr class="odd">
<td align="left">./aolCleanZrespmat</td>
<td align="left">Cleans zonal resp matrix</td>
</tr>
<tr class="even">
<td align="left">./waitforfilek</td>
<td align="left">Wait for file to appear and then remove it</td>
</tr>
<tr class="odd">
<td align="left">./aolMeasureTiming</td>
<td align="left">Measure loop timing</td>
</tr>
<tr class="even">
<td align="left">./aolSetmcLimit</td>
<td align="left">Compute real-time WFS residual image</td>
</tr>
<tr class="odd">
<td align="left">./alignPcam</td>
<td align="left">Align Pyramid camera</td>
</tr>
<tr class="even">
<td align="left">./aolmkWFSres</td>
<td align="left">Compute real-time WFS residual image</td>
</tr>
<tr class="odd">
<td align="left">./MeasureLatency</td>
<td align="left">Measure AO system response latency</td>
</tr>
<tr class="even">
<td align="left">./aollindm2wfsim</td>
<td align="left">Convert DM stream to WFS image stream</td>
</tr>
<tr class="odd">
<td align="left">./aolCleanLOrespmat</td>
<td align="left">Measure zonal resp matrix</td>
</tr>
<tr class="even">
<td align="left">./mkDMslaveAct</td>
<td align="left">Create DM slaved actuators map</td>
</tr>
<tr class="odd">
<td align="left">./aolautotunegains</td>
<td align="left">Automatic gain tuning</td>
</tr>
<tr class="even">
<td align="left">./aolARPF</td>
<td align="left">AO find optimal AR linear predictive filter</td>
</tr>
<tr class="odd">
<td align="left">./aolzploopon</td>
<td align="left">WFS zero point offset loop</td>
</tr>
<tr class="even">
<td align="left">./aolApplyARPFblock</td>
<td align="left">Apply AR linear predictive filter (single block)</td>
</tr>
<tr class="odd">
<td align="left">./aolmkmodes</td>
<td align="left">Create modes for AO loop</td>
</tr>
<tr class="even">
<td align="left">./aolARPFblock</td>
<td align="left">AO find optimal AR linear predictive filter (single block)</td>
</tr>
<tr class="odd">
<td align="left">./MeasLoopModeResp</td>
<td align="left">Measure AO loop temporal response</td>
</tr>
<tr class="even">
<td align="left">./aol_dmCave</td>
<td align="left">dmC temporal averaging</td>
</tr>
</tbody>
</table>
</div>
<div id="hardware-simulation-scripts" class="section level2">
<h2><span class="header-section-number">1.7</span> Hardware simulation scripts</h2>
<p>Scripts in the <code>aohardsim</code> directory are called to simulate hardware for testing / simulations.</p>
<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>aosimDMstart</strong></td>
<td align="left">Start simulation DM shared mem</td>
</tr>
<tr class="even">
<td align="left"><strong>aosimDMrun</strong></td>
<td align="left">Simulates physical deformable mirror (DM)</td>
</tr>
<tr class="odd">
<td align="left"><strong>aosimmkWF</strong></td>
<td align="left">creates properly sized wavefronts from pre-computed wavefronts</td>
</tr>
<tr class="even">
<td align="left"><strong>aosimWPyrFS</strong></td>
<td align="left">Simulates WFS</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="hardware-simulation" class="section level1">
<h1><span class="header-section-number">2</span> Hardware Simulation</h1>
<div id="overview" class="section level2">
<h2><span class="header-section-number">2.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">2.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">2.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">2.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">2.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">2.3.3</span> Processes and scripts details</h3>
<div id="process-aosimmkwf" class="section level4">
<h4><span class="header-section-number">2.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">2.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">2.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">2.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">2.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">2.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">2.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">2.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">2.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