LSST Applications g0265f82a02+c6dfa2ddaf,g1162b98a3f+b2075782a9,g2079a07aa2+1b2e822518,g2bbee38e9b+c6dfa2ddaf,g337abbeb29+c6dfa2ddaf,g3ddfee87b4+a60788ef87,g50ff169b8f+2eb0e556e8,g52b1c1532d+90ebb246c7,g555ede804d+a60788ef87,g591dd9f2cf+ba8caea58f,g5ec818987f+864ee9cddb,g858d7b2824+9ee1ab4172,g876c692160+a40945ebb7,g8a8a8dda67+90ebb246c7,g8cdfe0ae6a+4fd9e222a8,g99cad8db69+5e309b7bc6,g9ddcbc5298+a1346535a5,ga1e77700b3+df8f93165b,ga8c6da7877+aa12a14d27,gae46bcf261+c6dfa2ddaf,gb0e22166c9+8634eb87fb,gb3f2274832+d0da15e3be,gba4ed39666+1ac82b564f,gbb8dafda3b+5dfd9c994b,gbeb006f7da+97157f9740,gc28159a63d+c6dfa2ddaf,gc86a011abf+9ee1ab4172,gcf0d15dbbd+a60788ef87,gdaeeff99f8+1cafcb7cd4,gdc0c513512+9ee1ab4172,ge79ae78c31+c6dfa2ddaf,geb67518f79+ba1859f325,geb961e4c1e+f9439d1e6f,gee10cc3b42+90ebb246c7,gf1cff7945b+9ee1ab4172,w.2024.12
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
lsst.meas.base.forcedPhotCcd.may Class Reference
Inheritance diagram for lsst.meas.base.forcedPhotCcd.may:
lsst.afw.table._source.SourceCatalog lsst.meas.base.forcedPhotCcd.for lsst::afw::table::Schema lsst.afw.table._source.SourceCatalog lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst.meas.base.forcedPhotCcd.for lsst::afw::detection::Footprint

Public Types

enum  ComparisonFlags {
  EQUAL_KEYS = 0x01 , EQUAL_NAMES = 0x02 , EQUAL_DOCS = 0x04 , EQUAL_UNITS = 0x08 ,
  EQUAL_FIELDS = 0x0F , EQUAL_ALIASES = 0x10 , IDENTICAL = 0x1F
}
 Bit flags used when comparing schemas. More...
 

Public Member Functions

virtual bool isHeavy () const
 Indicates if this object is a HeavyFootprint.
 
std::shared_ptr< geom::SpanSet > getSpans () const
 Return a shared pointer to the SpanSet.
 
void setSpans (std::shared_ptr< geom::SpanSet > otherSpanSet)
 Sets the shared pointer to the SpanSet in the Footprint.
 
PeakCatalog & getPeaks ()
 Return the Peaks contained in this Footprint.
 
const PeakCatalog & getPeaks () const
 
std::shared_ptr< PeakRecord > addPeak (float fx, float fy, float value)
 Convenience function to add a peak.
 
void sortPeaks (afw::table::Key< float > const &key=afw::table::Key< float >())
 Sort Peaks from most positive value to most negative.
 
void setPeakSchema (afw::table::Schema const &peakSchema)
 Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).
 
void setPeakCatalog (PeakCatalog const &otherPeaks)
 Set the peakCatalog to a copy of the supplied catalog.
 
std::size_t getArea () const
 Return the number of pixels in this Footprint.
 
lsst::geom::Point2D getCentroid () const
 Return the Footprint's centroid.
 
geom::ellipses::Quadrupole getShape () const
 Return the Footprint's shape (interpreted as an ellipse)
 
void shift (int dx, int dy)
 Shift a Footprint by (dx, dy)
 
void shift (lsst::geom::ExtentI const &d)
 Shift a Footprint by a given extent.
 
lsst::geom::Box2I getBBox () const
 Return the Footprint's bounding box.
 
lsst::geom::Box2I getRegion () const
 Return the corners of the MaskedImage the footprints live in.
 
void setRegion (lsst::geom::Box2I const &region)
 Set the corners of the MaskedImage wherein the footprints dwell.
 
void clipTo (lsst::geom::Box2I const &bbox)
 Clip the Footprint such that all values lie inside the supplied Bounding Box.
 
bool contains (lsst::geom::Point2I const &pix) const
 Tests if a pixel postion falls inside the Footprint.
 
std::shared_ptr< Footprinttransform (std::shared_ptr< geom::SkyWcs > source, std::shared_ptr< geom::SkyWcs > target, lsst::geom::Box2I const &region, bool doClip=true) const
 Transform the footprint from one WCS to another.
 
std::shared_ptr< Footprinttransform (lsst::geom::LinearTransform const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 Return a new Footprint whose pixels are the product of applying the specified transformation.
 
std::shared_ptr< Footprinttransform (lsst::geom::AffineTransform const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 Return a new Footprint whose pixels are the product of applying the specified transformation.
 
std::shared_ptr< Footprinttransform (geom::TransformPoint2ToPoint2 const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 Return a new Footprint whose pixels are the product of applying the specified transformation.
 
bool isPersistable () const noexcept override
 Report if this object is persistable.
 
void dilate (int r, geom::Stencil s=geom::Stencil::CIRCLE)
 Dilate the Footprint with a defined kernel.
 
void dilate (geom::SpanSet const &other)
 Dilate the Footprint with a defined kernel.
 
void erode (int r, geom::Stencil s=geom::Stencil::CIRCLE)
 Erode the Footprint with a defined kernel.
 
void erode (geom::SpanSet const &other)
 Erode the Footprint with a defined kernel.
 
void removeOrphanPeaks ()
 Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
 
void updatePeakSignificance (double sigma)
 Compute and update the significance of each peak, given a single value for sigma.
 
void updatePeakSignificance (image::Image< float > const &variance, int polarity)
 Compute and update the significance of each peak, using the variance image.
 
bool isContiguous () const
 Reports if the Footprint is simply connected or has multiple components.
 
std::vector< std::shared_ptr< Footprint > > split () const
 Split a multi-component Footprint into a vector of contiguous Footprints.
 
bool operator== (Footprint const &other) const
 equality operator
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file.
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory.
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object.
 
std::string join (std::string const &a, std::string const &b) const
 Join strings using the field delimiter appropriate for this Schema.
 
std::string join (std::string const &a, std::string const &b, std::string const &c) const
 
std::string join (std::string const &a, std::string const &b, std::string const &c, std::string const &d) const
 
template<typename T >
SchemaItem< T > find (std::string const &name) const
 Find a SchemaItem in the Schema by name.
 
template<typename T >
SchemaItem< T > find (Key< T > const &key) const
 Find a SchemaItem in the Schema by key.
 
template<typename F >
void findAndApply (std::string const &name, F &&func) const
 Find a SchemaItem by name and run a functor on it.
 
SubSchema operator[] (std::string const &name) const
 Look up a (possibly incomplete) name in the Schema.
 
std::set< std::stringgetNames (bool topOnly=false) const
 Return a set of field names in the schema.
 
std::size_t getRecordSize () const
 Return the raw size of a record in bytes.
 
std::size_t getFieldCount () const
 The total number of fields.
 
std::size_t getFlagFieldCount () const
 The number of Flag fields.
 
std::size_t getNonFlagFieldCount () const
 The number of non-Flag fields.
 
template<typename T >
Key< T > addField (Field< T > const &field, bool doReplace=false)
 Add a new field to the Schema, and return the associated Key.
 
template<typename T >
Key< T > addField (std::string const &name, std::string const &doc, std::string const &units="", FieldBase< T > const &base=FieldBase< T >(), bool doReplace=false)
 Add a new field to the Schema, and return the associated Key.
 
template<typename T >
Key< T > addField (std::string const &name, std::string const &doc, FieldBase< T > const &base, bool doReplace=false)
 Add a new field to the Schema, and return the associated Key.
 
template<typename T >
void replaceField (Key< T > const &key, Field< T > const &field)
 Replace the Field (name/description) for an existing Key.
 
template<typename F >
void forEach (F &func) const
 Apply a functor to each SchemaItem in the Schema.
 
template<typename F >
void forEach (F const &func) const
 
bool operator== (Schema const &other) const
 Equality comparison.
 
bool operator!= (Schema const &other) const
 
std::size_t hash_value () const noexcept
 Return a hash of this object.
 
int compare (Schema const &other, int flags=EQUAL_KEYS) const
 Do a detailed equality comparison of two schemas.
 
int contains (Schema const &other, int flags=EQUAL_KEYS) const
 Test whether the given schema is a subset of this.
 
template<typename T >
int contains (SchemaItem< T > const &item, int flags=EQUAL_KEYS) const
 Return true if the given item is in this schema.
 
std::shared_ptr< AliasMap > getAliasMap () const
 Return the map of aliases.
 
void setAliasMap (std::shared_ptr< AliasMap > aliases)
 Set the alias map.
 
void disconnectAliases ()
 Sever the connection between this schema and any others with which it shares aliases.
 

Static Public Member Functions

static std::shared_ptr< lsst::afw::detection::FootprintreadFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object.
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file.
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory.
 
static std::shared_ptr< lsst::afw::detection::FootprintdynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr.
 
static Schema readFits (std::string const &filename, int hdu=fits::DEFAULT_HDU)
 Construct from reading a FITS file.
 
static Schema readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 
static Schema readFits (fits::Fits &fitsfile)
 
static Schema fromFitsMetadata (daf::base::PropertyList &header, bool stripMetadata=true)
 Construct from reading a FITS header.
 

Static Public Attributes

 schema
 
static int const VERSION = detail::SchemaImpl::VERSION
 

Protected Types

using OutputArchiveHandle = io::OutputArchiveHandle
 

Protected Member Functions

std::string getPersistenceName () const override
 Return the name correspoinging ot the persistence type.
 
std::string getPythonModule () const override
 Return the python module the object will live in.
 
void write (OutputArchiveHandle &handle) const override
 Write an instance of a Footprint to an output Archive.
 

Static Protected Member Functions

static std::unique_ptr< FootprintreadSpanSet (afw::table::BaseCatalog const &, afw::table::io::InputArchive const &)
 Static method used to unpersist the SpanSet member of the Footprint class.
 
static void readPeaks (afw::table::BaseCatalog const &, Footprint &)
 Static method used to unpersist the PeakCatalog member of the Footprint class.
 

Detailed Description

self.measurement.run(measCat, exposure, refCat, refWcs, exposureId=exposureId)
if self.config.doApCorr:
    apCorrMap = exposure.getInfo().getApCorrMap()
    if apCorrMap is None:
        self.log.warning("Forced exposure image does not have valid aperture correction; skipping.")
    else:
        self.applyApCorr.run(
            catalog=measCat,
            apCorrMap=apCorrMap,
        )
self.catalogCalculation.run(measCat)

return pipeBase.Struct(measCat=measCat)

def attachFootprints(self, sources, refCat, exposure, refWcs):

Definition at line 640 of file forcedPhotCcd.py.

Member Typedef Documentation

◆ OutputArchiveHandle

using lsst::afw::table::io::Persistable::OutputArchiveHandle = io::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

Member Enumeration Documentation

◆ ComparisonFlags

Bit flags used when comparing schemas.

All quantities are compared in insertion order, so if two schemas have the same fields added in opposite order, they will not be considered equal.

Enumerator
EQUAL_KEYS 

Keys have the same types offsets, and sizes.

EQUAL_NAMES 

Fields have the same names (ordered).

EQUAL_DOCS 

Fields have the same documentation (ordered).

EQUAL_UNITS 

Fields have the same units (ordered).

EQUAL_FIELDS 

Fields are identical (but aliases may not be).

EQUAL_ALIASES 

Schemas have identical AliasMaps.

IDENTICAL 

Everything is the same.

Definition at line 65 of file Schema.h.

65 {
66 EQUAL_KEYS = 0x01,
67 EQUAL_NAMES = 0x02,
68 EQUAL_DOCS = 0x04,
69 EQUAL_UNITS = 0x08,
70 EQUAL_FIELDS = 0x0F,
71 EQUAL_ALIASES = 0x10,
72 IDENTICAL = 0x1F
73 };
@ EQUAL_DOCS
Fields have the same documentation (ordered).
Definition Schema.h:68
@ IDENTICAL
Everything is the same.
Definition Schema.h:72
@ EQUAL_NAMES
Fields have the same names (ordered).
Definition Schema.h:67
@ EQUAL_UNITS
Fields have the same units (ordered).
Definition Schema.h:69
@ EQUAL_KEYS
Keys have the same types offsets, and sizes.
Definition Schema.h:66
@ EQUAL_FIELDS
Fields are identical (but aliases may not be).
Definition Schema.h:70
@ EQUAL_ALIASES
Schemas have identical AliasMaps.
Definition Schema.h:71

Member Function Documentation

◆ addField() [1/3]

template<typename T >
Key< T > lsst::afw::table::Schema::addField ( Field< T > const & field,
bool doReplace = false )
inherited

Add a new field to the Schema, and return the associated Key.

The offsets of fields are determined by the order they are added, but may be not contiguous (the Schema may add padding to align fields, and how much padding is considered an implementation detail).

If doReplace is true and the field exists, it will be replaced instead of throwing an exception.

Definition at line 479 of file Schema.cc.

479 {
480 _edit();
481 return _impl->addField(field, doReplace);
482}
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a field to the schema (used to implement Schema::addField).
Definition Schema.cc:314

◆ addField() [2/3]

template<typename T >
Key< T > lsst::afw::table::Schema::addField ( std::string const & name,
std::string const & doc,
FieldBase< T > const & base,
bool doReplace = false )
inlineinherited

Add a new field to the Schema, and return the associated Key.

This is simply a convenience wrapper, equivalent to:

addField(Field<T>(name, doc, base), doReplace)

Definition at line 194 of file Schema.h.

195 {
196 return addField(Field<T>(name, doc, base), doReplace);
197 }
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
Definition Schema.cc:479

◆ addField() [3/3]

template<typename T >
Key< T > lsst::afw::table::Schema::addField ( std::string const & name,
std::string const & doc,
std::string const & units = "",
FieldBase< T > const & base = FieldBase<T>(),
bool doReplace = false )
inlineinherited

Add a new field to the Schema, and return the associated Key.

This is simply a convenience wrapper, equivalent to:

addField(Field<T>(name, doc, units, base), doReplace)

Definition at line 181 of file Schema.h.

182 {
183 return addField(Field<T>(name, doc, units, base), doReplace);
184 }

◆ addPeak()

std::shared_ptr< PeakRecord > Footprint::addPeak ( float fx,
float fy,
float value )
inherited

Convenience function to add a peak.

Parameters
fxFloat containing the x position of a peak
fyFloat containing the y position of a peak
valueThe intensity value of the peak

Definition at line 47 of file Footprint.cc.

47 {
49 p->setIx(fx);
50 p->setIy(fy);
51 p->setFx(fx);
52 p->setFy(fy);
53 p->setPeakValue(height);
54 return p;
55}
PeakCatalog & getPeaks()
Return the Peaks contained in this Footprint.
Definition Footprint.h:129
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition Catalog.h:489

◆ clipTo()

void Footprint::clipTo ( lsst::geom::Box2I const & bbox)
inherited

Clip the Footprint such that all values lie inside the supplied Bounding Box.

Parameters
bboxInteger box object that defines the boundaries the footprint should be clipped to.

Definition at line 74 of file Footprint.cc.

74 {
75 setSpans(getSpans()->clippedTo(box));
77}
void removeOrphanPeaks()
Remove peaks from the PeakCatalog that fall outside the area of the Footprint.
Definition Footprint.cc:136
std::shared_ptr< geom::SpanSet > getSpans() const
Return a shared pointer to the SpanSet.
Definition Footprint.h:115
void setSpans(std::shared_ptr< geom::SpanSet > otherSpanSet)
Sets the shared pointer to the SpanSet in the Footprint.
Definition Footprint.cc:45

◆ compare()

int lsst::afw::table::Schema::compare ( Schema const & other,
int flags = EQUAL_KEYS ) const
inherited

Do a detailed equality comparison of two schemas.

See ComparisonFlags for a description of the possible return values

Parameters
[in]otherThe other schema to compare to.
[in]flagsWhich types of comparisions to perform. Flag bits not present here will never be returned.

Definition at line 509 of file Schema.cc.

509 {
510 int result = contains(other, flags);
511 if (_impl->getItems().size() != other._impl->getItems().size()) {
512 result &= ~EQUAL_FIELDS;
513 }
514 if (getAliasMap()->size() != other.getAliasMap()->size()) {
515 result &= ~EQUAL_ALIASES;
516 }
517 return result;
518}
py::object result
Definition _schema.cc:429
std::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
Definition Schema.h:279
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Definition Schema.cc:490
ItemContainer const & getItems() const
Return the vector of SchemaItem variants.
Definition SchemaImpl.h:133
T size(T... args)

◆ contains() [1/3]

bool Footprint::contains ( lsst::geom::Point2I const & pix) const
inherited

Tests if a pixel postion falls inside the Footprint.

Parameters
pixInteger point object defining the position of a pixel to test

Definition at line 79 of file Footprint.cc.

79{ return getSpans()->contains(pix); }

◆ contains() [2/3]

int lsst::afw::table::Schema::contains ( Schema const & other,
int flags = EQUAL_KEYS ) const
inherited

Test whether the given schema is a subset of this.

This function behaves very similarly to compare(), but ignores fields that are present in this but absent in other.

Definition at line 490 of file Schema.cc.

490 {
491 if (_impl == other._impl) return flags;
492 if (_impl->getItems().size() < other._impl->getItems().size()) return 0;
493 int result = flags;
494 if (result & EQUAL_FIELDS) {
495 for (Impl::ItemContainer::const_iterator i1 = _impl->getItems().begin(),
496 i2 = other._impl->getItems().begin();
497 i2 != other._impl->getItems().end(); ++i1, ++i2) {
498 if ((result & EQUAL_KEYS) && !ItemFunctors::compareKeys(*i1, *i2)) result &= ~EQUAL_KEYS;
499 if ((result & EQUAL_NAMES) && !ItemFunctors::compareNames(*i1, *i2)) result &= ~EQUAL_NAMES;
500 if ((result & EQUAL_DOCS) && !ItemFunctors::compareDocs(*i1, *i2)) result &= ~EQUAL_DOCS;
501 if ((result & EQUAL_UNITS) && !ItemFunctors::compareUnits(*i1, *i2)) result &= ~EQUAL_UNITS;
502 if (!result) break;
503 }
504 }
505 if ((result & EQUAL_ALIASES) && !getAliasMap()->contains(*other.getAliasMap())) result &= ~EQUAL_ALIASES;
506 return result;
507}
T begin(T... args)

◆ contains() [3/3]

template<typename T >
int lsst::afw::table::Schema::contains ( SchemaItem< T > const & item,
int flags = EQUAL_KEYS ) const
inherited

Return true if the given item is in this schema.

The flags must include the EQUAL_KEYS bit, and if the item cannot be found by key no bits will be set on return.

Definition at line 529 of file Schema.cc.

529 {
530 return _impl->contains(item, flags);
531}
int contains(SchemaItem< T > const &item, int flags) const
Definition Schema.cc:225

◆ dilate() [1/2]

void Footprint::dilate ( geom::SpanSet const & other)
inherited

Dilate the Footprint with a defined kernel.

This function enlarges the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
otherSpanSet to use as the kernel in dilation

Definition at line 124 of file Footprint.cc.

124{ setSpans(getSpans()->dilated(other)); }

◆ dilate() [2/2]

void Footprint::dilate ( int r,
geom::Stencil s = geom::Stencil::CIRCLE )
inherited

Dilate the Footprint with a defined kernel.

This function enlarges the SpanSet which defines the area of the Footprint by an amount governed by in input kernel

Parameters
rThe radius of the stencil object used to create a dilation kernel
sThe stencil object used to create the dilation kernel

Definition at line 122 of file Footprint.cc.

122{ setSpans(getSpans()->dilated(r, s)); }

◆ disconnectAliases()

void lsst::afw::table::Schema::disconnectAliases ( )
inherited

Sever the connection between this schema and any others with which it shares aliases.

Definition at line 540 of file Schema.cc.

540{ _aliases = std::make_shared<AliasMap>(*_aliases); }

◆ dynamicCast()

Dynamically cast a shared_ptr.

Dynamically cast a shared pointer and raise on failure.

You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;

Exceptions
lsst::pex::exceptions::LogicErrorif the cast fails

param[in] ptr The pointer to be cast.

Returns
The cast pointer.
Exceptions
lsst::pex::exceptions::TypeErrorIf the dynamic cast fails.

Definition at line 218 of file Persistable.cc.

◆ erode() [1/2]

void Footprint::erode ( geom::SpanSet const & other)
inherited

Erode the Footprint with a defined kernel.

This function reduces the size of the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
otherSpanSet to use as the kernel in erosion

Definition at line 131 of file Footprint.cc.

131 {
132 setSpans(getSpans()->eroded(other));
134}

◆ erode() [2/2]

void Footprint::erode ( int r,
geom::Stencil s = geom::Stencil::CIRCLE )
inherited

Erode the Footprint with a defined kernel.

This function reduces the size of the SpanSet which defines the area of the Footprint by an amount governed by the input kernel

Parameters
rThe radius of the stencil object used to create a erosion kernel
sThe stencil object used to create the erosion kernel

Definition at line 126 of file Footprint.cc.

126 {
127 setSpans(getSpans()->eroded(r, s));
129}

◆ find() [1/2]

template<typename T >
SchemaItem< T > lsst::afw::table::Schema::find ( Key< T > const & key) const
inherited

Find a SchemaItem in the Schema by key.

Keys corresponding to named subfields are accepted, and will return a SchemaItem whose field is copied from the parent field with only the name changed. Keys corresponding to unnamed subfields (such as array elements) are not accepted.

Definition at line 474 of file Schema.cc.

474 {
475 return _impl->find(key);
476}
SchemaItem< T > find(std::string const &name) const
Find an item by name (used to implement Schema::find).
Definition Schema.cc:92

◆ find() [2/2]

template<typename T >
SchemaItem< T > lsst::afw::table::Schema::find ( std::string const & name) const
inherited

Find a SchemaItem in the Schema by name.

Names corresponding to named subfields are accepted, and will return a SchemaItem whose field is copied from the parent field with only the name changed.

Definition at line 467 of file Schema.cc.

467 {
468 std::string tmp(name);
469 _aliases->_apply(tmp);
470 return _impl->find<T>(tmp);
471}

◆ findAndApply()

template<typename F >
void lsst::afw::table::Schema::findAndApply ( std::string const & name,
F && func ) const
inlineinherited

Find a SchemaItem by name and run a functor on it.

Names corresponding to named subfields are not accepted. The given functor must have an overloaded function call operator that accepts any SchemaItem type (the same as a functor provided to forEach).

Definition at line 117 of file Schema.h.

117 {
118 _impl->findAndApply(_aliases->apply(name), std::forward<F>(func));
119 }
decltype(auto) findAndApply(std::string const &name, F &&func) const
Find an item by name and run the given functor on it.
Definition SchemaImpl.h:90

◆ forEach() [1/2]

template<typename F >
void lsst::afw::table::Schema::forEach ( F & func) const
inlineinherited

Apply a functor to each SchemaItem in the Schema.

The functor must have a templated or sufficiently overloaded operator() that supports SchemaItems of all supported field types - even those that are not present in this particular Schema.

Fields will be processed in the order they were added to the schema.

Definition at line 214 of file Schema.h.

214 {
215 for (auto const & item : _impl->getItems()) {
216 std::visit(func, item);
217 }
218 }

◆ forEach() [2/2]

template<typename F >
void lsst::afw::table::Schema::forEach ( F const & func) const
inlineinherited

Definition at line 220 of file Schema.h.

220 {
221 for (auto const & item : _impl->getItems()) {
222 std::visit(func, item);
223 }
224 }

◆ fromFitsMetadata()

Schema lsst::afw::table::Schema::fromFitsMetadata ( daf::base::PropertyList & header,
bool stripMetadata = true )
staticinherited

Construct from reading a FITS header.

If 'stripMetadata', then the header will be modified, removing the relevant keywords.

Definition at line 448 of file Schema.cc.

448 {
449 return io::FitsSchemaInputMapper(header, stripMetadata).finalize();
450}

◆ getAliasMap()

std::shared_ptr< AliasMap > lsst::afw::table::Schema::getAliasMap ( ) const
inlineinherited

Return the map of aliases.

Note that while this is a const method, it does allow the Schema's aliases to be edited - this allows the aliases to be modified even after a Table has been constructed from the Schema.

See AliasMap for more information on schema aliases.

Definition at line 279 of file Schema.h.

279{ return _aliases; }

◆ getArea()

std::size_t lsst::afw::detection::Footprint::getArea ( ) const
inlineinherited

Return the number of pixels in this Footprint.

This function returns the real number of pixels, not the area of the bbox.

Definition at line 173 of file Footprint.h.

173{ return _spans->getArea(); }

◆ getBBox()

lsst::geom::Box2I lsst::afw::detection::Footprint::getBBox ( ) const
inlineinherited

Return the Footprint's bounding box.

Definition at line 208 of file Footprint.h.

208{ return _spans->getBBox(); }

◆ getCentroid()

lsst::geom::Point2D lsst::afw::detection::Footprint::getCentroid ( ) const
inlineinherited

Return the Footprint's centroid.

The centroid is calculated as the mean of the pixel centers

Definition at line 180 of file Footprint.h.

180{ return _spans->computeCentroid(); }

◆ getFieldCount()

std::size_t lsst::afw::table::Schema::getFieldCount ( ) const
inlineinherited

The total number of fields.

Definition at line 152 of file Schema.h.

152{ return _impl->getFieldCount(); }
std::size_t getFieldCount() const
The total number of fields.
Definition SchemaImpl.h:69

◆ getFlagFieldCount()

std::size_t lsst::afw::table::Schema::getFlagFieldCount ( ) const
inlineinherited

The number of Flag fields.

Definition at line 155 of file Schema.h.

155{ return _impl->getFlagFieldCount(); }
std::size_t getFlagFieldCount() const
The number of Flag fields.
Definition SchemaImpl.h:72

◆ getNames()

std::set< std::string > lsst::afw::table::Schema::getNames ( bool topOnly = false) const
inherited

Return a set of field names in the schema.

If topOnly==true, return a unique list of only the part of the names before the first underscore. For example, if the full list of field names is ['a_b_c', 'a_d', 'e_f'], topOnly==true will return ['a', 'e'].

Returns an instance of Python's builtin set in Python.

Aliases are not returned.

Definition at line 464 of file Schema.cc.

464{ return _impl->getNames(topOnly); }
std::set< std::string > getNames(bool topOnly) const
Return a set of field names (used to implement Schema::getNames).
Definition Schema.cc:251

◆ getNonFlagFieldCount()

std::size_t lsst::afw::table::Schema::getNonFlagFieldCount ( ) const
inlineinherited

The number of non-Flag fields.

Definition at line 158 of file Schema.h.

158{ return _impl->getNonFlagFieldCount(); }
std::size_t getNonFlagFieldCount() const
The number of non-Flag fields.
Definition SchemaImpl.h:75

◆ getPeaks() [1/2]

PeakCatalog & lsst::afw::detection::Footprint::getPeaks ( )
inlineinherited

Return the Peaks contained in this Footprint.

The peaks should be ordered by decreasing pixel intensity at the peak position (so the most negative peak appears last). Users that add new Peaks manually are responsible for maintaining this sorting.

Definition at line 129 of file Footprint.h.

129{ return _peaks; }

◆ getPeaks() [2/2]

const PeakCatalog & lsst::afw::detection::Footprint::getPeaks ( ) const
inlineinherited

Definition at line 130 of file Footprint.h.

130{ return _peaks; }

◆ getPersistenceName()

std::string Footprint::getPersistenceName ( ) const
overrideprotectedvirtualinherited

Return the name correspoinging ot the persistence type.

Reimplemented from lsst::afw::table::io::Persistable.

Reimplemented in lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >.

Definition at line 269 of file Footprint.cc.

269{ return getFootprintPersistenceName(); }

◆ getPythonModule()

std::string lsst::afw::detection::Footprint::getPythonModule ( ) const
inlineoverrideprotectedvirtualinherited

Return the python module the object will live in.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 385 of file Footprint.h.

385{ return "lsst.afw.detection"; }

◆ getRecordSize()

std::size_t lsst::afw::table::Schema::getRecordSize ( ) const
inlineinherited

Return the raw size of a record in bytes.

Definition at line 149 of file Schema.h.

149{ return _impl->getRecordSize(); }
std::size_t getRecordSize() const
The size of a record in bytes.
Definition SchemaImpl.h:66

◆ getRegion()

lsst::geom::Box2I lsst::afw::detection::Footprint::getRegion ( ) const
inlineinherited

Return the corners of the MaskedImage the footprints live in.

Definition at line 213 of file Footprint.h.

213{ return _region; }

◆ getShape()

geom::ellipses::Quadrupole lsst::afw::detection::Footprint::getShape ( ) const
inlineinherited

Return the Footprint's shape (interpreted as an ellipse)

The shape is determined by measuring the moments of the pixel centers about its centroid (cf. getCentroid)

Definition at line 188 of file Footprint.h.

188{ return _spans->computeShape(); }

◆ getSpans()

std::shared_ptr< geom::SpanSet > lsst::afw::detection::Footprint::getSpans ( ) const
inlineinherited

Return a shared pointer to the SpanSet.

Definition at line 115 of file Footprint.h.

115{ return _spans; }

◆ hash_value()

std::size_t lsst::afw::table::Schema::hash_value ( ) const
noexceptinherited

Return a hash of this object.

Definition at line 520 of file Schema.cc.

520 {
521 // Completely arbitrary seed
522 std::size_t result = 17;
523 auto hasher = [&result](auto const &item) { result = utils::hashCombine(result, item.key); };
524 forEach(hasher);
525 return result;
526}
void forEach(F &func) const
Apply a functor to each SchemaItem in the Schema.
Definition Schema.h:214
std::size_t hashCombine(std::size_t seed) noexcept
Combine hashes.
Definition hashCombine.h:35

◆ isContiguous()

bool lsst::afw::detection::Footprint::isContiguous ( ) const
inlineinherited

Reports if the Footprint is simply connected or has multiple components.

Definition at line 358 of file Footprint.h.

358{ return getSpans()->isContiguous(); };

◆ isHeavy()

virtual bool lsst::afw::detection::Footprint::isHeavy ( ) const
inlinevirtualinherited

Indicates if this object is a HeavyFootprint.

Reimplemented in lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >.

Definition at line 111 of file Footprint.h.

111{ return false; }

◆ isPersistable()

bool lsst::afw::detection::Footprint::isPersistable ( ) const
inlineoverridevirtualnoexceptinherited

Report if this object is persistable.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 283 of file Footprint.h.

283{ return true; }

◆ join() [1/3]

std::string lsst::afw::table::Schema::join ( std::string const & a,
std::string const & b ) const
inherited

Join strings using the field delimiter appropriate for this Schema.

Definition at line 452 of file Schema.cc.

452 {
453 // delegate to utility funcs at top of this file
454 return afw::table::join(a, b, getDelimiter());
455}
table::Key< int > b

◆ join() [2/3]

std::string lsst::afw::table::Schema::join ( std::string const & a,
std::string const & b,
std::string const & c ) const
inlineinherited

Definition at line 78 of file Schema.h.

78 {
79 return join(join(a, b), c);
80 }
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
Definition Schema.cc:452

◆ join() [3/3]

std::string lsst::afw::table::Schema::join ( std::string const & a,
std::string const & b,
std::string const & c,
std::string const & d ) const
inlineinherited

Definition at line 81 of file Schema.h.

82 {
83 return join(join(a, b), join(c, d));
84 }

◆ operator!=()

bool lsst::afw::table::Schema::operator!= ( Schema const & other) const
inlineinherited

Definition at line 236 of file Schema.h.

236{ return !this->operator==(other); }
bool operator==(Schema const &other) const
Equality comparison.
Definition Schema.h:235

◆ operator==() [1/2]

bool Footprint::operator== ( Footprint const & other) const
inherited

equality operator

Parameters
otherThe Footprint for which equality will be computed

Definition at line 176 of file Footprint.cc.

176 {
177 /* If the peakCatalogs are not the same length the Footprints can't be equal */
178 if (getPeaks().size() != other.getPeaks().size()) {
179 return false;
180 }
181 /* Check that for every peak in the PeakCatalog there is a corresponding peak
182 * in the other, and if not return false
183 */
184 for (auto const& selfPeak : getPeaks()) {
185 bool match = false;
186 for (auto const& otherPeak : other.getPeaks()) {
187 if (selfPeak.getI() == otherPeak.getI() && selfPeak.getF() == otherPeak.getF() &&
188 selfPeak.getPeakValue() == otherPeak.getPeakValue()) {
189 match = true;
190 break;
191 }
192 }
193 if (!match) {
194 return false;
195 }
196 }
197 /* At this point the PeakCatalogs have evaluated true, compare the SpanSets
198 */
199 return *(getSpans()) == *(other.getSpans());
200}
size_type size() const
Return the number of elements in the catalog.
Definition Catalog.h:412

◆ operator==() [2/2]

bool lsst::afw::table::Schema::operator== ( Schema const & other) const
inlineinherited

Equality comparison.

Schemas are considered equal according the standard equality operator if their sequence of keys are identical (same types with the same offsets); names and descriptions of fields are not considered. For a more precise comparison, use compare() or contains().

Definition at line 235 of file Schema.h.

235{ return compare(other, EQUAL_KEYS); }
int compare(Schema const &other, int flags=EQUAL_KEYS) const
Do a detailed equality comparison of two schemas.
Definition Schema.cc:509

◆ operator[]()

SubSchema lsst::afw::table::Schema::operator[] ( std::string const & name) const
inlineinherited

Look up a (possibly incomplete) name in the Schema.

See SubSchema for more information.

This member function should generally only be used on "finished" Schemas; modifying a Schema after a SubSchema to it has been constructed will not allow the proxy to track the additions, and will invoke the copy-on-write mechanism of the Schema itself.

Definition at line 464 of file Schema.h.

464 {
465 return SubSchema(_impl, _aliases, name);
466}
friend class SubSchema
Definition Schema.h:326

◆ readFits() [1/6]

Read an object from an already open FITS object.

Parameters
[in]fitsfileFITS object to read from, already positioned at the desired HDU.

Definition at line 183 of file Persistable.h.

◆ readFits() [2/6]

Schema lsst::afw::table::Schema::readFits ( fits::Fits & fitsfile)
staticinherited

Definition at line 442 of file Schema.cc.

442 {
443 daf::base::PropertyList header;
444 fitsfile.readMetadata(header, false);
445 return fromFitsMetadata(header);
446}
static Schema fromFitsMetadata(daf::base::PropertyList &header, bool stripMetadata=true)
Construct from reading a FITS header.
Definition Schema.cc:448

◆ readFits() [3/6]

static std::shared_ptr< lsst::afw::detection::Footprint > lsst::afw::table::io::PersistableFacade< lsst::afw::detection::Footprint >::readFits ( fits::MemFileManager & manager,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a FITS file in memory.

Parameters
[in]managerManager for the memory to read from.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 205 of file Persistable.h.

◆ readFits() [4/6]

Schema lsst::afw::table::Schema::readFits ( fits::MemFileManager & manager,
int hdu = fits::DEFAULT_HDU )
staticinherited

Definition at line 436 of file Schema.cc.

436 {
437 fits::Fits fp{manager, "r", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK};
438 fp.setHdu(hdu);
439 return readFits(fp);
440}
static Schema readFits(std::string const &filename, int hdu=fits::DEFAULT_HDU)
Construct from reading a FITS file.
Definition Schema.cc:430

◆ readFits() [5/6]

static std::shared_ptr< lsst::afw::detection::Footprint > lsst::afw::table::io::PersistableFacade< lsst::afw::detection::Footprint >::readFits ( std::string const & fileName,
int hdu = fits::DEFAULT_HDU )
inlinestaticinherited

Read an object from a regular FITS file.

Parameters
[in]fileNameName of the file to read.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 194 of file Persistable.h.

◆ readFits() [6/6]

Schema lsst::afw::table::Schema::readFits ( std::string const & filename,
int hdu = fits::DEFAULT_HDU )
staticinherited

Construct from reading a FITS file.

Reads from the nominated 'hdu' (0=PHU which cannot be a catalog, afw::fits::DEFAULT_HDU is a special value meaning read from the first HDU with NAXIS != 0).

Definition at line 430 of file Schema.cc.

430 {
431 fits::Fits fp{filename, "r", fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK};
432 fp.setHdu(hdu);
433 return readFits(fp);
434}

◆ readPeaks()

void Footprint::readPeaks ( afw::table::BaseCatalog const & peakCat,
Footprint & loadedFootprint )
staticprotectedinherited

Static method used to unpersist the PeakCatalog member of the Footprint class.

Definition at line 310 of file Footprint.cc.

310 {
311 using namespace std::string_literals;
312 if (!peakCat.getSchema().contains(PeakTable::makeMinimalSchema())) {
313 // need to handle an older form of Peak persistence for backwards compatibility
314 afw::table::SchemaMapper mapper(peakCat.getSchema());
315 mapper.addMinimalSchema(PeakTable::makeMinimalSchema());
316 afw::table::Key<float> oldX = peakCat.getSchema()["x"];
317 afw::table::Key<float> oldY = peakCat.getSchema()["y"];
318 afw::table::Key<float> oldPeakValue = peakCat.getSchema()["value"];
319 mapper.addMapping(oldX, "f.x"s);
320 mapper.addMapping(oldY, "f.y"s);
321 mapper.addMapping(oldPeakValue, "peakValue"s);
322 loadedFootprint.setPeakSchema(mapper.getOutputSchema());
323 auto peaks = loadedFootprint.getPeaks();
324 peaks.reserve(peakCat.size());
325 for (auto const& peak : peakCat) {
326 auto newPeak = peaks.addNew();
327 newPeak->assign(peak, mapper);
328 newPeak->setIx(static_cast<int>(newPeak->getFx()));
329 newPeak->setIy(static_cast<int>(newPeak->getFy()));
330 }
331 return;
332 }
333 loadedFootprint.setPeakSchema(peakCat.getSchema());
334 auto& peaks = loadedFootprint.getPeaks();
335 peaks.reserve(peakCat.size());
336 for (auto const& peak : peakCat) {
337 peaks.addNew()->assign(peak);
338 }
339}
SchemaMapper * mapper
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition Peak.h:137

◆ readSpanSet()

std::unique_ptr< Footprint > Footprint::readSpanSet ( afw::table::BaseCatalog const & catalog,
afw::table::io::InputArchive const & archive )
staticprotectedinherited

Static method used to unpersist the SpanSet member of the Footprint class.

Definition at line 286 of file Footprint.cc.

287 {
288 int fieldCount = catalog.getSchema().getFieldCount();
289 LSST_ARCHIVE_ASSERT(fieldCount == 1 || fieldCount == 3);
290 std::shared_ptr<geom::SpanSet> loadedSpanSet;
291 if (fieldCount == 1) {
292 // This is a new style footprint with a SpanSet as a member, treat accordingly
293 auto const schemaAndKey = spanSetPersistenceHelper();
294 int persistedSpanSetId = catalog.front().get(schemaAndKey.second);
295 loadedSpanSet = std::dynamic_pointer_cast<geom::SpanSet>(archive.get(persistedSpanSetId));
296 } else {
297 // This block is for an old style footprint load.
298 auto const& keys = LegacyFootprintPersistenceHelper::get();
300 tempVec.reserve(catalog.size());
301 for (auto const& val : catalog) {
302 tempVec.emplace_back(val.get(keys.spanY), val.get(keys.spanX0), val.get(keys.spanX1));
303 }
304 loadedSpanSet = std::make_shared<geom::SpanSet>(std::move(tempVec));
305 }
306 auto loadedFootprint = std::unique_ptr<Footprint>(new Footprint(loadedSpanSet));
307 return loadedFootprint;
308}
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition Persistable.h:48
Footprint()
Constructor of a empty Footprint object.
Definition Footprint.h:96
T emplace_back(T... args)
T move(T... args)
T reserve(T... args)
ImageT val
Definition CR.cc:146

◆ removeOrphanPeaks()

void Footprint::removeOrphanPeaks ( )
inherited

Remove peaks from the PeakCatalog that fall outside the area of the Footprint.

Definition at line 136 of file Footprint.cc.

136 {
137 for (auto iter = getPeaks().begin(); iter != getPeaks().end(); ++iter) {
138 if (!getSpans()->contains(lsst::geom::Point2I(iter->getIx(), iter->getIy()))) {
139 iter = getPeaks().erase(iter);
140 --iter;
141 }
142 }
143}
iterator erase(iterator pos)
Erase the record pointed to by pos, and return an iterator the next record.
Definition Catalog.h:564

◆ replaceField()

template<typename T >
void lsst::afw::table::Schema::replaceField ( Key< T > const & key,
Field< T > const & field )
inherited

Replace the Field (name/description) for an existing Key.

Definition at line 485 of file Schema.cc.

485 {
486 _edit();
487 _impl->replaceField(key, field);
488}
void replaceField(Key< T > const &key, Field< T > const &field)
Replace the Field in an existing SchemaItem without changing the Key.
Definition Schema.cc:193

◆ setAliasMap()

void lsst::afw::table::Schema::setAliasMap ( std::shared_ptr< AliasMap > aliases)
inherited

Set the alias map.

This resets the internal pointer to the alias map, disconnecting this schema from any others it shares aliases with.

Passing a null pointer is equivalent to passing an empty map.

Definition at line 533 of file Schema.cc.

533 {
534 if (!aliases) {
535 aliases = std::make_shared<AliasMap>();
536 }
537 _aliases = aliases;
538}

◆ setPeakCatalog()

void Footprint::setPeakCatalog ( PeakCatalog const & otherPeaks)
inherited

Set the peakCatalog to a copy of the supplied catalog.

PeakCatalog will be copied into the Footprint, but a PeakCatalog is a shallow copy, so records will not be duplicated. This function will throw an error if the PeakCatalog of *this is not empty.

Parameters
otherPeaksThe PeakCatalog to copy

Definition at line 435 of file Footprint.cc.

435 {
436 if (!getPeaks().empty()) {
437 throw LSST_EXCEPT(pex::exceptions::LogicError, "Cannot change the PeakCatalog unless it is empty");
438 }
439 // this syntax doesn't work in Python, which is why this method has to exist
440 getPeaks() = otherPeaks;
441}
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48

◆ setPeakSchema()

void Footprint::setPeakSchema ( afw::table::Schema const & peakSchema)
inherited

Set the Schema used by the PeakCatalog (will throw if PeakCatalog is not empty).

Parameters
peakSchemaThe schema to use in the PeakCatalog
Exceptions
pex::exceptions::LogicErrorThrown if if the PeakCatalog is not empty

Definition at line 431 of file Footprint.cc.

431 {
432 setPeakCatalog(PeakCatalog(peakSchema));
433}
void setPeakCatalog(PeakCatalog const &otherPeaks)
Set the peakCatalog to a copy of the supplied catalog.
Definition Footprint.cc:435
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition Peak.h:244

◆ setRegion()

void lsst::afw::detection::Footprint::setRegion ( lsst::geom::Box2I const & region)
inlineinherited

Set the corners of the MaskedImage wherein the footprints dwell.

Parameters
regionA box describing the corners of the Image the Footprint derives from

Definition at line 220 of file Footprint.h.

220{ _region = region; }

◆ setSpans()

void Footprint::setSpans ( std::shared_ptr< geom::SpanSet > otherSpanSet)
inherited

Sets the shared pointer to the SpanSet in the Footprint.

Parameters
otherSpanSetShared pointer to a SpanSet

Definition at line 45 of file Footprint.cc.

45{ _spans = otherSpanSet; }

◆ shift() [1/2]

void Footprint::shift ( int dx,
int dy )
inherited

Shift a Footprint by (dx, dy)

Parameters
dxHow much to move Footprint in column direction
dyHow much to move in row direction

Definition at line 64 of file Footprint.cc.

64 {
65 setSpans(getSpans()->shiftedBy(dx, dy));
66 for (auto& peak : getPeaks()) {
67 peak.setIx(peak.getIx() + dx);
68 peak.setIy(peak.getIy() + dy);
69 peak.setFx(peak.getFx() + dx);
70 peak.setFy(peak.getFy() + dy);
71 }
72}

◆ shift() [2/2]

void lsst::afw::detection::Footprint::shift ( lsst::geom::ExtentI const & d)
inlineinherited

Shift a Footprint by a given extent.

Parameters
dExtentI object which gives the dimensions the Footprint should be shifted

Definition at line 203 of file Footprint.h.

203{ shift(d.getX(), d.getY()); }
void shift(int dx, int dy)
Shift a Footprint by (dx, dy)
Definition Footprint.cc:64

◆ sortPeaks()

void Footprint::sortPeaks ( afw::table::Key< float > const & key = afw::table::Key<float>())
inherited

Sort Peaks from most positive value to most negative.

If the key passed is invalid (the default) PeakTable::getPeakValueKey() will be used.

Parameters
keyA key corresponding to the field in the Schema the PeakCatalog is to be sorted by.

Definition at line 57 of file Footprint.cc.

57 {
58 auto validatedKey = key.isValid() ? key : PeakTable::getPeakValueKey();
59 getPeaks().sort([&validatedKey](detection::PeakRecord const& a, detection::PeakRecord const& b) {
60 return a.get(validatedKey) > b.get(validatedKey);
61 });
62}
static afw::table::Key< float > getPeakValueKey()
Definition Peak.h:169
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
Definition Catalog.h:755

◆ split()

std::vector< std::shared_ptr< Footprint > > Footprint::split ( ) const
inherited

Split a multi-component Footprint into a vector of contiguous Footprints.

Split a multi-component Footprint such that each Footprint in the output vector is contiguous and contains only peaks that can be found within the bounds of the Footprint

Definition at line 159 of file Footprint.cc.

159 {
160 auto splitSpanSets = getSpans()->split();
162 footprintList.reserve(splitSpanSets.size());
163 for (auto& spanPtr : splitSpanSets) {
164 auto tmpFootprintPointer = std::make_shared<Footprint>(spanPtr, getPeaks().getSchema(), getRegion());
165 tmpFootprintPointer->_peaks = getPeaks();
166 // No need to remove any peaks, as there is only one Footprint, so it will
167 // simply be a copy of the original
168 if (splitSpanSets.size() > 1) {
169 tmpFootprintPointer->removeOrphanPeaks();
170 }
171 footprintList.push_back(std::move(tmpFootprintPointer));
172 }
173 return footprintList;
174}
lsst::geom::Box2I getRegion() const
Return the corners of the MaskedImage the footprints live in.
Definition Footprint.h:213
T push_back(T... args)

◆ transform() [1/4]

std::shared_ptr< Footprint > Footprint::transform ( geom::TransformPoint2ToPoint2 const & t,
lsst::geom::Box2I const & region,
bool doClip = true ) const
inherited

Return a new Footprint whose pixels are the product of applying the specified transformation.

Parameters
tA 2-D transform which will be used to map the pixels
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 98 of file Footprint.cc.

99 {
100 // Transfrom the SpanSet first
101 auto transformedSpan = getSpans()->transformedBy(t);
102 // Use this new SpanSet and the peakSchema to create a new Footprint
103 auto newFootprint = std::make_shared<Footprint>(transformedSpan, getPeaks().getSchema(), region);
104 // now populate the new Footprint with transformed Peaks
106 peakPosList.reserve(_peaks.size());
107 for (auto const& peak : getPeaks()) {
108 peakPosList.emplace_back(peak.getF());
109 }
110 auto newPeakPosList = t.applyForward(peakPosList);
111 auto newPeakPos = newPeakPosList.cbegin();
112 for (auto peak = getPeaks().cbegin(), endPeak = getPeaks().cend(); peak != endPeak;
113 ++peak, ++newPeakPos) {
114 newFootprint->addPeak(newPeakPos->getX(), newPeakPos->getY(), peak->getPeakValue());
115 }
116 if (doClip) {
117 newFootprint->clipTo(region);
118 }
119 return newFootprint;
120}

◆ transform() [2/4]

std::shared_ptr< Footprint > Footprint::transform ( lsst::geom::AffineTransform const & t,
lsst::geom::Box2I const & region,
bool doClip = true ) const
inherited

Return a new Footprint whose pixels are the product of applying the specified transformation.

Parameters
tAn affine transform object which will be used to map the pixels
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 93 of file Footprint.cc.

94 {
95 return transform(*geom::makeTransform(t), region, doClip);
96}
table::Key< int > transform

◆ transform() [3/4]

std::shared_ptr< Footprint > Footprint::transform ( lsst::geom::LinearTransform const & t,
lsst::geom::Box2I const & region,
bool doClip = true ) const
inherited

Return a new Footprint whose pixels are the product of applying the specified transformation.

Parameters
tA linear transform object which will be used to map the pixels
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 88 of file Footprint.cc.

89 {
90 return transform(lsst::geom::AffineTransform(t), region, doClip);
91}
An affine coordinate transformation consisting of a linear transformation and an offset.

◆ transform() [4/4]

std::shared_ptr< Footprint > Footprint::transform ( std::shared_ptr< geom::SkyWcs > source,
std::shared_ptr< geom::SkyWcs > target,
lsst::geom::Box2I const & region,
bool doClip = true ) const
inherited

Transform the footprint from one WCS to another.

Parameters
sourceWcs that defines the coordinate system of the input footprint.
targetWcs that defines that desired coordinate system of the returned footprint.
regionUsed to set the "region" box of the returned footprint; note that this is NOT the same as the footprint's bounding box.
doClipIf true, clip the new footprint to the region bbox before returning it.

Definition at line 81 of file Footprint.cc.

83 {
84 auto srcToTarget = geom::makeWcsPairTransform(*source, *target);
85 return transform(*srcToTarget, region, doClip);
86}
Key< Flag > const & target

◆ updatePeakSignificance() [1/2]

void Footprint::updatePeakSignificance ( double sigma)
inherited

Compute and update the significance of each peak, given a single value for sigma.

The Footprint peak schema must already have a significance field in it.

Parameters
sigmaThe standard deviation for peak detection, positive or negative as appropriate.
Exceptions
pex::exceptions::NotFoundErrorThrown if the the peaks do not have a significance field.

Definition at line 145 of file Footprint.cc.

145 {
146 auto key = _peaks.getSchema().find<double>("significance").key;
147 for (auto& peak : _peaks) {
148 peak.set(key, peak.getPeakValue() / sigma);
149 }
150}
afw::table::Key< double > sigma
Schema getSchema() const
Return the schema associated with the catalog's table.
Definition Catalog.h:117
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Definition Schema.cc:467

◆ updatePeakSignificance() [2/2]

void Footprint::updatePeakSignificance ( image::Image< float > const & variance,
int polarity )
inherited

Compute and update the significance of each peak, using the variance image.

The Footprint peak schema must already have a significance field in it.

Parameters
varianceThe variance plane of the image that this footprint is in.
polarity+1 if this is detected as a positive footprint, -1 if negative.
Exceptions
pex::exceptions::NotFoundErrorThrown if the the peaks do not have a significance field.

Definition at line 152 of file Footprint.cc.

152 {
153 auto key = _peaks.getSchema().find<double>("significance").key;
154 for (auto& peak : _peaks) {
155 peak.set(key, polarity * peak.getPeakValue() / std::sqrt(variance[peak.getI()]));
156 }
157}
afw::table::Key< afw::table::Array< VariancePixelT > > variance
T sqrt(T... args)

◆ write()

void Footprint::write ( OutputArchiveHandle & handle) const
overrideprotectedvirtualinherited

Write an instance of a Footprint to an output Archive.

Reimplemented from lsst::afw::table::io::Persistable.

Reimplemented in lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >.

Definition at line 271 of file Footprint.cc.

271 {
272 // get the span schema and key
273 auto const keys = spanSetPersistenceHelper();
274 // create the output catalog
275 afw::table::BaseCatalog spanSetCat = handle.makeCatalog(keys.first);
276 // create a record that will hold the ID of the recursively saved SpanSet
277 auto record = spanSetCat.addNew();
278 record->set(keys.second, handle.put(getSpans()));
279 handle.saveCatalog(spanSetCat);
280 // save the peaks into a catalog
281 afw::table::BaseCatalog peakCat = handle.makeCatalog(getPeaks().getSchema());
282 peakCat.insert(peakCat.end(), getPeaks().begin(), getPeaks().end(), true);
283 handle.saveCatalog(peakCat);
284}
int end
void insert(iterator pos, InputIterator first, InputIterator last, bool deep=false)
Insert an iterator range into the table.
Definition Catalog.h:517
CatalogT< BaseRecord > BaseCatalog
Definition fwd.h:72

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits & fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.

18 {
19 OutputArchive archive;
20 archive.put(this);
21 archive.writeFits(fitsfile);
22}

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager & manager,
std::string const & mode = "w" ) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 29 of file Persistable.cc.

29 {
30 fits::Fits fitsfile(manager, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
31 writeFits(fitsfile);
32}
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const & fileName,
std::string const & mode = "w" ) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 24 of file Persistable.cc.

24 {
25 fits::Fits fitsfile(fileName, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
26 writeFits(fitsfile);
27}

Member Data Documentation

◆ schema

lsst.meas.base.forcedPhotCcd.may.schema
static

Definition at line 826 of file forcedPhotCcd.py.

◆ VERSION

int const lsst::afw::table::Schema::VERSION = detail::SchemaImpl::VERSION
staticinherited

Definition at line 57 of file Schema.h.


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