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

DM-6056: replace CONST_PTR and PTR macros by std::shared #193

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions include/lsst/ip/diffim/KernelCandidate.h
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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