Skip to content

Commit 43b24bf

Browse files
committed
Make fit_flux=True the default when init=zero
1 parent a329cfd commit 43b24bf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

piff/pixelgrid.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class PixelGrid(Model):
5757
:param init: Initialization method. [default: None, which uses hsm unless a PSF
5858
class specifies a different default.]
5959
:param fit_flux: If True, the PSF model will include the flux value. This is useful when
60-
this model is an element of a Sum composite PSF. [default: False]
60+
this model is an element of a Sum composite PSF. [default: False,
61+
unless init=='zero', in which case it is automatically True.]
6162
:param logger: A logger object for logging debug info. [default: None]
6263
"""
6364

@@ -149,6 +150,12 @@ def initialize(self, star, logger=None, default_init=None):
149150
# point for most uses of the zero initialization.
150151
params *= 1.e-10
151152

153+
# Also, make sure fit_flux=True. Otherwise, this won't work properly.
154+
if not self._fit_flux:
155+
logger.info('Setting fit_flux=True, since init=zero')
156+
self._fit_flux = True
157+
self.kwargs['fit_flux'] = True
158+
152159
elif init == 'delta':
153160
params = np.zeros(self.size**2)
154161
icenter = self._origin * self.size + self._origin

0 commit comments

Comments
 (0)