Skip to content

Commit

Permalink
Merge branch 'tickets/DM-42999'
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Mar 1, 2024
2 parents 470c3a0 + f481d72 commit 48b254a
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 39 deletions.
2 changes: 1 addition & 1 deletion python/lsst/ip/diffim/dipoleFitTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ def fail(self, measRecord, error=None):
measRecord.set(self.flagKey, True)
if error is not None:
if error.getFlagBit() == self.FAILURE_EDGE:
self.log.warning('DipoleFitPlugin not run on record %d: %s', measRecord.getId(), str(error))
self.log.debug('DipoleFitPlugin not run on record %d: %s', measRecord.getId(), str(error))
measRecord.set(self.edgeFlagKey, True)
if error.getFlagBit() == self.FAILURE_FIT:
self.log.warning('DipoleFitPlugin failed on record %d: %s', measRecord.getId(), str(error))
Expand Down
8 changes: 4 additions & 4 deletions python/lsst/ip/diffim/getTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def getOverlappingExposures(self, inputs):
Parameters
----------
inputs : `dict` of task Inputs, containing:
- coaddExposureRefs : `list`
[`lsst.daf.butler.DeferredDatasetHandle` of
- coaddExposureRefs : `list` \
[`lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure`]
Data references to exposures that might overlap the detector.
- bbox : `lsst.geom.Box2I`
Expand Down Expand Up @@ -373,8 +373,8 @@ def getOverlappingExposures(self, inputs):
Parameters
----------
inputs : `dict` of task Inputs, containing:
- coaddExposureRefs : `list`
[`lsst.daf.butler.DeferredDatasetHandle` of
- coaddExposureRefs : `list` \
[`lsst.daf.butler.DeferredDatasetHandle` of \
`lsst.afw.image.Exposure`]
Data references to exposures that might overlap the detector.
- bbox : `lsst.geom.Box2I`
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/ip/diffim/imageDecorrelation.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def estimateVariancePlane(vplane1, vplane2, c1ft, c2ft):
as a weighted sum of the input variances.
Notes
------
-----
See DMTN-179 Section 5 about the variance plane calculations.
"""
w1 = np.sum(np.real(np.conj(c1ft)*c1ft)) / c1ft.size
Expand Down Expand Up @@ -541,7 +541,7 @@ def calculateVariancePlane(self, vplane1, vplane2, varMean1, varMean2, c1ft, c2f
The variance plane of the difference/score images.
Notes
------
-----
See DMTN-179 Section 5 about the variance plane calculations.
Infs and NaNs are allowed and kept in the returned array.
Expand Down
2 changes: 0 additions & 2 deletions src/BasisLists.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <cmath>
#include <limits>

#include "boost/timer.hpp"

#include "lsst/pex/exceptions/Exception.h"
#include "lsst/daf/base/PropertySet.h"
#include "lsst/afw/image.h"
Expand Down
1 change: 0 additions & 1 deletion src/BuildSpatialKernelVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

#include <memory>
#include "boost/timer.hpp"

#include "Eigen/Core"
#include "Eigen/Cholesky"
Expand Down
14 changes: 7 additions & 7 deletions src/ImageSubtract.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <numeric>
#include <limits>

#include "boost/timer.hpp"
#include "boost/timer/timer.hpp"

#include "Eigen/Core"

Expand Down Expand Up @@ -120,8 +120,7 @@ afwImage::MaskedImage<PixelT> convolveAndSubtract(
bool invert ///< Invert the output difference image
) {

boost::timer t;
t.restart();
boost::timer::cpu_timer t;

afwImage::MaskedImage<PixelT> convolvedMaskedImage(templateImage.getDimensions());
afwMath::ConvolutionControl convolutionControl = afwMath::ConvolutionControl();
Expand All @@ -140,7 +139,8 @@ afwImage::MaskedImage<PixelT> convolveAndSubtract(
convolvedMaskedImage *= -1.0;
}

double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE4.ip.diffim.convolveAndSubtract",
"Total compute time to convolve and subtract : %.2f s", time);

Expand Down Expand Up @@ -171,8 +171,7 @@ afwImage::MaskedImage<PixelT> convolveAndSubtract(
bool invert ///< Invert the output difference image
) {

boost::timer t;
t.restart();
boost::timer::cpu_timer t;

afwImage::MaskedImage<PixelT> convolvedMaskedImage(templateImage.getDimensions());
afwMath::ConvolutionControl convolutionControl = afwMath::ConvolutionControl();
Expand All @@ -193,7 +192,8 @@ afwImage::MaskedImage<PixelT> convolveAndSubtract(
convolvedMaskedImage.getMask()->assign(*scienceMaskedImage.getMask());
convolvedMaskedImage.getVariance()->assign(*scienceMaskedImage.getVariance());

double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE4.ip.diffim.convolveAndSubtract",
"Total compute time to convolve and subtract : %.2f s", time);

Expand Down
1 change: 0 additions & 1 deletion src/KernelCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* @ingroup ip_diffim
*/
#include <stdexcept>
#include "boost/timer.hpp"

#include "lsst/afw/math.h"
#include "lsst/afw/image.h"
Expand Down
36 changes: 16 additions & 20 deletions src/KernelSolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <limits>

#include <memory>
#include "boost/timer.hpp"
#include "boost/timer/timer.hpp"

#include "Eigen/Core"
#include "Eigen/Cholesky"
Expand Down Expand Up @@ -140,8 +140,7 @@ namespace diffim {

Eigen::VectorXd aVec = Eigen::VectorXd::Zero(bVec.size());

boost::timer t;
t.restart();
boost::timer::cpu_timer t;

LOGL_DEBUG("TRACE2.ip.diffim.KernelSolution.solve",
"Solving for kernel");
Expand Down Expand Up @@ -177,7 +176,8 @@ namespace diffim {
}
}

double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE3.ip.diffim.KernelSolution.solve",
"Compute time for matrix math : %.2f s", time);

Expand Down Expand Up @@ -322,8 +322,7 @@ namespace diffim {
unsigned int endCol = goodBBox.getMaxX() + 1;
unsigned int endRow = goodBBox.getMaxY() + 1;

boost::timer t;
t.restart();
boost::timer::cpu_timer t;

/* Eigen representation of input images; only the pixels that are unconvolved in cimage below */
Eigen::MatrixXd eigenTemplate = imageToEigenMatrix(templateImage).block(startRow,
Expand Down Expand Up @@ -366,10 +365,10 @@ namespace diffim {

}

double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE3.ip.diffim.StaticKernelSolution.build",
"Total compute time to do basis convolutions : %.2f s", time);
t.restart();

/*
Load matrix with all values from convolvedEigenList : all images
Expand Down Expand Up @@ -600,8 +599,7 @@ namespace diffim {
}


boost::timer t;
t.restart();
boost::timer::cpu_timer t;

unsigned int const nKernelParameters = basisList.size();
unsigned int const nBackgroundParameters = this->_fitForBackground ? 1 : 0;
Expand Down Expand Up @@ -638,10 +636,10 @@ namespace diffim {

*eiter = eigenC;
}
double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE3.ip.diffim.StaticKernelSolution.buildWithMask",
"Total compute time to do basis convolutions : %.2f s", time);
t.restart();

/* Load matrix with all convolved images */
Eigen::MatrixXd cMat(eigenTemplate.size(), nParameters);
Expand Down Expand Up @@ -720,8 +718,7 @@ namespace diffim {
endCol += 1;
endRow += 1;

boost::timer t;
t.restart();
boost::timer::cpu_timer t;

/* Eigen representation of input images; only the pixels that are unconvolved in cimage below */
Eigen::MatrixXi eMask = maskToEigenMatrix(sMask).block(startRow,
Expand Down Expand Up @@ -799,10 +796,10 @@ namespace diffim {
*eiter = cMat;
}

double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE3.ip.diffim.StaticKernelSolution.build",
"Total compute time to do basis convolutions : %.2f s", time);
t.restart();

/*
Load matrix with all values from convolvedEigenList : all images
Expand Down Expand Up @@ -973,8 +970,7 @@ namespace diffim {
eigenScience.setZero();
eigeniVariance.setZero();

boost::timer t;
t.restart();
boost::timer::cpu_timer t;

int nTerms = 0;
typename std::vector<geom::Box2I>::iterator biter = boxArray.begin();
Expand Down Expand Up @@ -1029,10 +1025,10 @@ namespace diffim {

}

double time = t.elapsed();
t.stop();
double time = 1e-9 * t.elapsed().wall;
LOGL_DEBUG("TRACE3.ip.diffim.MaskedKernelSolution.build",
"Total compute time to do basis convolutions : %.2f s", time);
t.restart();

/*
Load matrix with all values from convolvedEigenList : all images
Expand Down
2 changes: 1 addition & 1 deletion ups/ip_diffim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import lsst.sconsUtils

dependencies = {
"required": ["meas_base", "afw", "numpy", "minuit2", "log", "daf_base"],
"buildRequired": ["pybind11"],
"buildRequired": ["boost_timer", "pybind11"],
}

config = lsst.sconsUtils.Configuration(
Expand Down

0 comments on commit 48b254a

Please sign in to comment.