LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
SkyCoord.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 #include "boost/make_shared.hpp"
4 
6 
7 namespace lsst { namespace meas { namespace algorithms {
8 
9 namespace {
10 
11 class SkyCoordAlgorithm : public Algorithm {
12 public:
13 
14  explicit SkyCoordAlgorithm(SkyCoordControl const & ctrl);
15 
16 public:
17 
18  template <typename PixelT>
19  void _apply(
20  afw::table::SourceRecord & source,
21  afw::image::Exposure<PixelT> const & exposure,
22  afw::geom::Point2D const & center
23  ) const;
24 
25 private:
26  LSST_MEAS_ALGORITHM_PRIVATE_INTERFACE(SkyCoordAlgorithm);
27 };
28 
29 SkyCoordAlgorithm::SkyCoordAlgorithm(SkyCoordControl const & ctrl) : Algorithm(ctrl) {}
30 
31 template <typename PixelT>
32 void SkyCoordAlgorithm::_apply(
33  afw::table::SourceRecord & source,
34  afw::image::Exposure<PixelT> const & exposure,
35  afw::geom::Point2D const & center
36 ) const {
37  if (!exposure.hasWcs()) {
38  throw LSST_EXCEPT(
39  lsst::pex::exceptions::LogicError,
40  "Cannot run SkyCoord algorithm with no WCS."
41  );
42  }
43  source.updateCoord(*exposure.getWcs());
44 }
45 
47 
48 } // anonymous
49 
51  return boost::make_shared<SkyCoordControl>(*this);
52 }
53 
54 PTR(Algorithm) SkyCoordControl::_makeAlgorithm(
55  afw::table::Schema & schema,
56  PTR(daf::base::PropertyList) const & metadata
57 ) const {
58  return boost::make_shared<SkyCoordAlgorithm>(*this);
59 }
60 
61 }}} // namespace lsst::meas::algorithms
#define PTR(...)
Definition: base.h:41
#define LSST_MEAS_ALGORITHM_PRIVATE_INTERFACE(CLASS)
Declare Algorithm::_applyT virtual function overloads with the correct types.
Definition: Algorithm.h:60
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
Point< double, 2 > Point2D
Definition: Point.h:277
Base class for source measurement algorithms.
Definition: Algorithm.h:106
Base class for measurement algorithm control objects.
Definition: Algorithm.h:168
Control/factory for an algorithm that sets ra/dec from x/y.
Definition: SkyCoord.h:46
tbl::Schema schema
Definition: CoaddPsf.cc:324
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
LSST_MEAS_ALGORITHM_PRIVATE_IMPLEMENTATION(ApertureFlux)