Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove numerous warnings #24

Merged
merged 1 commit into from
Jun 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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())