Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LAM-GRD-public
maoppy
Commits
7d6b57d9
Commit
7d6b57d9
authored
Nov 25, 2020
by
rfetick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace / by // into Moffat, disable lru_cache
parent
81857514
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
maoppy/psfmodel.py
maoppy/psfmodel.py
+10
-5
No files found.
maoppy/psfmodel.py
View file @
7d6b57d9
...
...
@@ -13,7 +13,7 @@ import time as _time
import
numpy.fft
as
_fft
# import fft2, fftshift, ifft2
import
sys
as
_sys
from
maoppy.utils
import
binning
as
_binning
from
functools
import
lru_cache
as
_lru_cache
#
from functools import lru_cache as _lru_cache
# Value to compute finite differences
_EPSILON
=
_np
.
sqrt
(
_sys
.
float_info
.
epsilon
)
...
...
@@ -351,8 +351,8 @@ class Moffat(ParametricPSF):
self
.
bounds
=
(
bounds_down
,
bounds_up
)
self
.
_XY
=
_np
.
mgrid
[
0
:
Npix
[
0
],
0
:
Npix
[
1
]]
self
.
_XY
[
1
]
-=
Npix
[
0
]
/
2
self
.
_XY
[
0
]
-=
Npix
[
1
]
/
2
self
.
_XY
[
1
]
-=
Npix
[
0
]
/
/
2
self
.
_XY
[
0
]
-=
Npix
[
1
]
/
/
2
def
__call__
(
self
,
x
,
dx
=
0
,
dy
=
0
):
"""
...
...
@@ -446,22 +446,26 @@ class ParametricPSFfromPSD(ParametricPSF):
return
OTF_TURBULENT
*
OTF_DIFFRACTION
*
OTF_SHIFT
#@_lru_cache(maxsize=2)
def
getpix2freq
(
self
):
"""
pixel to frequency conversion in the PSD plane
"""
return
1.0
/
(
self
.
system
.
D
*
self
.
_samp_over
)
#@_lru_cache(maxsize=2)
def
getnxny_over
(
self
):
"""
Return the number of pixels for the correctly sampled array (at least at Shannon-Nyquist)
"""
return
self
.
Npix
[
0
]
*
self
.
_k
,
self
.
Npix
[
1
]
*
self
.
_k
#@_lru_cache(maxsize=2)
def
get_null_freq_index
(
self
):
nx
,
ny
=
self
.
getnxny_over
()
return
nx
//
2
,
ny
//
2
#@_lru_cache(maxsize=2)
def
getfxfy
(
self
):
"""
Return the array of frequencies (correctly sampled above Shannon-Nyquist)
...
...
@@ -484,7 +488,7 @@ class ParametricPSFfromPSD(ParametricPSF):
Dphi
=
_fft
.
fftshift
(
_np
.
real
(
2
*
(
integral
-
Bg
)))
# normalized up to infinity
return
_np
.
exp
(
-
Dphi
/
2.
)
@
_lru_cache
(
maxsize
=
2
)
#
@_lru_cache(maxsize=2)
def
_otf_diffraction
(
self
):
Nx_over
=
self
.
Npix
[
0
]
*
self
.
_k
Ny_over
=
self
.
Npix
[
1
]
*
self
.
_k
...
...
@@ -495,6 +499,7 @@ class ParametricPSFfromPSD(ParametricPSF):
tab
[
0
:
int
(
NpupX
),
0
:
int
(
NpupY
)]
=
self
.
system
.
pupil
((
NpupX
,
NpupY
),
samp
=
self
.
_samp_over
)
return
_fft
.
fftshift
(
_np
.
abs
(
_fft
.
ifft2
(
_np
.
abs
(
_fft
.
fft2
(
tab
))
**
2
))
/
_np
.
sum
(
tab
))
#@_lru_cache(maxsize=2)
def
_otf_shift
(
self
,
dx
,
dy
):
Nx_over
=
self
.
Npix
[
0
]
*
self
.
_k
Ny_over
=
self
.
Npix
[
1
]
*
self
.
_k
...
...
@@ -591,7 +596,7 @@ class Turbulent(ParametricPSFfromPSD):
return
PSD
,
integral
#%% PSFAO MODEL
#%% PSFAO MODEL
class
Psfao
(
ParametricPSFfromPSD
):
"""
Summary
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment