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
Calib.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 //
31 #ifndef LSST_AFW_IMAGE_CALIB_H
32 #define LSST_AFW_IMAGE_CALIB_H
33 
34 #include <utility>
35 #include "boost/shared_ptr.hpp"
36 #include "ndarray_fwd.h"
37 #include "lsst/base.h"
38 #include "lsst/daf/base/DateTime.h"
39 #include "lsst/afw/geom/Point.h"
41 
42 namespace lsst {
43 namespace daf {
44  namespace base {
45  class PropertySet;
46  }
47 }
48 
49 namespace afw {
50 namespace cameraGeom {
51  class Detector;
52 }
53 namespace image {
59 public :
60  typedef boost::shared_ptr<Calib> Ptr;
61  typedef boost::shared_ptr<Calib const> ConstPtr;
62 
63  explicit Calib();
64  explicit Calib(std::vector<CONST_PTR(Calib)> const& calibs);
66 
69  lsst::daf::base::DateTime getMidTime(boost::shared_ptr<const lsst::afw::cameraGeom::Detector>,
70  lsst::afw::geom::Point2I const&) const;
71 
72  void setExptime(double exptime);
73  double getExptime() const;
74 
75  void setFluxMag0(double fluxMag0, double fluxMag0Sigma=0.0);
76  void setFluxMag0(std::pair<double, double> fluxMag0AndSigma);
77  std::pair<double, double> getFluxMag0() const;
78 
79  double getFlux(double const mag) const;
80 
81  std::pair<double, double> getFlux(double const mag, double const magErr) const;
82 
84 
85  std::pair< ndarray::Array<double,1>, ndarray::Array<double,1> > getFlux(
87  ndarray::Array<double const,1> const & magErr
88  ) const;
89 
90  double getMagnitude(double const flux) const;
91 
92  std::pair<double, double> getMagnitude(double const flux, double const fluxErr) const;
93 
95 
96  std::pair< ndarray::Array<double,1>,ndarray::Array<double,1> > getMagnitude(
97  ndarray::Array<double const,1> const & flux,
98  ndarray::Array<double const,1> const & fluxErr
99  ) const;
100 
101  static void setThrowOnNegativeFlux(bool raiseException);
102  static bool getThrowOnNegativeFlux();
103  /*
104  * Compare two Calibs
105  */
106  bool operator==(Calib const& rhs) const;
107  bool operator!=(Calib const& rhs) const { return !(*this == rhs); }
108 
109  bool isPersistable() const { return true; }
110 
111 protected:
112 
113  virtual std::string getPersistenceName() const;
114 
115  virtual void write(OutputArchiveHandle & handle) const;
116 
117 private:
119  double _exptime;
120  double _fluxMag0;
122  static bool _throwOnNegativeFlux;
123 };
124 
125 namespace detail {
127 }
128 
129 }}} // lsst::afw::image
130 
131 #endif // LSST_AFW_IMAGE_CALIB_H
A coordinate class intended to represent absolute positions.
#define PTR(...)
Definition: base.h:41
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:58
table::Key< double > fluxMag0Sigma
Definition: Calib.cc:487
table::Key< boost::int64_t > midTime
Definition: Calib.cc:484
Forward declarations and default template parameters for ndarray.
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
bool operator==(Calib const &rhs) const
Definition: Calib.cc:197
void setExptime(double exptime)
Definition: Calib.cc:241
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
Definition: Calib.cc:535
static void setThrowOnNegativeFlux(bool raiseException)
Definition: Calib.cc:138
double getExptime() const
Definition: Calib.cc:249
std::pair< double, double > getFluxMag0() const
Definition: Calib.cc:274
static bool _throwOnNegativeFlux
Definition: Calib.h:122
#define CONST_PTR(...)
Definition: base.h:47
Interface for DateTime class.
int stripCalibKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Calib.cc:159
double getFlux(double const mag) const
Definition: Calib.cc:329
A multidimensional strided array.
Definition: Array.h:47
Class for storing generic metadata.
Definition: PropertySet.h:82
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
Definition: Calib.cc:537
boost::shared_ptr< Calib const > ConstPtr
Definition: Calib.h:61
void setFluxMag0(double fluxMag0, double fluxMag0Sigma=0.0)
Definition: Calib.cc:257
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:114
static bool getThrowOnNegativeFlux()
Definition: Calib.cc:148
table::Key< double > fluxMag0
Definition: Calib.cc:486
bool operator!=(Calib const &rhs) const
Definition: Calib.h:107
lsst::daf::base::DateTime getMidTime() const
Definition: Calib.cc:219
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:182
lsst::daf::base::DateTime _midTime
Definition: Calib.h:118
double getMagnitude(double const flux) const
Definition: Calib.cc:391
bool isPersistable() const
Return true if this particular object can be persisted using afw::table::io.
Definition: Calib.h:109
boost::shared_ptr< Calib > Ptr
Definition: Calib.h:60
void setMidTime(lsst::daf::base::DateTime const &midTime)
Definition: Calib.cc:210