diff --git a/sealrtc/optics/__init__.py b/sealrtc/optics/__init__.py index 1d94b52..c723cd7 100644 --- a/sealrtc/optics/__init__.py +++ b/sealrtc/optics/__init__.py @@ -12,6 +12,7 @@ def make_optics(): mode = "simulation" print(f"SEAL Real-Time Controller running in {mode} mode.") + return optics from .flatten import flatten from .align import align diff --git a/sealrtc/optics/align.py b/sealrtc/optics/align.py index 708b98c..a91b43d 100644 --- a/sealrtc/optics/align.py +++ b/sealrtc/optics/align.py @@ -54,7 +54,8 @@ def applytiptilt(amptip,amptilt,bestflat=bestflat): #amp is the P2V in DM units cenmaskradmax, cenmaskradmin = 49, 10 #mask radii for central lobe, ignoring central part where the pinhole PSF is (if not ignored, this would bias the alignment algorithm) cenmaskind = np.where( np.logical_and( - cenmaskrho < cenmaskradmax,cenmaskrho > cenmaskradmin + cenmaskrho < cenmaskradmax, + cenmaskrho > cenmaskradmin ) ) cenmask[cenmaskind] = 1 @@ -73,7 +74,7 @@ def applytiptilt(amptip,amptilt,bestflat=bestflat): #amp is the P2V in DM units cenfraction=np.sum(mtfopt[cenmaskind])/np.sum(mtfopt) ttoptarr[i,j]=sidefraction+0.1/cenfraction #the factor of 0.01 is a relative weight; because we only expect the fringe visibility to max out at a few %, this attempts to give equal weight to both terms - medttoptarr = median_filter(ttoptarr, 3) #smooth out hot pizels, attenuating noise issues + medttoptarr = median_filter(ttoptarr, 3) #smooth out hot pixels, attenuating noise issues indopttip, indopttilt = np.where( medttoptarr == np.max(medttoptarr) ) @@ -94,7 +95,7 @@ def applytiptilt(amptip,amptilt,bestflat=bestflat): #amp is the P2V in DM units cenfraction = np.sum(mtfopt[cenmaskind])/np.sum(mtfopt) ttoptarr1[i,j] = sidefraction+0.1/cenfraction - medttoptarr1 = median_filter(ttoptarr1, 3) #smooth out hot pizels, attenuating noise issues + medttoptarr1 = median_filter(ttoptarr1, 3) #smooth out hot pixels, attenuating noise issues indopttip1, indopttilt1 = np.where(medttoptarr1 == np.max(medttoptarr1)) applytiptilt(tipamparr[indopttip1][0],tiltamparr[indopttilt1][0]) diff --git a/sealrtc/optics/flatten.py b/sealrtc/optics/flatten.py index 6e22d8a..002854c 100644 --- a/sealrtc/optics/flatten.py +++ b/sealrtc/optics/flatten.py @@ -127,10 +127,10 @@ def vcmd(rcond): #view the reconstructed DM commands, making sure that waffle mo #ds9.view(np.flipud(cmd.reshape(dmcini.shape))) #reference slopes from commented out code above preamble - refslopes=np.load(joindata('refslopes/refSlopes4ALPAOflat.npy')) + refslopes=np.load(joindata("refslopes", "refSlopes4ALPAOflat.npy")) rcond=3e-1 - cmd_mtx=np.linalg.pinv(IM,rcond=rcond) + cmd_mtx = np.linalg.pinv(IM, rcond=rcond) numiter=20 #convergence seems around this many iterations for a gain of 0.5 gain=0.5 leak=1 diff --git a/sealrtc/optics/optics.py b/sealrtc/optics/optics.py index ed977d5..affb8db 100644 --- a/sealrtc/optics/optics.py +++ b/sealrtc/optics/optics.py @@ -71,7 +71,6 @@ def set_process_vars(self): for (i, (n, m)) in enumerate(nmarr): self.zernarr[i] = self.funz(n, m)[self.indap] - self.make_im_cm() def processim(self, imin): #process SCC image, isolating the sidelobe in the FFT and IFFT back to the image