Skip to content

Commit

Permalink
Remove deprecated Calib interface
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Nov 5, 2019
1 parent a5eeeb2 commit 568fa06
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 324 deletions.
11 changes: 0 additions & 11 deletions include/lsst/afw/image/Exposure.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,6 @@ class Exposure {
/// Return the Exposure's PhotoCalib object
std::shared_ptr<PhotoCalib const> getPhotoCalib() const { return _info->getPhotoCalib(); }

/// Set the Exposure's Calib object
[[deprecated("Replaced with setPhotoCalib (will be removed in 18.0)")]] void setCalib(
std::shared_ptr<PhotoCalib> photoCalib) {
_info->setPhotoCalib(photoCalib);
}
/// Return the Exposure's Calib object
[[deprecated("Replaced with getPhotoCalib (will be removed in 18.0)")]] std::shared_ptr<PhotoCalib const>
getCalib() const {
return _info->getPhotoCalib();
}

/// Set the Exposure's Psf
void setPsf(std::shared_ptr<lsst::afw::detection::Psf const> psf) { _info->setPsf(psf); }

Expand Down
17 changes: 0 additions & 17 deletions include/lsst/afw/image/ExposureInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,6 @@ class ExposureInfo final {
/// Set the Exposure's PhotoCalib object
void setPhotoCalib(std::shared_ptr<PhotoCalib const> photoCalib);

/// Does this exposure have a photometric calibration?
[[deprecated("Replaced with hasPhotoCalib (will be removed in 18.0)")]] bool hasCalib() const {
return hasPhotoCalib();
}

/// Return the exposure's photometric calibration
[[deprecated("Replaced with getPhotoCalib (will be removed in 18.0)")]] std::shared_ptr<PhotoCalib const>
getCalib() const {
return getPhotoCalib();
}

/// Set the Exposure's PhotoCalib object
[[deprecated("Replaced with setPhotoCalib (will be removed in 18.0)")]] void setCalib(
std::shared_ptr<PhotoCalib const> photoCalib) {
setPhotoCalib(photoCalib);
}

/// Return flexible metadata
std::shared_ptr<daf::base::PropertySet> getMetadata() const { return _metadata; }

Expand Down
77 changes: 0 additions & 77 deletions include/lsst/afw/image/PhotoCalib.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
* @ingroup afw
*/

#include <cmath> // For quiet_nan in the deprecated block

#include "boost/format.hpp"

#include "lsst/afw/math/BoundedField.h"
Expand Down Expand Up @@ -497,81 +495,6 @@ class PhotoCalib final : public table::io::PersistableFacade<PhotoCalib>, public

bool isPersistable() const noexcept override { return true; }

/* Backwards compatibility with old Calib object */

/// No-op: for backwards compatibility with Calib.
[[deprecated("No-op: PhotoCalib never throws on negative instFlux. Will remove after v18.")]] static void
setThrowOnNegativeFlux(bool raiseException) noexcept {
; // do nothing!
}
/// No-op: for backwards compatibility with Calib (always returns false).
[[deprecated("No-op: PhotoCalib never throws on negative instFlux. Will remove after v18.")]] static bool
getThrowOnNegativeFlux() noexcept {
return false;
}

/** @copydoc instFluxToMagnitude(double)const
* Deprecated: For backwards compatibility with Calib.
*/
[
[deprecated("For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be "
"removed after v18.")]] double
getMagnitude(double instFlux) const {
return instFluxToMagnitude(instFlux);
}

/** @copydoc instFluxToMagnitude(double,double)const
* Deprecated: For backwards compatibility with Calib.
*/
[
[deprecated("For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be "
"removed after v18.")]] ndarray::Array<double, 1>
getMagnitude(ndarray::Array<double const, 1> const &instFlux) const;
[
[deprecated("For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be "
"removed after v18.")]] std::pair<double, double>
getMagnitude(double instFlux, double instFluxErr) const {
auto result = instFluxToMagnitude(instFlux, instFluxErr);
return std::make_pair<const double &, const double &>(result.value, result.error);
};
[[deprecated(
"For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be "
"removed after v18.")]] std::pair<ndarray::Array<double, 1>, ndarray::Array<double, 1>>
getMagnitude(ndarray::Array<double const, 1> const &instFlux,
ndarray::Array<double const, 1> const &instFluxErr) const;
/**
* @copydoc magnitudeToInstFlux(double)const
* Deprecated: For backwards compatibility with Calib.
*/
[[deprecated(
"For backwards compatibility with Calib; use `magnitudeToInstFlux` instead. To be removed "
"after v18.")]] double
getFlux(double magnitude) const {
return magnitudeToInstFlux(magnitude);
}
/**
* @copydoc getInstFluxAtZeroMagnitude()
* Deprecated: For backwards compatibility with Calib.
*/
[[deprecated(
"For backwards compatibility with Calib: use `getCalibrationMean`, `getCalibrationErr`, or "
"`getInstFluxAtZeroMagnitude. To be removed after v18.")]] std::pair<double, double>
getFluxMag0() const {
return std::make_pair<double, double>(getInstFluxAtZeroMagnitude(),
std::numeric_limits<double>::quiet_NaN());
}
/// Invalid for PhotoCalib: this only exists to provide the user an informative error message.
[[deprecated(
"PhotoCalib is immutable: create a new one with the calibration factor and calibration error,"
" or create it like an old Calib object with makePhotoCalibFromCalibZeroPoint.")]] void
setFluxMag0(double, double = 0) const {
std::string msg =
"PhotoCalib is immutable: create a new `PhotoCalib` with the calibration"
" factor and error, or create it like an old Calib object with "
"`makePhotoCalibFromCalibZeroPoint`.";
throw LSST_EXCEPT(pex::exceptions::RuntimeError, msg);
}

/// Create a new PhotoCalib that is a copy of this one.
std::shared_ptr<typehandling::Storable> cloneStorable() const override;

Expand Down
10 changes: 0 additions & 10 deletions include/lsst/afw/table/Exposure.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,6 @@ class ExposureRecord : public BaseRecord {
std::shared_ptr<image::PhotoCalib const> getPhotoCalib() const { return _photoCalib; }
void setPhotoCalib(std::shared_ptr<image::PhotoCalib const> photoCalib) { _photoCalib = photoCalib; }

[[deprecated("Replaced with getPhotoCalib (will be removed in 18.0)")]] std::shared_ptr<
image::PhotoCalib const>
getCalib() const {
return _photoCalib;
}
[[deprecated("Replaced with setPhotoCalib (will be removed in 18.0)")]] void setCalib(
std::shared_ptr<image::PhotoCalib const> photoCalib) {
_photoCalib = photoCalib;
}

std::shared_ptr<image::ApCorrMap const> getApCorrMap() const { return _apCorrMap; }
void setApCorrMap(std::shared_ptr<image::ApCorrMap const> apCorrMap) { _apCorrMap = apCorrMap; }

Expand Down
1 change: 0 additions & 1 deletion python/lsst/afw/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from .exposureInfo import *
from .exposure import *
from .photoCalib import *
from .photoCalibContinued import *
from .imagePca import *
from .imageUtils import *
from .readMetadata import *
Expand Down
4 changes: 0 additions & 4 deletions python/lsst/afw/image/exposure/exposure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ PyExposure<PixelT> declareExposure(py::module &mod, const std::string &suffix) {
cls.def("getFilter", &ExposureT::getFilter);
cls.def("setFilter", &ExposureT::setFilter, "filter"_a);

// Deprecated methods
cls.def("_getCalib", &ExposureT::getCalib);
cls.def("_setCalib", &ExposureT::setCalib, "photoCalib"_a);

cls.def("getPhotoCalib", &ExposureT::getPhotoCalib);
cls.def("setPhotoCalib", &ExposureT::setPhotoCalib, "photoCalib"_a);
cls.def("getPsf", (std::shared_ptr<detection::Psf>(ExposureT::*)()) & ExposureT::getPsf);
Expand Down
10 changes: 0 additions & 10 deletions python/lsst/afw/image/exposure/exposureContinued.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

import numpy as np

from deprecated.sphinx import deprecated

from lsst.utils import TemplateMeta

from ..slicing import supportSlicing
Expand Down Expand Up @@ -100,14 +98,6 @@ def setVariance(self, variance):

writeFitsWithOptions = exposureWriteFitsWithOptions

@deprecated(reason="Replaced with getPhotoCalib (will be removed after v18)", category=FutureWarning)
def getCalib(self, *args, **kwargs):
return self._getCalib(*args, **kwargs)

@deprecated(reason="Replaced with setPhotoCalib (will be removed after v18)", category=FutureWarning)
def setCalib(self, *args, **kwargs):
self._setCalib(*args, **kwargs)


Exposure.register(np.int32, ExposureI)
Exposure.register(np.float32, ExposureF)
Expand Down
5 changes: 0 additions & 5 deletions python/lsst/afw/image/exposureInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ PYBIND11_MODULE(exposureInfo, mod) {
declareGenericMethods<std::shared_ptr<typehandling::Storable const>>(cls);
declareGenericMethodsMerged(cls);

// Deprecated versions
cls.def("hasCalib", &ExposureInfo::hasCalib);
cls.def("getCalib", &ExposureInfo::getCalib);
cls.def("setCalib", &ExposureInfo::setCalib, "calib"_a);

cls.attr("KEY_PHOTO_CALIB") = ExposureInfo::KEY_PHOTO_CALIB.getId();
cls.def("hasPhotoCalib", &ExposureInfo::hasPhotoCalib);
cls.def("getPhotoCalib", &ExposureInfo::getPhotoCalib);
Expand Down
17 changes: 0 additions & 17 deletions python/lsst/afw/image/photoCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,6 @@ PYBIND11_MODULE(photoCalib, mod) {
py::overload_cast<double, double>(makePhotoCalibFromCalibZeroPoint), "instFluxMag0"_a,
"instFluxMag0Err"_a = false);

/* Deprecated Calib interface */
cls.def_static("_setThrowOnNegativeFlux", &PhotoCalib::setThrowOnNegativeFlux);
cls.def_static("_getThrowOnNegativeFlux", &PhotoCalib::getThrowOnNegativeFlux);
cls.def("_getMagnitude", py::overload_cast<double>(&PhotoCalib::getMagnitude, py::const_), "instFlux"_a);
cls.def("_getMagnitude", py::overload_cast<double, double>(&PhotoCalib::getMagnitude, py::const_),
"instFlux"_a, "instFluxErr"_a);
cls.def("_getMagnitude",
py::overload_cast<ndarray::Array<double const, 1> const &>(&PhotoCalib::getMagnitude, py::const_),
"instFlux"_a);
cls.def("_getMagnitude",
py::overload_cast<ndarray::Array<double const, 1> const &,
ndarray::Array<double const, 1> const &>(&PhotoCalib::getMagnitude, py::const_),
"instFlux"_a, "instFluxErr"_a);
cls.def("_getFlux", &PhotoCalib::getFlux, "instFlux"_a);
cls.def("_getFluxMag0", &PhotoCalib::getFluxMag0);
cls.def("setFluxMag0", &PhotoCalib::setFluxMag0, "instFluxMag0"_a, "instFluxMag0Err"_a = 0.0);

utils::python::addOutputOp(cls, "__str__");
cls.def("__repr__", [](PhotoCalib const &self) {
std::ostringstream os;
Expand Down
62 changes: 0 additions & 62 deletions python/lsst/afw/image/photoCalibContinued.py

This file was deleted.

4 changes: 0 additions & 4 deletions python/lsst/afw/table/_exposure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ PyExposureRecord declareExposureRecord(WrapperCollection &wrappers) {
cls.def("getPsf", &ExposureRecord::getPsf);
cls.def("setPsf", &ExposureRecord::setPsf, "psf"_a);

// Deprecated methods
cls.def("_getCalib", &ExposureRecord::getCalib);
cls.def("_setCalib", &ExposureRecord::setCalib, "photoCalib"_a);

cls.def("getPhotoCalib", &ExposureRecord::getPhotoCalib);
cls.def("setPhotoCalib", &ExposureRecord::setPhotoCalib, "photoCalib"_a);
cls.def("getApCorrMap", &ExposureRecord::getApCorrMap);
Expand Down
17 changes: 1 addition & 16 deletions python/lsst/afw/table/_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,8 @@

__all__ = [] # import this module only for its side effects

from deprecated.sphinx import deprecated

from lsst.utils import continueClass

from ._base import Catalog
from ._table import ExposureCatalog, ExposureRecord


@continueClass # noqa: F811
class ExposureRecord:
@deprecated(reason="Replaced with getPhotoCalib (will be removed after v18)", category=FutureWarning)
def getCalib(self, *args, **kwargs):
return self._getCalib(*args, **kwargs)

@deprecated(reason="Replaced with setPhotoCalib (will be removed after v18)", category=FutureWarning)
def setCalib(self, *args, **kwargs):
self._setCalib(*args, **kwargs)
from ._table import ExposureCatalog


Catalog.register("Exposure", ExposureCatalog)
28 changes: 0 additions & 28 deletions src/image/PhotoCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,6 @@ double toMagnitudeErr(double instFlux, double instFluxErr, double scale, double

} // anonymous namespace

// ------------------ Deprecated Calib interface -------------------

ndarray::Array<double, 1> PhotoCalib::getMagnitude(ndarray::Array<double const, 1> const &instFlux) const {
ndarray::Array<double, 1> result = ndarray::allocate(ndarray::makeVector(int(instFlux.size())));
auto iter = result.begin();
for (auto const &i : instFlux) {
*iter = toMagnitude(i, _calibrationMean);
iter++;
}
return result;
}

std::pair<ndarray::Array<double, 1>, ndarray::Array<double, 1>> PhotoCalib::getMagnitude(
ndarray::Array<double const, 1> const &instFlux,
ndarray::Array<double const, 1> const &instFluxErr) const {
ndarray::Array<double, 1> mag = ndarray::allocate(ndarray::makeVector(int(instFlux.size())));
ndarray::Array<double, 1> magErr = ndarray::allocate(ndarray::makeVector(int(instFlux.size())));
auto iMag = mag.begin();
auto iMagErr = magErr.begin();
for (auto i = instFlux.begin(), iErr = instFluxErr.begin(); i != instFlux.end(); ++i, ++iErr) {
*iMag = toMagnitude(*i, _calibrationMean);
*iMagErr = toMagnitudeErr(*i, *iErr, _calibrationMean, _calibrationErr);
iMag++;
iMagErr++;
}
return std::make_pair(mag, magErr);
}

// ------------------- Conversions to nanojansky -------------------

double PhotoCalib::instFluxToNanojansky(double instFlux, lsst::geom::Point<double, 2> const &point) const {
Expand Down

0 comments on commit 568fa06

Please sign in to comment.