Skip to content

Commit

Permalink
replace CONST_PTR and PTR macros by std::shared
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Wittgen committed Aug 3, 2021
1 parent 00a9d74 commit 9f97638
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/lsst/ip/diffim/KernelCandidate.h
Expand Up @@ -106,8 +106,8 @@ namespace diffim {
std::shared_ptr<afw::math::Kernel> getKernel(CandidateSwitch cand) const;
double getBackground(CandidateSwitch cand) const;
double getKsum(CandidateSwitch cand) const;
PTR(ImageT) getKernelImage(CandidateSwitch cand) const;
CONST_PTR(ImageT) getImage() const; // For SpatialCellImageCandidate
std::shared_ptr<ImageT> getKernelImage(CandidateSwitch cand) const;
std::shared_ptr<ImageT const> getImage() const; // For SpatialCellImageCandidate
std::shared_ptr<StaticKernelSolution<PixelT> > getKernelSolution(CandidateSwitch cand) const;

/**
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/ip/diffim/KernelPca.h
Expand Up @@ -48,10 +48,10 @@ namespace detail {
lsst::afw::math::KernelList getEigenKernels();
void processCandidate(lsst::afw::math::SpatialCellCandidate *candidate);
void subtractMean();
PTR(ImageT) returnMean() {return _mean;}
std::shared_ptr<ImageT> returnMean() {return _mean;}
private:
std::shared_ptr<KernelPca<ImageT> > _imagePca; ///< Structure to fill with images
PTR(ImageT) _mean; ///< Mean image calculated before Pca
std::shared_ptr<ImageT> _mean; ///< Mean image calculated before Pca
};

template<typename PixelT>
Expand Down
14 changes: 7 additions & 7 deletions src/DipoleAlgorithms.cc
Expand Up @@ -358,14 +358,14 @@ std::pair<double,int> PsfDipoleFlux::chi2(
geom::Point2D negCenter(negCenterX, negCenterY);
geom::Point2D posCenter(posCenterX, posCenterY);

CONST_PTR(afw::detection::Footprint) footprint = source.getFootprint();
std::shared_ptr<afw::detection::Footprint const > footprint = source.getFootprint();

/*
* Fit for the superposition of Psfs at the two centroids.
*/
CONST_PTR(afwDet::Psf) psf = exposure.getPsf();
PTR(afwImage::Image<afwMath::Kernel::Pixel>) negPsf = psf->computeImage(negCenter);
PTR(afwImage::Image<afwMath::Kernel::Pixel>) posPsf = psf->computeImage(posCenter);
std::shared_ptr<afwDet::Psf const> psf = exposure.getPsf();
std::shared_ptr<afwImage::Image<afwMath::Kernel::Pixel>> negPsf = psf->computeImage(negCenter);
std::shared_ptr<afwImage::Image<afwMath::Kernel::Pixel>> posPsf = psf->computeImage(posCenter);

afwImage::Image<double> negModel(footprint->getBBox());
afwImage::Image<double> posModel(footprint->getBBox());
Expand Down Expand Up @@ -420,7 +420,7 @@ void PsfDipoleFlux::measure(

typedef afw::image::Exposure<float>::MaskedImageT MaskedImageT;

CONST_PTR(afw::detection::Footprint) footprint = source.getFootprint();
std::shared_ptr<afw::detection::Footprint const> footprint = source.getFootprint();
if (!footprint) {
throw LSST_EXCEPT(pex::exceptions::RuntimeError,
(boost::format("No footprint for source %d") % source.getId()).str());
Expand Down Expand Up @@ -488,12 +488,12 @@ void PsfDipoleFlux::measure(
double evalChi2 = fit.first;
int nPix = fit.second;

PTR(geom::Point2D) minNegCentroid(new geom::Point2D(min.UserState().Value(NEGCENTXPAR),
std::shared_ptr<geom::Point2D> minNegCentroid(new geom::Point2D(min.UserState().Value(NEGCENTXPAR),
min.UserState().Value(NEGCENTYPAR)));
source.set(getNegativeKeys().getInstFlux(), min.UserState().Value(NEGFLUXPAR));
source.set(getNegativeKeys().getInstFluxErr(), min.UserState().Error(NEGFLUXPAR));

PTR(geom::Point2D) minPosCentroid(new geom::Point2D(min.UserState().Value(POSCENTXPAR),
std::shared_ptr<geom::Point2D> minPosCentroid(new geom::Point2D(min.UserState().Value(POSCENTXPAR),
min.UserState().Value(POSCENTYPAR)));
source.set(getPositiveKeys().getInstFlux(), min.UserState().Value(POSFLUXPAR));
source.set(getPositiveKeys().getInstFluxErr(), min.UserState().Error(POSFLUXPAR));
Expand Down
4 changes: 2 additions & 2 deletions src/KernelPca.cc
Expand Up @@ -98,7 +98,7 @@ namespace detail {

try {
/* Normalize to unit sum */
PTR(ImageT) kImage = kCandidate->getKernelSolution(
std::shared_ptr<ImageT> kImage = kCandidate->getKernelSolution(
KernelCandidate<PixelT>::ORIG)->makeKernelImage();
*kImage /= kCandidate->getKernelSolution(
KernelCandidate<PixelT>::ORIG)->getKsum();
Expand Down Expand Up @@ -167,7 +167,7 @@ namespace detail {
typename Super::ImageList const &eImageList = this->getEigenImages();
typename Super::ImageList::const_iterator iter = eImageList.begin(), end = eImageList.end();
for (size_t i = 0; iter != end; ++i, ++iter) {
PTR(ImageT) eImage = *iter;
std::shared_ptr<ImageT> eImage = *iter;

/*
* Normalise eigenImages to have a maximum of 1.0. For n > 0 they
Expand Down

0 comments on commit 9f97638

Please sign in to comment.