psfao_center.py 770 Bytes
Newer Older
rfetick's avatar
rfetick committed
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
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 12 17:59:23 2021

Show the center convention for Psfao
It is at size/2 for even sized arrays.

@author: rfetick
"""


from maoppy.instrument import zimpol
from maoppy.psfmodel import Psfao
import numpy as np
import matplotlib.pyplot as plt

#%% PARAMETERS
npix = 16
samp = 2.0 # you can choose oversampled or undersampled.

#%% BUILD PSF (without turbulence)
psfmodel = Psfao((npix,npix), system=zimpol, samp=samp)

r0 = 1e5
C = 0
A = 0
alpha = 1
elon = 1
theta = 0
beta = 1.5

param = [r0,C,A,alpha,elon,theta,beta]

psf = psfmodel(param)

#%% PLOT RESULT
c = np.where(psf==psf.max())
c = (c[0][0],c[1][0])
print("For size (%u,%u), the center is at (%u,%u)"%(npix,npix,c[0],c[1]))

plt.figure(1)
plt.clf()
plt.imshow(psf)