Skip to content

Commit

Permalink
Merge pull request #24 from lsst/tickets/DM-6581
Browse files Browse the repository at this point in the history
remove numerous warnings
  • Loading branch information
djreiss committed Jun 17, 2016
2 parents 78d3a56 + 729d3c6 commit bd099b0
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions python/lsst/ip/diffim/dipoleFitTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#

import numpy as np
import warnings

# LSST imports
import lsst.afw.geom as afwGeom
Expand Down Expand Up @@ -650,13 +651,16 @@ def dipoleModelFunctor(x, flux, xcenPos, ycenPos, xcenNeg, ycenNeg, fluxNeg=None
# Note that although we can, we're not required to set initial values for params here,
# since we set their param_hint's above.
# Can add "method" param to not use 'leastsq' (==levenberg-marquardt), e.g. "method='nelder'"
result = gmod.fit(z, weights=weights, x=in_x,
verbose=verbose,
fit_kws={'ftol': tol, 'xtol': tol, 'gtol': tol, 'maxfev': 250}, # see scipy docs
psf=self.diffim.getPsf(), # hereon: kwargs that get passed to genDipoleModel()
rel_weight=rel_weight,
footprint=fp,
modelObj=dipoleModel)
with warnings.catch_warnings():
warnings.simplefilter("ignore") # temporarily turn off silly lmfit warnings
result = gmod.fit(z, weights=weights, x=in_x,
verbose=verbose,
fit_kws={'ftol': tol, 'xtol': tol, 'gtol': tol,
'maxfev': 250}, # see scipy docs
psf=self.diffim.getPsf(), # hereon: kwargs that get passed to genDipoleModel()
rel_weight=rel_weight,
footprint=fp,
modelObj=dipoleModel)

if verbose: # the ci_report() seems to fail if neg params are constrained -- TBD why.
# Never wanted in production - this takes a long time (longer than the fit!)
Expand Down Expand Up @@ -1042,7 +1046,8 @@ def fail(self, measRecord, error=None):
self.log.warn('DipoleFitPlugin failed on record %d: %s' % (measRecord.getId(), str(error)))
measRecord.set(self.flagKey, True)
if error.getFlagBit() == self.FAILURE_NOT_DIPOLE:
self.log.warn('DipoleFitPlugin not run on record %d: %s' % (measRecord.getId(), str(error)))
self.log.log(self.log.DEBUG, 'DipoleFitPlugin not run on record %d: %s' %
(measRecord.getId(), str(error)))
measRecord.set(self.flagKey, True)
else:
self.log.warn('DipoleFitPlugin failed on record %d' % measRecord.getId())

0 comments on commit bd099b0

Please sign in to comment.