Commit 112ff718 authored by skamann's avatar skamann
Browse files

Made code compatible with latest Maoppy version

parent 5be1d0f9
......@@ -114,7 +114,7 @@ def parallel_fit_layer(layer_parameters):
assert isinstance(layer_parameters, FitLayerCall)
if layer_parameters.coordinates is not None:
catalog = pd.merge(layer_parameters.coordinates, init_arguments.catalog[['component', 'magnitude']],
catalog = pd.merge(layer_parameters.coordinates, init_arguments.catalog[['component', 'magnitude', 'psf']],
left_index=True, right_index=True)
else:
catalog = init_arguments.catalog
......
......@@ -611,7 +611,7 @@ class FitLayer(object):
delta_flux = (best_fit[0] / total_flux) / self.fluxes[included_components]
with printoptions(precision=4, suppress=True):
logger.debug("Relative changes in fluxes: {0}".format(delta_flux))
if np.nanmedian(abs(delta_flux)) < 0.005:
if (np.nanmedian(abs(delta_flux)) < 0.005) and iteration > 1:
break
# # for testing, show scatter plot with current residuals and model
......@@ -626,6 +626,7 @@ class FitLayer(object):
# plt.show()
# carry out optimization of PSF and/or source positions
print(psf_parameters_to_fit, position_parameters_to_fit)
if psf_parameters_to_fit is not None or position_parameters_to_fit is not None:
# if any sources are provided for the PSF fit, the method for large layers is used
......
......@@ -375,7 +375,7 @@ class Maoppy(Profile):
self._f = np.array([])
else:
# init MAOPPY code
psf = Psfao(Npix=self.maoppy_shape, system=muse_nfm, samp=self.samp)
psf = Psfao(npix=self.maoppy_shape, system=muse_nfm, samp=self.samp)
# get offsets of centre to nearest lower pixels.
dx = self.xc - int(self.xc)
......@@ -473,7 +473,7 @@ class Maoppy(Profile):
if kwargs:
raise IOError('Unknown argument(s) to call of Maoppy.fwhm: {0}'.format(kwargs))
psf = Psfao(Npix=(30, 30), system=muse_nfm, samp=muse_nfm.samp(wvl))
psf = Psfao(npix=(30, 30), system=muse_nfm, samp=muse_nfm.samp(wvl))
theta = 0.
f = psf((r0, bck, amp, alpha, 1 - e, theta, beta))
......@@ -506,7 +506,7 @@ class Maoppy(Profile):
strehl : float
The Strehl ratio for the current set of parameters.
"""
psf = Psfao(Npix=(30, 30), system=muse_nfm, samp=muse_nfm.samp(self.wvl))
psf = Psfao(npix=(30, 30), system=muse_nfm, samp=muse_nfm.samp(self.wvl))
return psf.strehlOTF((self.r0, self.bck, self.amp, self.alpha, 1 - self.e, self.theta, self.beta))
# Analyytical calculation based on eq. 14 from the paper by Fetick et al. (2019). This seems to underestimate
......
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