Commit b3de27f8 authored by FETICK Romain's avatar FETICK Romain
Browse files

Resolve conflict in psfmodel.py lines 804-816

parents 933d1c00 ede2e2e9
...@@ -2,7 +2,7 @@ d: 8.0 ...@@ -2,7 +2,7 @@ d: 8.0
filters: {} filters: {}
fullname: VLT MUSE (NFM) fullname: VLT MUSE (NFM)
gain: 5.0 gain: 5.0
nact: 39 nact: 34
name: MUSE_NFM name: MUSE_NFM
occ: 0.14 occ: 0.14
phasemask_path: null phasemask_path: null
......
...@@ -19,9 +19,21 @@ from maoppy.utils import binning as _binning ...@@ -19,9 +19,21 @@ from maoppy.utils import binning as _binning
_EPSILON = _np.sqrt(_sys.float_info.epsilon) _EPSILON = _np.sqrt(_sys.float_info.epsilon)
#%% FUNCTIONS #%% FUNCTIONS
def oversample(samp): def oversample(samp, fixed_k = None):
"""Find the minimal integer that allows oversampling""" """
k = int(_np.ceil(2.0/samp)) Find the minimal integer that allows oversampling
Args:
samp (float): input sampling
fixed_k (int, optional): Oversampling factor to be fixed. Defaults to None.
Returns:
(k*samp, k): the oversampling (>=2) and the corresponding oversampling factor
"""
if fixed_k == None:
k = int(_np.ceil(2.0/samp))
else:
k = fixed_k
return (k*samp,k) return (k*samp,k)
#%% FITTING #%% FITTING
...@@ -442,17 +454,20 @@ class Gaussian(ParametricPSF): ...@@ -442,17 +454,20 @@ class Gaussian(ParametricPSF):
#%% MASTER CLASS #%% MASTER CLASS
class ParametricPSFfromPSD(ParametricPSF): class ParametricPSFfromPSD(ParametricPSF):
"""This class is NOT to be instantiated""" """This class is NOT to be instantiated"""
def __init__(self,nparam,npix,system=None,samp=None): def __init__(self,nparam,npix,system=None,samp=None, fixed_k = None):
if not (type(npix) in [tuple,list,_np.ndarray]): raise ValueError("npix must be a tuple, list or numpy.ndarray") if not (type(npix) in [tuple,list,_np.ndarray]): raise ValueError("npix must be a tuple, list or numpy.ndarray")
if len(npix)!=2: raise ValueError("npix must be of length = 2") if len(npix)!=2: raise ValueError("npix must be of length = 2")
if (npix[0]%2) or (npix[1]%2): raise ValueError("Each npix component must be even") if (npix[0]%2) or (npix[1]%2): raise ValueError("Each npix component must be even")
if system is None: raise ValueError("Keyword `system` must be defined") if system is None: raise ValueError("Keyword `system` must be defined")
if samp is None: raise ValueError("Keyword `samp` must be defined") if samp is None: raise ValueError("Keyword `samp` must be defined")
self.fixed_k = fixed_k
self._npix = npix # "_" to bypass the _xyarray update, that will be made with samp setter self._npix = npix # "_" to bypass the _xyarray update, that will be made with samp setter
self.samp = samp # also init _xyarray self.samp = samp # also init _xyarray
self.system = system self.system = system
self._nparam = nparam self._nparam = nparam
@property @property
def npix(self): def npix(self):
return self._npix return self._npix
...@@ -467,9 +482,9 @@ class ParametricPSFfromPSD(ParametricPSF): ...@@ -467,9 +482,9 @@ class ParametricPSFfromPSD(ParametricPSF):
return self._samp_over/self._k return self._samp_over/self._k
@samp.setter @samp.setter
def samp(self,value): def samp(self, value):
# Manage cases of undersampling # Manage cases of undersampling
self._samp_over, self._k = oversample(value) self._samp_over, self._k = oversample(value, fixed_k = self.fixed_k)
self._computeXYarray() self._computeXYarray()
def _computeXYarray(self): def _computeXYarray(self):
...@@ -725,7 +740,7 @@ class Psfao(ParametricPSFfromPSD): ...@@ -725,7 +740,7 @@ class Psfao(ParametricPSFfromPSD):
--------- ---------
Fétick et al., August 2019, A&A, Vol.628 Fétick et al., August 2019, A&A, Vol.628
""" """
def __init__(self,npix,system=None,Lext=10.,samp=None): def __init__(self,npix,system=None,Lext=10.,samp=None, fixed_k = None):
""" """
Parameters Parameters
---------- ----------
...@@ -739,7 +754,7 @@ class Psfao(ParametricPSFfromPSD): ...@@ -739,7 +754,7 @@ class Psfao(ParametricPSFfromPSD):
Von-Karman external scale (default = 10 m) Von-Karman external scale (default = 10 m)
Useless if Fao >> 1/Lext Useless if Fao >> 1/Lext
""" """
super().__init__(7,npix,system=system,samp=samp) super().__init__(7,npix,system=system,samp=samp,fixed_k=fixed_k)
self.Lext = Lext self.Lext = Lext
# r0,C,A,alpha,ratio,theta,beta # r0,C,A,alpha,ratio,theta,beta
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment