LSST Applications g0fba68d861+539c3c8198,g1ec0fe41b4+f0b7a83aa5,g1fd858c14a+78b1f303e5,g22210bfa2a+8e34e7f00e,g2440f9efcc+8c5ae1fdc5,g3533f9d6cb+f4db8b1b3b,g35bb328faa+8c5ae1fdc5,g3fc7d4f5b9+a4d3a2d8bb,g40d01f57dd+ad4ae80abb,g4178042926+abd409f097,g53246c7159+8c5ae1fdc5,g548d740b8c+47e4a7beb3,g60b5630c4e+f4db8b1b3b,g663da51e9b+e0f2ae43b2,g67b6fd64d1+c104138150,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g8352419a5c+8c5ae1fdc5,g8852436030+d435302cbd,g89139ef638+c104138150,g8b40312ef5+5b6744d273,g90aefe88b0+c7f866738c,g989de1cb63+c104138150,g9f33ca652e+0b88989aa6,ga2f891cd6c+f4db8b1b3b,gabe3b4be73+8856018cbb,gabf8522325+5cb9e9d408,gb1101e3267+78d08b86ce,gb89ab40317+c104138150,gcf25f946ba+d435302cbd,gd6cbbdb0b4+be834e5da7,gde0f65d7ad+a7114e3dba,ge278dab8ac+fa35eb453c,ge410e46f29+c104138150,gf35d7ec915+97dd712d81,gf5e32f922b+8c5ae1fdc5,gf67bdafdda+c104138150,gffe7e49bb4+f4db8b1b3b,v29.1.0.rc2
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst::afw::table::ExposureRecord Class Reference

Record class used to store exposure metadata. More...

#include <Exposure.h>

Inheritance diagram for lsst::afw::table::ExposureRecord:
lsst::afw::table::BaseRecord

Public Types

using Table = ExposureTable
 
using ColumnView = ColumnViewT<ExposureRecord>
 
using Catalog = ExposureCatalogT<ExposureRecord>
 
using ConstCatalog = ExposureCatalogT<const ExposureRecord>
 

Public Member Functions

 ExposureRecord (ConstructionToken const &token, detail::RecordData &&data)
 Constructor used by ExposureTable.
 
std::shared_ptr< ExposureTable const > getTable () const
 
RecordId getId () const
 
void setId (RecordId id)
 
lsst::geom::Box2I getBBox () const
 
void setBBox (lsst::geom::Box2I const &bbox)
 
bool contains (lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
 Return true if the bounding box contains the given celestial coordinate point, taking into account the Wcs of the ExposureRecord.
 
bool contains (lsst::geom::Point2D const &point, geom::SkyWcs const &wcs, bool includeValidPolygon=false) const
 Return true if the bounding box contains the given point, taking into account its Wcs (given) and the Wcs of the ExposureRecord.
 
std::shared_ptr< geom::SkyWcs const > getWcs () const
 Get/Set the the attached Wcs, Psf, PhotoCalib, or ApCorrMap. No copies are made.
 
void setWcs (std::shared_ptr< geom::SkyWcs const > wcs)
 
std::shared_ptr< detection::Psf const > getPsf () const
 
void setPsf (std::shared_ptr< detection::Psf const > psf)
 
std::shared_ptr< image::PhotoCalib const > getPhotoCalib () const
 
void setPhotoCalib (std::shared_ptr< image::PhotoCalib const > photoCalib)
 
std::shared_ptr< image::ApCorrMap const > getApCorrMap () const
 
void setApCorrMap (std::shared_ptr< image::ApCorrMap const > apCorrMap)
 
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon () const
 
void setValidPolygon (std::shared_ptr< geom::polygon::Polygon const > polygon)
 
std::shared_ptr< image::VisitInfo const > getVisitInfo () const
 
void setVisitInfo (std::shared_ptr< image::VisitInfo const > visitInfo)
 
std::shared_ptr< image::TransmissionCurve const > getTransmissionCurve () const
 
void setTransmissionCurve (std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
 
std::shared_ptr< cameraGeom::Detector const > getDetector () const
 
void setDetector (std::shared_ptr< cameraGeom::Detector const > detector)
 
 ExposureRecord (ExposureRecord const &)=delete
 
 ExposureRecord (ExposureRecord &&)=delete
 
ExposureRecordoperator= (ExposureRecord const &)=delete
 
ExposureRecordoperator= (ExposureRecord &&)=delete
 
 ~ExposureRecord () override
 
Schema getSchema () const
 Return the Schema that holds this record's fields and keys.
 
template<typename T>
Field< T >::Element * getElement (Key< T > const &key)
 Return a pointer to the underlying elements of a field (non-const).
 
template<typename T>
Field< T >::Element const * getElement (Key< T > const &key) const
 Return a pointer to the underlying elements of a field (const).
 
template<typename T>
Field< T >::Reference operator[] (Key< T > const &key)
 Return a reference (or reference-like type) to the field's value.
 
template<typename T>
Field< T >::ConstReference operator[] (Key< T > const &key) const
 Return a const reference (or const-reference-like type) to the field's value.
 
template<typename Ref>
Ref operator[] (ReferenceFunctorKey< Ref > const &key)
 
template<typename ConstRef>
ConstRef operator[] (ConstReferenceFunctorKey< ConstRef > const &key) const
 
template<typename T>
Field< T >::Value get (Key< T > const &key) const
 Return the value of a field for the given key.
 
template<typename T>
get (OutputFunctorKey< T > const &key) const
 Compute a calculated or aggregate field.
 
template<typename T, typename U>
void set (Key< T > const &key, U const &value)
 Set value of a field for the given key.
 
template<typename T, typename U>
void set (InputFunctorKey< T > const &key, U const &value)
 Set a calculated or aggregate field.
 
void assign (BaseRecord const &other)
 Copy all field values from other to this, requiring that they have equal schemas.
 
void assign (BaseRecord const &other, SchemaMapper const &mapper)
 Copy field values from other to this, using a mapper.
 
ndarray::Manager::Ptr getManager () const
 

Protected Member Functions

void _assign (BaseRecord const &other) override
 Called by assign() after transferring fields to allow subclass data members to be copied.
 
virtual void _stream (std::ostream &os) const
 Called by operator<<.
 

Friends

class ExposureTable
 

Detailed Description

Record class used to store exposure metadata.

Definition at line 79 of file Exposure.h.

Member Typedef Documentation

◆ Catalog

◆ ColumnView

◆ ConstCatalog

◆ Table

Constructor & Destructor Documentation

◆ ExposureRecord() [1/3]

lsst::afw::table::ExposureRecord::ExposureRecord ( ConstructionToken const & token,
detail::RecordData && data )
inline

Constructor used by ExposureTable.

While formally public, this constructor is conceptually and effectively protected, due to the (protected) ConstructionToken argument.

This is to allow make_shared to be used, as that cannot be used on a truly protected or private constructor.

Definition at line 95 of file Exposure.h.

95 :
96 BaseRecord(token, std::move(data))
97 {}
BaseRecord(ConstructionToken const &, detail::RecordData &&data)
Construct a record with uninitialized data.
T move(T... args)

◆ ExposureRecord() [2/3]

lsst::afw::table::ExposureRecord::ExposureRecord ( ExposureRecord const & )
delete

◆ ExposureRecord() [3/3]

lsst::afw::table::ExposureRecord::ExposureRecord ( ExposureRecord && )
delete

◆ ~ExposureRecord()

lsst::afw::table::ExposureRecord::~ExposureRecord ( )
overridedefault

Member Function Documentation

◆ _assign()

void lsst::afw::table::ExposureRecord::_assign ( BaseRecord const & other)
overrideprotectedvirtual

Called by assign() after transferring fields to allow subclass data members to be copied.

Reimplemented from lsst::afw::table::BaseRecord.

Definition at line 379 of file Exposure.cc.

379 {
380 try {
381 ExposureRecord const &s = dynamic_cast<ExposureRecord const &>(other);
382 _psf = s._psf;
383 _wcs = s._wcs;
384 _photoCalib = s._photoCalib;
385 _apCorrMap = s._apCorrMap;
386 _validPolygon = s._validPolygon;
387 _visitInfo = s._visitInfo;
388 _transmissionCurve = s._transmissionCurve;
389 _detector = s._detector;
390 } catch (std::bad_cast &) {
391 }
392}
ExposureRecord(ConstructionToken const &token, detail::RecordData &&data)
Constructor used by ExposureTable.
Definition Exposure.h:95

◆ _stream()

void lsst::afw::table::BaseRecord::_stream ( std::ostream & os) const
protectedvirtualinherited

Called by operator<<.

Overrides should call the base class implementation and append additional fields on new lines, with the syntax "%(name)s: %(value)s".

Definition at line 152 of file BaseRecord.cc.

152 {
153 getSchema().forEach([&os, this](auto const& item) {
154 os << item.field.getName() << ": " << this->get(item.key) << std::endl;
155 });
156}
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition BaseRecord.h:151
Schema getSchema() const
Return the Schema that holds this record's fields and keys.
Definition BaseRecord.h:80
void forEach(F &func) const
Apply a functor to each SchemaItem in the Schema.
Definition Schema.h:214
T endl(T... args)

◆ assign() [1/2]

void lsst::afw::table::BaseRecord::assign ( BaseRecord const & other)
inherited

Copy all field values from other to this, requiring that they have equal schemas.

Definition at line 122 of file BaseRecord.cc.

122 {
123 if (this->getSchema() != other.getSchema()) {
124 throw LSST_EXCEPT(lsst::pex::exceptions::LogicError, "Unequal schemas in record assignment.");
125 }
126 this->getSchema().forEach(CopyValue(&other, this));
127 this->_assign(other); // let derived classes assign their own stuff
128}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
virtual void _assign(BaseRecord const &other)
Called by assign() after transferring fields to allow subclass data members to be copied.
Definition BaseRecord.h:209

◆ assign() [2/2]

void lsst::afw::table::BaseRecord::assign ( BaseRecord const & other,
SchemaMapper const & mapper )
inherited

Copy field values from other to this, using a mapper.

Definition at line 130 of file BaseRecord.cc.

130 {
131 if (!other.getSchema().contains(mapper.getInputSchema())) {
132 throw LSST_EXCEPT(lsst::pex::exceptions::LogicError,
133 "Unequal schemas between input record and mapper.");
134 }
135 if (!this->getSchema().contains(mapper.getOutputSchema())) {
136 throw LSST_EXCEPT(lsst::pex::exceptions::LogicError,
137 "Unequal schemas between output record and mapper.");
138 }
139 mapper.forEach(CopyValue(&other, this)); // use the functor we defined above
140 this->_assign(other); // let derived classes assign their own stuff
141}

◆ contains() [1/2]

bool lsst::afw::table::ExposureRecord::contains ( lsst::geom::Point2D const & point,
geom::SkyWcs const & wcs,
bool includeValidPolygon = false ) const

Return true if the bounding box contains the given point, taking into account its Wcs (given) and the Wcs of the ExposureRecord.

If includeValidPolygon is true it will also check that the point is within the validPolygon of this ExposureRecord if present if it has one; otherwise, this argument is ignored.

Exceptions
pex::exceptions::LogicErrorif the ExposureRecord has no Wcs.

Definition at line 372 of file Exposure.cc.

373 {
374 return contains(wcs.pixelToSky(point), includeValidPolygon);
375}
bool contains(lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
Return true if the bounding box contains the given celestial coordinate point, taking into account th...
Definition Exposure.cc:349

◆ contains() [2/2]

bool lsst::afw::table::ExposureRecord::contains ( lsst::geom::SpherePoint const & coord,
bool includeValidPolygon = false ) const

Return true if the bounding box contains the given celestial coordinate point, taking into account the Wcs of the ExposureRecord.

If includeValidPolygon is true it will also check that the point is within the validPolygon of this ExpoureRecord if it has one; otherwise, this argument is ignored.

Exceptions
pex::exceptions::LogicErrorif the ExposureRecord has no Wcs.

Definition at line 349 of file Exposure.cc.

349 {
350 if (!getWcs()) {
351 throw LSST_EXCEPT(pex::exceptions::LogicError,
352 "ExposureRecord does not have a Wcs; cannot call contains()");
353 }
354
355 // If there is no valid polygon set to false
356 if (includeValidPolygon && !getValidPolygon()) {
357 includeValidPolygon = false;
358 }
359
360 try {
361 lsst::geom::Point2D point = getWcs()->skyToPixel(coord);
362 if (includeValidPolygon)
363 return (lsst::geom::Box2D(getBBox()).contains(point) && getValidPolygon()->contains(point));
364 else
365 return lsst::geom::Box2D(getBBox()).contains(point);
366 } catch (pex::exceptions::DomainError &) {
367 // SkyWcs can throw if the given coordinate is outside the region where the WCS is valid.
368 return false;
369 }
370}
lsst::geom::Box2I getBBox() const
Definition Exposure.cc:343
std::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Definition Exposure.h:148
std::shared_ptr< geom::SkyWcs const > getWcs() const
Get/Set the the attached Wcs, Psf, PhotoCalib, or ApCorrMap. No copies are made.
Definition Exposure.h:136
Point< double, 2 > Point2D
Definition Point.h:324

◆ get() [1/2]

template<typename T>
Field< T >::Value lsst::afw::table::BaseRecord::get ( Key< T > const & key) const
inlineinherited

Return the value of a field for the given key.

No checking is done to ensure the Key belongs to the correct schema.

Definition at line 151 of file BaseRecord.h.

151 {
152 return key.getValue(getElement(key), _manager);
153 }
Field< T >::Element * getElement(Key< T > const &key)
Return a pointer to the underlying elements of a field (non-const).
Definition BaseRecord.h:93

◆ get() [2/2]

template<typename T>
T lsst::afw::table::BaseRecord::get ( OutputFunctorKey< T > const & key) const
inlineinherited

Compute a calculated or aggregate field.

Definition at line 172 of file BaseRecord.h.

172 {
173 return key.get(*this);
174 }

◆ getApCorrMap()

std::shared_ptr< image::ApCorrMap const > lsst::afw::table::ExposureRecord::getApCorrMap ( ) const
inline

Definition at line 145 of file Exposure.h.

145{ return _apCorrMap; }

◆ getBBox()

lsst::geom::Box2I lsst::afw::table::ExposureRecord::getBBox ( ) const

Definition at line 343 of file Exposure.cc.

343 {
344 return lsst::geom::Box2I(get(ExposureTable::getBBoxKey()));
345}
static Box2IKey getBBoxKey()
Key for the full bbox.
Definition Exposure.h:243

◆ getDetector()

std::shared_ptr< cameraGeom::Detector const > lsst::afw::table::ExposureRecord::getDetector ( ) const
inline

Definition at line 161 of file Exposure.h.

161{ return _detector; }

◆ getElement() [1/2]

template<typename T>
Field< T >::Element * lsst::afw::table::BaseRecord::getElement ( Key< T > const & key)
inlineinherited

Return a pointer to the underlying elements of a field (non-const).

This low-level access is intended mostly for use with serialization; users should generally prefer the safer get(), set() and operator[] member functions.

Definition at line 93 of file BaseRecord.h.

93 {
94 if (!key.isValid()) {
95 throw LSST_EXCEPT(
96 pex::exceptions::LogicError,
97 "Key is not valid (if this is a SourceRecord, make sure slot aliases have been set up).");
98 }
99 return reinterpret_cast<typename Field<T>::Element*>(reinterpret_cast<char*>(_data) +
100 key.getOffset());
101 }
typename FieldBase< T >::Element Element
Type used to store field data in the table (a field may have multiple elements).
Definition Field.h:26

◆ getElement() [2/2]

template<typename T>
Field< T >::Element const * lsst::afw::table::BaseRecord::getElement ( Key< T > const & key) const
inlineinherited

Return a pointer to the underlying elements of a field (const).

This low-level access is intended mostly for use with serialization; users should generally prefer the safer get(), set() and operator[] member functions.

Definition at line 111 of file BaseRecord.h.

111 {
112 if (!key.isValid()) {
113 throw LSST_EXCEPT(
114 pex::exceptions::LogicError,
115 "Key is not valid (if this is a SourceRecord, make sure slot aliases have been set up).");
116 }
117 return reinterpret_cast<typename Field<T>::Element const*>(reinterpret_cast<char const*>(_data) +
118 key.getOffset());
119 }

◆ getId()

RecordId lsst::afw::table::ExposureRecord::getId ( ) const
inline

Definition at line 491 of file Exposure.h.

491{ return get(ExposureTable::getIdKey()); }
static Key< RecordId > getIdKey()
Get keys for standard fields shared by all references.
Definition Exposure.h:237

◆ getManager()

ndarray::Manager::Ptr lsst::afw::table::BaseRecord::getManager ( ) const
inlineinherited

Definition at line 200 of file BaseRecord.h.

200{ return _manager; }

◆ getPhotoCalib()

std::shared_ptr< image::PhotoCalib const > lsst::afw::table::ExposureRecord::getPhotoCalib ( ) const
inline

Definition at line 142 of file Exposure.h.

142{ return _photoCalib; }

◆ getPsf()

std::shared_ptr< detection::Psf const > lsst::afw::table::ExposureRecord::getPsf ( ) const
inline

Definition at line 139 of file Exposure.h.

139{ return _psf; }

◆ getSchema()

Schema lsst::afw::table::BaseRecord::getSchema ( ) const
inlineinherited

Return the Schema that holds this record's fields and keys.

Definition at line 80 of file BaseRecord.h.

80{ return _table->getSchema(); }

◆ getTable()

std::shared_ptr< ExposureTable const > lsst::afw::table::ExposureRecord::getTable ( ) const
inline

Definition at line 99 of file Exposure.h.

99 {
101 }
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Definition BaseRecord.h:83
T static_pointer_cast(T... args)

◆ getTransmissionCurve()

std::shared_ptr< image::TransmissionCurve const > lsst::afw::table::ExposureRecord::getTransmissionCurve ( ) const
inline

Definition at line 154 of file Exposure.h.

154 {
155 return _transmissionCurve;
156 }

◆ getValidPolygon()

std::shared_ptr< geom::polygon::Polygon const > lsst::afw::table::ExposureRecord::getValidPolygon ( ) const
inline

Definition at line 148 of file Exposure.h.

148{ return _validPolygon; }

◆ getVisitInfo()

std::shared_ptr< image::VisitInfo const > lsst::afw::table::ExposureRecord::getVisitInfo ( ) const
inline

Definition at line 151 of file Exposure.h.

151{ return _visitInfo; }

◆ getWcs()

std::shared_ptr< geom::SkyWcs const > lsst::afw::table::ExposureRecord::getWcs ( ) const
inline

Get/Set the the attached Wcs, Psf, PhotoCalib, or ApCorrMap. No copies are made.

Definition at line 136 of file Exposure.h.

136{ return _wcs; }

◆ operator=() [1/2]

ExposureRecord & lsst::afw::table::ExposureRecord::operator= ( ExposureRecord && )
delete

◆ operator=() [2/2]

ExposureRecord & lsst::afw::table::ExposureRecord::operator= ( ExposureRecord const & )
delete

◆ operator[]() [1/4]

template<typename ConstRef>
ConstRef lsst::afw::table::BaseRecord::operator[] ( ConstReferenceFunctorKey< ConstRef > const & key) const
inlineinherited

Definition at line 190 of file BaseRecord.h.

190 {
191 return key.getConstReference(*this);
192 }

◆ operator[]() [2/4]

template<typename T>
Field< T >::Reference lsst::afw::table::BaseRecord::operator[] ( Key< T > const & key)
inlineinherited

Return a reference (or reference-like type) to the field's value.

Some field types (Point, Moments, Flag, Covariance, and SpherePoint) do not support reference access.

No checking is done to ensure the Key belongs to the correct schema.

Definition at line 129 of file BaseRecord.h.

129 {
130 return key.getReference(getElement(key), _manager);
131 }

◆ operator[]() [3/4]

template<typename T>
Field< T >::ConstReference lsst::afw::table::BaseRecord::operator[] ( Key< T > const & key) const
inlineinherited

Return a const reference (or const-reference-like type) to the field's value.

Some field types (Point, Moments, Flag, Covariance, and SpherePoint) do not support reference access.

No checking is done to ensure the Key belongs to the correct schema.

Definition at line 141 of file BaseRecord.h.

141 {
142 return key.getConstReference(getElement(key), _manager);
143 }

◆ operator[]() [4/4]

template<typename Ref>
Ref lsst::afw::table::BaseRecord::operator[] ( ReferenceFunctorKey< Ref > const & key)
inlineinherited

Definition at line 185 of file BaseRecord.h.

185 {
186 return key.getReference(*this);
187 }

◆ set() [1/2]

template<typename T, typename U>
void lsst::afw::table::BaseRecord::set ( InputFunctorKey< T > const & key,
U const & value )
inlineinherited

Set a calculated or aggregate field.

Definition at line 180 of file BaseRecord.h.

180 {
181 return key.set(*this, value);
182 }

◆ set() [2/2]

template<typename T, typename U>
void lsst::afw::table::BaseRecord::set ( Key< T > const & key,
U const & value )
inlineinherited

Set value of a field for the given key.

This method has an additional template parameter because some fields accept and convert different types to the stored field type.

No checking is done to ensure the Key belongs to the correct schema.

Definition at line 164 of file BaseRecord.h.

164 {
165 key.setValue(getElement(key), _manager, value);
166 }

◆ setApCorrMap()

void lsst::afw::table::ExposureRecord::setApCorrMap ( std::shared_ptr< image::ApCorrMap const > apCorrMap)
inline

Definition at line 146 of file Exposure.h.

146{ _apCorrMap = apCorrMap; }

◆ setBBox()

void lsst::afw::table::ExposureRecord::setBBox ( lsst::geom::Box2I const & bbox)

Definition at line 347 of file Exposure.cc.

347{ set(ExposureTable::getBBoxKey(), bbox); }
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Definition BaseRecord.h:164

◆ setDetector()

void lsst::afw::table::ExposureRecord::setDetector ( std::shared_ptr< cameraGeom::Detector const > detector)
inline

Definition at line 162 of file Exposure.h.

162 {
163 _detector = std::move(detector);
164 }

◆ setId()

void lsst::afw::table::ExposureRecord::setId ( RecordId id)
inline

Definition at line 492 of file Exposure.h.

◆ setPhotoCalib()

void lsst::afw::table::ExposureRecord::setPhotoCalib ( std::shared_ptr< image::PhotoCalib const > photoCalib)
inline

Definition at line 143 of file Exposure.h.

◆ setPsf()

void lsst::afw::table::ExposureRecord::setPsf ( std::shared_ptr< detection::Psf const > psf)
inline

Definition at line 140 of file Exposure.h.

140{ _psf = psf; }

◆ setTransmissionCurve()

void lsst::afw::table::ExposureRecord::setTransmissionCurve ( std::shared_ptr< image::TransmissionCurve const > transmissionCurve)
inline

Definition at line 157 of file Exposure.h.

157 {
158 _transmissionCurve = std::move(transmissionCurve);
159 }

◆ setValidPolygon()

void lsst::afw::table::ExposureRecord::setValidPolygon ( std::shared_ptr< geom::polygon::Polygon const > polygon)
inline

Definition at line 149 of file Exposure.h.

149{ _validPolygon = polygon; }

◆ setVisitInfo()

void lsst::afw::table::ExposureRecord::setVisitInfo ( std::shared_ptr< image::VisitInfo const > visitInfo)
inline

Definition at line 152 of file Exposure.h.

◆ setWcs()

void lsst::afw::table::ExposureRecord::setWcs ( std::shared_ptr< geom::SkyWcs const > wcs)
inline

Definition at line 137 of file Exposure.h.

137{ _wcs = wcs; }

Friends And Related Symbol Documentation

◆ ExposureTable

friend class ExposureTable
friend

Definition at line 178 of file Exposure.h.


The documentation for this class was generated from the following files: