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-38546: tweak apCorrMap interface #693

Merged
merged 2 commits into from
Jul 31, 2023
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
5 changes: 5 additions & 0 deletions include/lsst/afw/image/Exposure.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ class Exposure {

std::shared_ptr<geom::SkyWcs const> getWcs() const { return _info->getWcs(); }

std::shared_ptr<ApCorrMap const> getApCorrMap() const { return _info->getApCorrMap(); }

/// Return the Exposure's Detector information
std::shared_ptr<lsst::afw::cameraGeom::Detector const> getDetector() const {
return _info->getDetector();
Expand Down Expand Up @@ -313,6 +315,9 @@ class Exposure {
/// Does this Exposure have a Wcs?
bool hasWcs() const { return _info->hasWcs(); }

/// Set the Exposure's aperture correction map.
void setApCorrMap(std::shared_ptr<ApCorrMap const> apCorrMap) { _info->setApCorrMap(apCorrMap); }

/// Get the ExposureInfo that aggregates all the non-image components. Never null.
std::shared_ptr<ExposureInfo> getInfo() { return _info; }

Expand Down
8 changes: 0 additions & 8 deletions include/lsst/afw/image/ExposureInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,6 @@ class ExposureInfo final {
/// Set the exposure's aperture correction map (null pointer if !hasApCorrMap())
void setApCorrMap(std::shared_ptr<ApCorrMap const> apCorrMap);

/**
* Set the exposure's aperture correction map to a new, empty map
*
* Note that the ExposureInfo constructors do not create an empty aperture correction map,
* so this method provide a convenient way to initialize one before filling it.
*/
void initApCorrMap();

/// Does this exposure have coadd provenance catalogs?
bool hasCoaddInputs() const;

Expand Down
4 changes: 4 additions & 0 deletions python/lsst/afw/image/_exposure/_exposure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "lsst/afw/image/FilterLabel.h"
#include "lsst/afw/image/Exposure.h"
#include "lsst/afw/detection/Psf.h"
#include "lsst/afw/image/ApCorrMap.h"

namespace py = pybind11;
using namespace pybind11::literals;
Expand Down Expand Up @@ -135,6 +136,9 @@ PyExposure<PixelT> declareExposure(lsst::utils::python::WrapperCollection &wrapp
cls.def_property_readonly("visitInfo",
[](ExposureT &self) { return self.getInfo()->getVisitInfo(); });

cls.def("setApCorrMap", &ExposureT::setApCorrMap, "apCorrMap"_a);
cls.def_property_readonly("apCorrMap", [](ExposureT &self) { return self.getApCorrMap(); });

cls.def("subset", &ExposureT::subset, "bbox"_a, "origin"_a = PARENT);

cls.def("writeFits", (void(ExposureT::*)(std::string const &) const) & ExposureT::writeFits);
Expand Down
1 change: 0 additions & 1 deletion python/lsst/afw/image/_exposureInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ void declareExposureInfo(lsst::utils::python::WrapperCollection &wrappers) {
cls.def("hasApCorrMap", &ExposureInfo::hasApCorrMap);
cls.def("getApCorrMap", (std::shared_ptr<ApCorrMap>(ExposureInfo::*)()) & ExposureInfo::getApCorrMap);
cls.def("setApCorrMap", &ExposureInfo::setApCorrMap, "apCorrMap"_a);
cls.def("initApCorrMap", &ExposureInfo::initApCorrMap);

cls.attr("KEY_COADD_INPUTS") = ExposureInfo::KEY_COADD_INPUTS.getId();
cls.def("hasCoaddInputs", &ExposureInfo::hasCoaddInputs);
Expand Down
2 changes: 0 additions & 2 deletions src/image/ExposureInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ ExposureInfo& ExposureInfo::operator=(ExposureInfo const& other) {
// Delegate to copy-assignment for backwards compatibility
ExposureInfo& ExposureInfo::operator=(ExposureInfo&& other) { return *this = other; }

void ExposureInfo::initApCorrMap() { setApCorrMap(std::make_shared<ApCorrMap>()); }

ExposureInfo::~ExposureInfo() = default;

int ExposureInfo::_addToArchive(FitsWriteData& data, table::io::Persistable const& object, std::string key,
Expand Down