File SpatialCell.h¶
-
namespace
lsst
Class for a simple mapping implementing a generic AstrometryTransform.
Remove all non-astronomical counts from the Chunk Exposure’s pixels.
Forward declarations for lsst::utils::Cache
For details on the Cache class, see the Cache.h file.
It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.
A base class for image defects
Numeric constants used by the Integrate.h integrator routines.
Compute Image Statistics
- Note
Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.
- Note
The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.
-
namespace
afw
-
namespace
math
-
class
CandidateVisitor
Subclassed by lsst::ip::diffim::detail::AssessSpatialKernelVisitor< PixelT >, lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >, lsst::ip::diffim::detail::BuildSpatialKernelVisitor< PixelT >, lsst::ip::diffim::detail::KernelPcaVisitor< PixelT >, lsst::ip::diffim::detail::KernelSumVisitor< PixelT >
Public Functions
-
CandidateVisitor
()
-
virtual
~CandidateVisitor
()
-
virtual void
reset
()
-
virtual void
processCandidate
(SpatialCellCandidate *)
-
-
class
SpatialCell
- #include <SpatialCell.h>
Class to ensure constraints for spatial modeling
A given image is divided up into cells, with each cell represented by an instance of this class. Each cell itself contains a list of instances of classes derived from SpatialCellCandidate. One class member from each cell will be chosen to fit to a spatial model. In case of a poor fit, the next class instance in the list will be fit for. If all instances in a list are rejected from the spatial model, the best one will be used.
- See
The SpatialCellSet example in the module documentation.
Public Types
-
typedef std::vector<std::shared_ptr<SpatialCellCandidate>>
CandidateList
-
typedef SpatialCellCandidateIterator
iterator
Public Functions
-
SpatialCell
(std::string const &label, lsst::geom::Box2I const &bbox = lsst::geom::Box2I(), CandidateList const &candidateList = CandidateList()) Constructor
- Parameters
label
: string representing “name” of cellbbox
: Bounding box of cell in overall imagecandidateList
: list of candidates to represent this cell
-
SpatialCell
(SpatialCell const&)
-
SpatialCell
(SpatialCell&&)
-
SpatialCell &
operator=
(SpatialCell const&)
-
SpatialCell &
operator=
(SpatialCell&&)
-
virtual
~SpatialCell
() Destructor
-
bool
empty
() const Determine if cell has no usable candidates
-
size_t
size
() const Return number of usable candidates in Cell
-
void
sortCandidates
() Rearrange the candidates to reflect their current ratings
-
SpatialCellCandidateIterator
begin
() Return an iterator to the beginning of the Candidates
-
SpatialCellCandidateIterator
begin
(bool ignoreBad) - Parameters
ignoreBad
: If true, ignore BAD candidates
-
SpatialCellCandidateIterator
end
() Return an iterator to (one after) the end of the Candidates
-
SpatialCellCandidateIterator
end
(bool ignoreBad) - Parameters
ignoreBad
: If true, ignore BAD candidates
Add a candidate to the list, preserving ranking
Remove a candidate from the list
This is not a particularly efficient operation, since we’re using a std::vector, but should not hurt too much if the number of candidates in a cell is small.
-
void
setIgnoreBad
(bool ignoreBad) Set whether we should omit BAD candidates from candidate list when traversing.
-
bool
getIgnoreBad
() const Get whether we are omitting BAD candidates from candidate list when traversing.
-
std::shared_ptr<SpatialCellCandidate>
getCandidateById
(int id, bool noThrow = false) Return the SpatialCellCandidate with the specified id
- Parameters
id
: The desired IDnoThrow
: Return NULL in case of error
- Exceptions
lsst::pex::exceptions::NotFoundError
: if no candidate matches the id
-
std::string const &
getLabel
() const Get SpatialCell’s label
-
lsst::geom::Box2I const &
getBBox
() const Get SpatialCell’s BBox
-
void
visitCandidates
(CandidateVisitor *visitor, int const nMaxPerCell = -1, bool const ignoreExceptions = false, bool const reset = true) Call the visitor’s processCandidate method for each Candidate in the SpatialCell
- Note
This is obviously similar to the Design Patterns (Go4) Visitor pattern, but we’ve simplified the double dispatch (i.e. we don’t call a virtual method on SpatialCellCandidate that in turn calls processCandidate(*this), but can be re-defined)
- Parameters
visitor
: Pass this object to every CandidatenMaxPerCell
: Visit no more than this many Candidates (<= 0: all)ignoreExceptions
: Ignore any exceptions thrown by the processingreset
: Reset visitor before passing it around
-
void
visitCandidates
(CandidateVisitor *visitor, int const nMaxPerCell = -1, bool const ignoreExceptions = false, bool const reset = true) const Call the visitor’s processCandidate method for each Candidate in the SpatialCell (const version)
This is the const version of SpatialCellSet::visitCandidates
- Parameters
visitor
: Pass this object to every CandidatenMaxPerCell
: Visit no more than this many Candidates (-ve: all)ignoreExceptions
: Ignore any exceptions thrown by the processingreset
: Reset visitor before passing it around
-
void
visitAllCandidates
(CandidateVisitor *visitor, bool const ignoreExceptions = false, bool const reset = true) Call the visitor’s processCandidate method for every Candidate in the SpatialCell
- See
- Parameters
visitor
: Pass this object to every CandidateignoreExceptions
: Ignore any exceptions thrown byreset
: Reset visitor before passing it around
-
void
visitAllCandidates
(CandidateVisitor *visitor, bool const ignoreExceptions = false, bool const reset = true) const Call the visitor’s processCandidate method for each Candidate in the SpatialCell (const version)
This is the const version of SpatialCellSet::visitAllCandidates
- Parameters
visitor
: Pass this object to every CandidateignoreExceptions
: Ignore any exceptions thrown by the processingreset
: Reset visitor before passing it around
-
class
SpatialCellCandidate
- #include <SpatialCell.h>
Base class for candidate objects in a SpatialCell
Subclassed by lsst::afw::math::SpatialCellImageCandidate
Public Functions
-
SpatialCellCandidate
(float const xCenter, float const yCenter) - Parameters
xCenter
: The object’s column-centreyCenter
: The object’s row-centre
-
SpatialCellCandidate
(SpatialCellCandidate const&)
-
SpatialCellCandidate
(SpatialCellCandidate&&)
-
SpatialCellCandidate &
operator=
(SpatialCellCandidate const&)
-
SpatialCellCandidate &
operator=
(SpatialCellCandidate&&)
-
virtual
~SpatialCellCandidate
() (virtual) destructor this is a base class you know
-
float
getXCenter
() const Return the object’s column-centre.
-
float
getYCenter
() const Return the object’s row-centre.
-
virtual bool
instantiate
() Do anything needed to make this candidate usable.
-
virtual double
getCandidateRating
() const = 0 Return candidate’s rating.
-
virtual void
setCandidateRating
(double) Set the candidate’s rating.
-
int
getId
() const Return the candidate’s unique ID.
-
Status
getStatus
() const Return the candidate’s status.
-
void
setStatus
(Status status) Set the candidate’s status.
-
virtual bool
isBad
() const Is this candidate unacceptable?
Private Static Attributes
-
int
_CandidateId
¶ Unique identifier for candidates; useful for preserving current candidate following insertion.
-
-
class
SpatialCellCandidateIterator
- #include <SpatialCell.h>
An iterator that only returns usable members of the SpatialCell
Public Functions
-
void
operator++
() Advance the iterator, maybe skipping over candidates labelled BAD
-
size_t
operator-
(SpatialCellCandidateIterator const &rhs) const Return the number of candidate between this and rhs
-
std::shared_ptr<SpatialCellCandidate const>
operator*
() const Dereference the iterator to return the Candidate (if there is one)
- Exceptions
lsst::pex::exceptions::NotFoundError
: if no candidate is available
-
std::shared_ptr<SpatialCellCandidate>
operator*
() Return the std::shared_ptr<CellCandidate>
-
bool
operator==
(SpatialCellCandidateIterator const &rhs) const Are two SpatialCellCandidateIterators equal?
-
bool
operator!=
(SpatialCellCandidateIterator const &rhs) const Are two SpatialCellCandidateIterators unequal?
Protected Functions
-
SpatialCellCandidateIterator
(CandidateList::iterator iterator, CandidateList::iterator end, bool ignoreBad) ctor; designed to be used to pass begin to SpatialCellCandidateIterator
- Parameters
iterator
: Where this iterator should startend
: One-past-the-end of iterator’s rangeignoreBad
: Should we pass over bad Candidates?
-
SpatialCellCandidateIterator
(CandidateList::iterator iterator, CandidateList::iterator end, bool ignoreBad, bool) ctor; designed to be used to pass end to SpatialCellCandidateIterator
- Parameters
iterator
: start of of iterator’s range; not usedend
: Where this iterator should startignoreBad
: Should we pass over bad Candidates?
Private Types
-
typedef std::vector<std::shared_ptr<SpatialCellCandidate>>
CandidateList
¶
Friends
-
friend
lsst::afw::math::SpatialCell
-
void
-
class
SpatialCellImageCandidate
: public lsst::afw::math::SpatialCellCandidate - #include <SpatialCell.h>
Base class for candidate objects in a SpatialCell that are able to return an Image of some sort (e.g. a PSF or a DIA kernel)
Subclassed by lsst::ip::diffim::KernelCandidate< _PixelT >, lsst::meas::algorithms::PsfCandidate< PixelT >
Public Functions
-
SpatialCellImageCandidate
(float const xCenter, float const yCenter) ctor
- Parameters
xCenter
: The object’s column-centreyCenter
: The object’s row-centre
-
SpatialCellImageCandidate
(SpatialCellImageCandidate const&)
-
SpatialCellImageCandidate
(SpatialCellImageCandidate&&)
-
SpatialCellImageCandidate &
operator=
(SpatialCellImageCandidate const&)
-
SpatialCellImageCandidate &
operator=
(SpatialCellImageCandidate&&)
-
~SpatialCellImageCandidate
()
-
double
getChi2
() const Return the candidate’s chi^2.
-
void
setChi2
(double chi2) Set the candidate’s chi^2.
Public Static Functions
-
static void
setWidth
(int width) Set the width of the image that getImage should return.
-
static int
getWidth
() Return the width of the image that getImage should return.
-
static void
setHeight
(int height) Set the height of the image that getImage should return.
-
static int
getHeight
() Return the height of the image that getImage should return.
Private Members
-
double
_chi2
¶
-
-
class
SpatialCellSet
- #include <SpatialCell.h>
A collection of SpatialCells covering an entire image
Public Types
-
typedef std::vector<std::shared_ptr<SpatialCell>>
CellList
Public Functions
-
SpatialCellSet
(lsst::geom::Box2I const ®ion, int xSize, int ySize = 0) Constructor
- Parameters
region
: Bounding box for imagexSize
: size of cells in the column directionySize
: size of cells in the row direction (0: == xSize)
- Exceptions
lsst::pex::exceptions::LengthError
: if nx or ny is non-positive
-
SpatialCellSet
(SpatialCellSet const&)
-
SpatialCellSet
(SpatialCellSet&&)
-
SpatialCellSet &
operator=
(SpatialCellSet const&)
-
SpatialCellSet &
operator=
(SpatialCellSet&&)
-
virtual
~SpatialCellSet
() Destructor
-
CellList &
getCellList
() Return our SpatialCells
-
lsst::geom::Box2I
getBBox
() const Return the bounding box of the image
Insert a candidate into the correct cell
-
void
sortCandidates
() Rearrange the Candidates in all SpatialCells to reflect their current ratings.
-
void
visitCandidates
(CandidateVisitor *visitor, int const nMaxPerCell = -1, bool const ignoreExceptions = false) Call the visitor’s processCandidate method for each Candidate in the SpatialCellSet
- Note
This is obviously similar to the Design Patterns (Go4) Visitor pattern, but we’ve simplified the double dispatch (i.e. we don’t call a virtual method on SpatialCellCandidate that in turn calls processCandidate(*this), but can be re-defined)
- Parameters
visitor
: Pass this object to every CandidatenMaxPerCell
: Visit no more than this many Candidates (<= 0: all)ignoreExceptions
: Ignore any exceptions thrown by the processing
-
void
visitCandidates
(CandidateVisitor *visitor, int const nMaxPerCell = -1, bool const ignoreExceptions = false) const Call the visitor’s processCandidate method for each Candidate in the SpatialCellSet (const version)
This is the const version of SpatialCellSet::visitCandidates
- Parameters
visitor
: Pass this object to every CandidatenMaxPerCell
: Visit no more than this many Candidates (-ve: all)ignoreExceptions
: Ignore any exceptions thrown by the processing
-
void
visitAllCandidates
(CandidateVisitor *visitor, bool const ignoreExceptions = false) Call the visitor’s processCandidate method for every Candidate in the SpatialCellSet
- See
- Parameters
visitor
: Pass this object to every CandidateignoreExceptions
: Ignore any exceptions thrown by the processing
-
void
visitAllCandidates
(CandidateVisitor *visitor, bool const ignoreExceptions = false) const Call the visitor’s processCandidate method for every Candidate in the SpatialCellSet (const version)
This is the const version of SpatialCellSet::visitAllCandidates
- Parameters
visitor
: Pass this object to every CandidateignoreExceptions
: Ignore any exceptions thrown by the processing
-
std::shared_ptr<SpatialCellCandidate>
getCandidateById
(int id, bool noThrow = false) Return the SpatialCellCandidate with the specified id
- Parameters
id
: The desired IDnoThrow
: Return NULL in case of error
- Exceptions
lsst::pex::exceptions::NotFoundError
: if no candidate matches the id (unless noThrow is true, in which case a null pointer is returned
-
void
setIgnoreBad
(bool ignoreBad) Set whether we should omit BAD candidates from candidate list when traversing.
-
typedef std::vector<std::shared_ptr<SpatialCell>>
-
class
-
namespace