COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
shesha.widgets.testNoise Namespace Reference

Functions

def testNoise (noise=0.9, niter=100, close_loop=True)
 

Variables

list errscreenList = []
 
list imagesErrList = []
 
list imagesHRErrList = []
 
list slopesErrList = []
 
list subErrList = []
 
 errscreen
 
 imagesErr
 
 imagesHRErr
 
 slopesErr
 
 subErr
 

Function Documentation

◆ testNoise()

def shesha.widgets.testNoise.testNoise (   noise = 0.9,
  niter = 100,
  close_loop = True 
)

Definition at line 6 of file testNoise.py.

6 def testNoise(noise=0.9, niter=100, close_loop=True):
7 
8  s1 = np.zeros(((niter, int(wao.sim.config.p_controller0.nvalid * 2))))
9  s2 = np.zeros(((niter, int(wao.sim.config.p_controller0.nvalid * 2))))
10  sub1 = np.zeros(((niter, int(wao.sim.config.p_controller0.nvalid))))
11  sub2 = np.zeros(((niter, int(wao.sim.config.p_controller0.nvalid))))
12  dimim = wao.sim.wfs.get_pyrimg(0).shape[0]
13  dimimHR = wao.sim.wfs.get_pyrimghr(0).shape[0]
14  dimscreen = wao.sim.atm.get_screen(0).shape[0]
15  im1 = np.zeros(((niter, dimim, dimim)))
16  im2 = np.zeros(((niter, dimim, dimim)))
17  #im1HR = np.zeros(((niter, dimimHR,dimimHR)))
18  #im2HR = np.zeros(((niter, dimimHR,dimimHR)))
19  screen1 = np.zeros(((niter, dimscreen, dimscreen)))
20  screen2 = np.zeros(((niter, dimscreen, dimscreen)))
21 
22  wao.sim.rtc.set_open_loop(0, 1)
23  wao.sim.atm.set_seed(0, 1234)
24  wao.sim.atm.refresh_screen(0)
25  wao.sim.wfs.set_noise(0, noise)
26  wao.sim.dms.resetdm(b"pzt", 0.)
27  wao.sim.dms.resetdm(b"tt", 0.)
28  if close_loop:
29  wao.sim.rtc.set_open_loop(0, 0)
30  #s1, v1, t1, aiData1, psfLE1 = wao.record_ao_circular_buffer(niter)
31 
32  for k in trange(niter):
33  wao.sim.next()
34  s1[k, :] = wao.sim.rtc.get_centroids(0)
35  sub1[k, :] = wao.sim.rtc.get_intensities(0)
36 
37  im1[k, :, :] = wao.sim.wfs.get_pyrimg(0)
38  # im1HR[k,:,:] = wao.sim.wfs.get_pyrimghr(0)
39  screen1[k, :, :] = wao.sim.atm.get_screen(0)
40  wao.sim.rtc.set_open_loop(0, 1)
41  wao.sim.atm.set_seed(0, 1234)
42  wao.sim.atm.refresh_screen(0)
43  wao.sim.wfs.set_noise(0, noise)
44  wao.sim.dms.resetdm(b"pzt", 0.)
45  wao.sim.dms.resetdm(b"tt", 0.)
46  if close_loop:
47  wao.sim.rtc.set_open_loop(0, 0)
48  #s2, v2, t2, aiData2, psfLE2 = wao.record_ao_circular_buffer(niter)
49 
50  for k in trange(niter):
51  wao.sim.next()
52  s2[k, :] = wao.sim.rtc.get_centroids(0)
53  sub2[k, :] = wao.sim.rtc.get_intensities(0)
54  im2[k, :, :] = wao.sim.wfs.get_pyrimg(0)
55  screen2[k, :, :] = wao.sim.atm.get_screen(0)
56  # im2HR[k,:,:] = wao.sim.wfs.get_pyrimghr(0)
57 
58  screenErr = np.abs(screen2 - screen1).max() / screen1.max()
59  imagesErr = np.abs(im2 - im1).max() / im1.max()
60  subErr = np.abs(sub2 - sub1).max() / sub1.max()
61  # imagesHRErr = np.abs(im2HR-im1HR).max()/im1HR.max()
62  imagesHRErr = 0.
63  slopesErr = np.abs(s2 - s1).max() / s1.max()
64  print("Screen Error =" + str(screenErr))
65  # print("Images HR Error ="+str(imagesHRErr))
66  print("Images Error =" + str(imagesErr))
67  print("Slopes Error =" + str(slopesErr))
68  print("Subsum Error =" + str(subErr))
69 
70  #print(np.abs(psfLE2-psfLE1).max())
71  #print(psfLE1.max())
72  #print(psfLE2.max())
73  return screenErr, imagesErr, imagesHRErr, slopesErr, subErr
74  #plt.figure(1)
75  #plt.clf()
76  #plt.matshow(s2-s1, aspect="auto", fignum=1)
77 
78 
79 #plt.matshow(im2[-1,:,:]-im1[-1,:,:], aspect="auto", fignum=2)
80 

Variable Documentation

◆ errscreen

shesha.widgets.testNoise.errscreen

Definition at line 87 of file testNoise.py.

◆ errscreenList

list shesha.widgets.testNoise.errscreenList = []

Definition at line 81 of file testNoise.py.

◆ imagesErr

shesha.widgets.testNoise.imagesErr

Definition at line 87 of file testNoise.py.

◆ imagesErrList

list shesha.widgets.testNoise.imagesErrList = []

Definition at line 82 of file testNoise.py.

◆ imagesHRErr

shesha.widgets.testNoise.imagesHRErr

Definition at line 87 of file testNoise.py.

◆ imagesHRErrList

list shesha.widgets.testNoise.imagesHRErrList = []

Definition at line 83 of file testNoise.py.

◆ slopesErr

shesha.widgets.testNoise.slopesErr

Definition at line 87 of file testNoise.py.

◆ slopesErrList

list shesha.widgets.testNoise.slopesErrList = []

Definition at line 84 of file testNoise.py.

◆ subErr

shesha.widgets.testNoise.subErr

Definition at line 87 of file testNoise.py.

◆ subErrList

list shesha.widgets.testNoise.subErrList = []

Definition at line 85 of file testNoise.py.