Skip to content
Snippets Groups Projects
Commit 0b52ded5 authored by rfetick's avatar rfetick
Browse files

update PsfaoAliasing grad computation

parent cb65b157
No related branches found
No related tags found
No related merge requests found
......@@ -745,39 +745,27 @@ class Psfao(ParametricPSFfromPSD):
class PsfaoAliasing(Psfao):
"""Ignore background and use aliasing instead"""
def psd(self, parampsd, *args, grad=False, fovnorm=False, **kwargs):
def psd(self, parampsd, *args, grad=False, **kwargs):
# parampsd can be called with a dictionary
if isinstance(parampsd,dict):
parampsd = self.dict2list(parampsd)
r0 = parampsd[0]
bck = self.system.aliasing*0.0229*6/5* r0**(-5/3) * self.cutoffAOfreq**(-11/3)
dbck_dr0 = -5/3 * bck/r0
parampsd[1] = bck
out = super().psd(parampsd, *args, grad=grad, **kwargs)
if grad:
# I need to update the gradient and its integral!
psd, integral, gg, _ = out
gg[0,...] += self._maskin * dbck_dr0
psd, integral, gg, integral_g = out
dbck_dr0 = -5/3 * bck/r0
newbckmsk = dbck_dr0*self._maskin
gg[0,...] += newbckmsk
integral_g[0] += np.sum(newbckmsk) * self.pix2freq**2
gg[1,...] = 0
integral_g = np.zeros(len(parampsd))
pix = self.pix2freq
if fovnorm:
for i in range(len(parampsd)):
integral_g[i] = np.sum(gg[i,...]) * pix**2 # numerical sum
else:
nx0,ny0 = self._nullFreqIndex
fmax = np.min([nx0,ny0])*pix
integral_out = 0.0229*6*np.pi/5 * (r0*fmax)**(-5./3.) # analytical sum outside
for i in range(len(parampsd)):
integral_g[i] = np.sum(gg[i,...]*(self._f2<(fmax**2))) * pix**2 # numerical sum
integral_g[0] += integral_out*(-5./3)/r0
psd, integral, gg, integral_g
integral_g[1] = 0
return psd, integral, gg, integral_g
return out
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment