lsst.meas.base gb94f486bb8+07ba5338a0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | 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.meas.base.forcedPhotCcd.for lsst::afw::table::Schema 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
 

Public Member Functions

def runQuantum (self, butlerQC, inputRefs, outputRefs)
 
def df2RefCat (self, dfList, exposureBBox, exposureWcs)
 
def df2SourceCat (self, df)
 
virtual bool isHeavy () const
 
std::shared_ptr< geom::SpanSet > getSpans () const
 
void setSpans (std::shared_ptr< geom::SpanSet > otherSpanSet)
 
PeakCataloggetPeaks ()
 
const PeakCataloggetPeaks () const
 
std::shared_ptr< PeakRecord > addPeak (float fx, float fy, float value)
 
void sortPeaks (afw::table::Key< float > const &key=afw::table::Key< float >())
 
void setPeakSchema (afw::table::Schema const &peakSchema)
 
void setPeakCatalog (PeakCatalog const &otherPeaks)
 
std::size_t getArea () const
 
lsst::geom::Point2D getCentroid () const
 
geom::ellipses::Quadrupole getShape () const
 
void shift (int dx, int dy)
 
void shift (lsst::geom::ExtentI const &d)
 
lsst::geom::Box2I getBBox () const
 
lsst::geom::Box2I getRegion () const
 
void setRegion (lsst::geom::Box2I const &region)
 
void clipTo (lsst::geom::Box2I const &bbox)
 
bool contains (lsst::geom::Point2I const &pix) const
 
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
 
std::shared_ptr< Footprinttransform (lsst::geom::LinearTransform const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 
std::shared_ptr< Footprinttransform (lsst::geom::AffineTransform const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 
std::shared_ptr< Footprinttransform (geom::TransformPoint2ToPoint2 const &t, lsst::geom::Box2I const &region, bool doClip=true) const
 
bool isPersistable () const noexcept override
 
void dilate (int r, geom::Stencil s=geom::Stencil::CIRCLE)
 
void dilate (geom::SpanSet const &other)
 
void erode (int r, geom::Stencil s=geom::Stencil::CIRCLE)
 
void erode (geom::SpanSet const &other)
 
void removeOrphanPeaks ()
 
void updatePeakSignificance (double sigma)
 
void updatePeakSignificance (image::Image< float > const &variance, int polarity)
 
bool isContiguous () const
 
std::vector< std::shared_ptr< Footprint > > split () const
 
bool operator== (Footprint const &other) const
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 
void writeFits (fits::Fits &fitsfile) const
 
std::string join (std::string const &a, std::string const &b) const
 
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
 
SchemaItem< T > find (std::string const &name) const
 
SchemaItem< T > find (Key< T > const &key) const
 
void findAndApply (std::string const &name, F &&func) const
 
SubSchema operator[] (std::string const &name) const
 
std::set< std::stringgetNames (bool topOnly=false) const
 
std::size_t getRecordSize () const
 
std::size_t getFieldCount () const
 
std::size_t getFlagFieldCount () const
 
std::size_t getNonFlagFieldCount () const
 
Key< T > addField (Field< T > const &field, bool doReplace=false)
 
Key< T > addField (std::string const &name, std::string const &doc, std::string const &units="", FieldBase< T > const &base=FieldBase< T >(), bool doReplace=false)
 
Key< T > addField (std::string const &name, std::string const &doc, FieldBase< T > const &base, bool doReplace=false)
 
void replaceField (Key< T > const &key, Field< T > const &field)
 
void forEach (F &func) const
 
void forEach (F const &func) const
 
bool operator== (Schema const &other) const
 
bool operator!= (Schema const &other) const
 
std::size_t hash_value () const noexcept
 
int compare (Schema const &other, int flags=EQUAL_KEYS) const
 
int contains (Schema const &other, int flags=EQUAL_KEYS) const
 
int contains (SchemaItem< T > const &item, int flags=EQUAL_KEYS) const
 
std::shared_ptr< AliasMap > getAliasMap () const
 
void setAliasMap (std::shared_ptr< AliasMap > aliases)
 
void disconnectAliases ()
 

Static Public Member Functions

static std::shared_ptr< lsst::afw::detection::FootprintreadFits (fits::Fits &fitsfile)
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 
static std::shared_ptr< lsst::afw::detection::FootprintreadFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 
static std::shared_ptr< lsst::afw::detection::FootprintdynamicCast (std::shared_ptr< Persistable > const &ptr)
 
static Schema readFits (std::string const &filename, int hdu=fits::DEFAULT_HDU)
 
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)
 

Public Attributes

 EQUAL_KEYS
 
 EQUAL_NAMES
 
 EQUAL_DOCS
 
 EQUAL_UNITS
 
 EQUAL_FIELDS
 
 EQUAL_ALIASES
 
 IDENTICAL
 

Static Public Attributes

 schema
 
 outputSchema
 
static int const VERSION
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Protected Member Functions

std::string getPersistenceName () const override
 
std::string getPythonModule () const override
 
void write (OutputArchiveHandle &handle) const override
 
virtual void write (OutputArchiveHandle &handle) const
 

Static Protected Member Functions

static std::unique_ptr< FootprintreadSpanSet (afw::table::BaseCatalog const &, afw::table::io::InputArchive const &)
 
static void readPeaks (afw::table::BaseCatalog const &, Footprint &)
 

Detailed Description

detectorId = exposure.getInfo().getDetector().getId()

if externalPhotoCalibCatalog is not None:
    row = externalPhotoCalibCatalog.find(detectorId)
    if row is None:
        self.log.warning("Detector id %s not found in externalPhotoCalibCatalog; "
                         "Using original photoCalib.", detectorId)
    else:
        photoCalib = row.getPhotoCalib()
        if photoCalib is None:
            self.log.warning("Detector id %s has None for photoCalib in externalPhotoCalibCatalog; "
                             "Using original photoCalib.", detectorId)
        else:
            exposure.setPhotoCalib(photoCalib)

if externalSkyWcsCatalog is not None:
    row = externalSkyWcsCatalog.find(detectorId)
    if row is None:
        self.log.warning("Detector id %s not found in externalSkyWcsCatalog; "
                         "Using original skyWcs.", detectorId)
    else:
        skyWcs = row.getWcs()
        if skyWcs is None:
            self.log.warning("Detector id %s has None for skyWcs in externalSkyWcsCatalog; "
                             "Using original skyWcs.", detectorId)
        else:
            exposure.setWcs(skyWcs)

if finalizedPsfApCorrCatalog is not None:
    row = finalizedPsfApCorrCatalog.find(detectorId)
    if row is None:
        self.log.warning("Detector id %s not found in finalizedPsfApCorrCatalog; "
                         "Using original psf.", detectorId)
    else:
        psf = row.getPsf()
        apCorrMap = row.getApCorrMap()
        if psf is None or apCorrMap is None:
            self.log.warning("Detector id %s has None for psf/apCorrMap in "
                             "finalizedPsfApCorrCatalog; Using original psf.", detectorId)
        else:
            exposure.setPsf(psf)
            exposure.setApCorrMap(apCorrMap)

if skyCorr is not None:
    exposure.maskedImage -= skyCorr.getImage()

return exposure

def mergeAndFilterReferences(self, exposure, refCats, refWcs):
mergedRefCat = None

# Step 1: Determine bounds of the exposure photometry will
# be performed on.
expWcs = exposure.getWcs()
if expWcs is None:
    self.log.info("Exposure has no WCS.  Returning None for mergedRefCat.")
else:
    expRegion = exposure.getBBox(lsst.afw.image.PARENT)
    expBBox = lsst.geom.Box2D(expRegion)
    expBoxCorners = expBBox.getCorners()
    expSkyCorners = [expWcs.pixelToSky(corner).getVector() for
                     corner in expBoxCorners]
    expPolygon = lsst.sphgeom.ConvexPolygon(expSkyCorners)

    # Step 2: Filter out reference catalog sources that are
    # not contained within the exposure boundaries, or whose
    # parents are not within the exposure boundaries.  Note
    # that within a single input refCat, the parents always
    # appear before the children.
    for refCat in refCats:
        refCat = refCat.get()
        if mergedRefCat is None:
            mergedRefCat = lsst.afw.table.SourceCatalog(refCat.table)
            containedIds = {0}  # zero as a parent ID means "this is a parent"
        for record in refCat:
            if (expPolygon.contains(record.getCoord().getVector()) and record.getParent()
                    in containedIds):
                record.setFootprint(record.getFootprint())
                mergedRefCat.append(record)
                containedIds.add(record.getId())
    if mergedRefCat is None:
        raise RuntimeError("No reference objects for forced photometry.")
    mergedRefCat.sort(lsst.afw.table.SourceTable.getParentKey())
return mergedRefCat

def generateMeasCat(self, dataId, exposure, refCat, refWcs):
id_generator = self.config.idGenerator.apply(dataId)
measCat = self.measurement.generateMeasCat(exposure, refCat, refWcs,
                                           idFactory=id_generator.make_table_id_factory())
return measCat, id_generator.catalog_id

def run(self, measCat, exposure, refCat, refWcs, exposureId=None):
self.measurement.run(measCat, exposure, refCat, refWcs, exposureId=exposureId)
if self.config.doApCorr:
    self.applyApCorr.run(
        catalog=measCat,
        apCorrMap=exposure.getInfo().getApCorrMap()
    )
self.catalogCalculation.run(measCat)

return pipeBase.Struct(measCat=measCat)

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

Definition at line 562 of file forcedPhotCcd.py.

Member Function Documentation

◆ df2RefCat()

def lsst.meas.base.forcedPhotCcd.may.df2RefCat (   self,
  dfList,
  exposureBBox,
  exposureWcs 
)
Convert list of DataFrames to reference catalog

Concatenate list of DataFrames presumably from multiple patches and
downselect rows that overlap the exposureBBox using the exposureWcs.

Parameters
----------
dfList : `list` of `pandas.DataFrame`
    Each element containst diaObjects with ra/dec position in degrees
    Columns 'diaObjectId', 'ra', 'dec' are expected
exposureBBox :   `lsst.geom.Box2I`
    Bounding box on which to select rows that overlap
exposureWcs : `lsst.afw.geom.SkyWcs`
    World coordinate system to convert sky coords in ref cat to
    pixel coords with which to compare with exposureBBox

Returns
-------
refCat : `lsst.afw.table.SourceTable`
    Source Catalog with minimal schema that overlaps exposureBBox

Definition at line 774 of file forcedPhotCcd.py.

◆ df2SourceCat()

def lsst.meas.base.forcedPhotCcd.may.df2SourceCat (   self,
  df 
)
Create minimal schema SourceCatalog from a pandas DataFrame.

The forced measurement subtask expects this as input.

Parameters
----------
df : `pandas.DataFrame`
    DiaObjects with locations and ids.

Returns
-------
outputCatalog : `lsst.afw.table.SourceTable`
    Output catalog with minimal schema.

Definition at line 805 of file forcedPhotCcd.py.

◆ runQuantum()

def lsst.meas.base.forcedPhotCcd.may.runQuantum (   self,
  butlerQC,
  inputRefs,
  outputRefs 
)

Definition at line 728 of file forcedPhotCcd.py.

Member Data Documentation

◆ outputSchema

lsst.meas.base.forcedPhotCcd.may.outputSchema
static

Definition at line 726 of file forcedPhotCcd.py.

◆ schema

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

Definition at line 724 of file forcedPhotCcd.py.


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