Skip to content

Commit

Permalink
Fix debug logging and display2dArray
Browse files Browse the repository at this point in the history
We want the debug logs to appear if the loglevel is DEBUG.
Plot display was broken because `show()` never got called!
  • Loading branch information
parejkoj committed Mar 25, 2024
1 parent 8cc82d0 commit dd61a0e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions python/lsst/ip/diffim/dipoleFitTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,12 @@ def makeModel(self, x, flux, xcenPos, ycenPos, xcenNeg, ycenNeg, fluxNeg=None,
if fluxNeg is None:
fluxNeg = flux

if self.debug:
self.log.debug('%.2f %.2f %.2f %.2f %.2f %.2f',
flux, fluxNeg, xcenPos, ycenPos, xcenNeg, ycenNeg)
if x1 is not None:
self.log.debug(' %.2f %.2f %.2f', b, x1, y1)
if xy is not None:
self.log.debug(' %.2f %.2f %.2f', xy, x2, y2)
self.log.debug('flux: %.2f fluxNeg: %.2f x+: %.2f x-: %.2f y+: %.2f y-: %.2f ',
flux, fluxNeg, xcenPos, xcenNeg, ycenPos, ycenNeg)
if x1 is not None:
self.log.debug(' b: %.2f x1: %.2f y1: %.2f', b, x1, y1)
if xy is not None:
self.log.debug(' xy: %.2f x2: %.2f y2: %.2f', xy, x2, y2)

posIm = self.makeStarModel(bbox, psf, xcenPos, ycenPos, flux)
negIm = self.makeStarModel(bbox, psf, xcenNeg, ycenNeg, fluxNeg)
Expand Down Expand Up @@ -945,7 +944,6 @@ def display2dArray(arr, title='Data', extent=None):
display2dArray(fit[i, :], 'Model', extent=extent)
plt.subplot(3, 3, i*3+3)
display2dArray(z[i, :] - fit[i, :], 'Residual', extent=extent)
return fig
else:
fig = plt.figure(figsize=(8, 2.5))

Check failure on line 948 in python/lsst/ip/diffim/dipoleFitTask.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

F841

local variable 'fig' is assigned to but never used
plt.subplot(1, 3, 1)
Expand All @@ -954,7 +952,6 @@ def display2dArray(arr, title='Data', extent=None):
display2dArray(fit, 'Model', extent=extent)
plt.subplot(1, 3, 3)
display2dArray(z - fit, 'Residual', extent=extent)
return fig

plt.show()

Expand Down

0 comments on commit dd61a0e

Please sign in to comment.