lsst.meas.algorithms g2825c19fe3+eedc38578d
Loading...
Searching...
No Matches
lsst.meas.algorithms.brightStarStamps.BrightStarStamps Class Reference
Inheritance diagram for lsst.meas.algorithms.brightStarStamps.BrightStarStamps:
lsst.meas.algorithms.stamps.Stamps lsst.meas.algorithms.stamps.StampsBase

Public Member Functions

 __init__ (self, starStamps, innerRadius=None, outerRadius=None, nb90Rots=None, metadata=None, use_mask=True, use_variance=False, use_archive=False)
 
 initAndNormalize (cls, starStamps, innerRadius, outerRadius, nb90Rots=None, metadata=None, use_mask=True, use_variance=False, use_archive=False, imCenter=None, discardNanFluxObjects=True, forceFindFlux=False, statsControl=StatisticsControl(), statsFlag=stringToStatisticsProperty("MEAN"), badMaskPlanes=("BAD", "SAT", "NO_DATA"))
 
 readFits (cls, filename)
 
 readFitsWithOptions (cls, filename, options)
 
 append (self, item, innerRadius=None, outerRadius=None)
 
 extend (self, bss)
 
 getMagnitudes (self)
 
 getGaiaIds (self)
 
 getAnnularFluxes (self)
 
 getValidPixelsFraction (self)
 
 selectByMag (self, magMin=None, magMax=None)
 
 getPositions (self)
 
 writeFits (self, filename)
 
 __len__ (self)
 
 __getitem__ (self, index)
 
 __iter__ (self)
 
 getMaskedImages (self)
 
 getArchiveElements (self)
 
 metadata (self)
 

Public Attributes

bool normalized = True
 
 nb90Rots = nb90Rots
 
 use_mask = use_mask
 
 use_variance = use_variance
 
 use_archive = use_archive
 

Protected Member Functions

 _refresh_metadata (self)
 
 _checkRadius (self, innerRadius, outerRadius)
 
 _checkNormalization (self, normalize, innerRadius, outerRadius)
 

Protected Attributes

 _innerRadius
 
 _outerRadius = innerRadius, outerRadius
 
 _stamps = stamps
 
 _metadata = PropertyList() if metadata is None else metadata.deepCopy()
 

Detailed Description

Collection of bright star stamps and associated metadata.

Parameters
----------
starStamps : `collections.abc.Sequence` [`BrightStarStamp`]
    Sequence of star stamps. Cannot contain both normalized and
    unnormalized stamps.
innerRadius : `int`, optional
    Inner radius value, in pixels. This and ``outerRadius`` define the
    annulus used to compute the ``"annularFlux"`` values within each
    ``starStamp``. Must be provided if ``normalize`` is True.
outerRadius : `int`, optional
    Outer radius value, in pixels. This and ``innerRadius`` define the
    annulus used to compute the ``"annularFlux"`` values within each
    ``starStamp``. Must be provided if ``normalize`` is True.
nb90Rots : `int`, optional
    Number of 90 degree rotations required to compensate for detector
    orientation.
metadata : `~lsst.daf.base.PropertyList`, optional
    Metadata associated with the bright stars.
use_mask : `bool`
    If `True` read and write mask data. Default `True`.
use_variance : `bool`
    If ``True`` read and write variance data. Default ``False``.
use_archive : `bool`
    If ``True`` read and write an Archive that contains a Persistable
    associated with each stamp. In the case of bright stars, this is
    usually a ``TransformPoint2ToPoint2``, used to warp each stamp
    to the same pixel grid before stacking.

Raises
------
ValueError
    Raised if one of the star stamps provided does not contain the
    required keys.
AttributeError
    Raised if there is a mix-and-match of normalized and unnormalized
    stamps, stamps normalized with different annulus definitions, or if
    stamps are to be normalized but annular radii were not provided.

Notes
-----
A butler can be used to read only a part of the stamps, specified by a
bbox:

>>> starSubregions = butler.get(
        "brightStarStamps",
        dataId,
        parameters={"bbox": bbox}
    )

Definition at line 186 of file brightStarStamps.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.__init__ ( self,
starStamps,
innerRadius = None,
outerRadius = None,
nb90Rots = None,
metadata = None,
use_mask = True,
use_variance = False,
use_archive = False )

Definition at line 239 of file brightStarStamps.py.

Member Function Documentation

◆ __getitem__()

lsst.meas.algorithms.stamps.StampsBase.__getitem__ ( self,
index )
inherited

Definition at line 438 of file stamps.py.

◆ __iter__()

lsst.meas.algorithms.stamps.StampsBase.__iter__ ( self)
inherited

Definition at line 441 of file stamps.py.

◆ __len__()

lsst.meas.algorithms.stamps.StampsBase.__len__ ( self)
inherited

Definition at line 435 of file stamps.py.

◆ _checkNormalization()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps._checkNormalization ( self,
normalize,
innerRadius,
outerRadius )
protected
Ensure there is no mixing of normalized and unnormalized stars, and
that, if requested, normalization can be performed.

Definition at line 641 of file brightStarStamps.py.

◆ _checkRadius()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps._checkRadius ( self,
innerRadius,
outerRadius )
protected
Ensure provided annulus radius is consistent with that already
present in the instance, or with arguments passed on at initialization.

Definition at line 630 of file brightStarStamps.py.

◆ _refresh_metadata()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps._refresh_metadata ( self)
protected
Refresh metadata. Should be called before writing the object out.

This method adds full lists of positions, Gaia magnitudes, IDs and
annular fluxes to the shared metadata.

Reimplemented from lsst.meas.algorithms.stamps.Stamps.

Definition at line 452 of file brightStarStamps.py.

◆ append()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.append ( self,
item,
innerRadius = None,
outerRadius = None )
Add an additional bright star stamp.

Parameters
----------
item : `BrightStarStamp`
    Bright star stamp to append.
innerRadius : `int`, optional
    Inner radius value, in pixels. This and ``outerRadius`` define the
    annulus used to compute the ``"annularFlux"`` values within each
    ``BrightStarStamp``.
outerRadius : `int`, optional
    Outer radius value, in pixels. This and ``innerRadius`` define the
    annulus used to compute the ``"annularFlux"`` values within each
    ``BrightStarStamp``.

Reimplemented from lsst.meas.algorithms.stamps.Stamps.

Definition at line 517 of file brightStarStamps.py.

◆ extend()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.extend ( self,
bss )
Extend BrightStarStamps instance by appending elements from another
instance.

Parameters
----------
bss : `BrightStarStamps`
    Other instance to concatenate.

Reimplemented from lsst.meas.algorithms.stamps.Stamps.

Definition at line 545 of file brightStarStamps.py.

◆ getAnnularFluxes()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.getAnnularFluxes ( self)
Retrieve normalization factor for each star.

These are computed by integrating the flux in annulus centered on the
bright star, far enough from center to be beyond most severe ghosts and
saturation.
The inner and outer radii that define the annulus can be recovered from
the metadata.

Returns
-------
annularFluxes : `list` [`float`]
    Annular fluxes which give the normalization factor for each star.

Definition at line 579 of file brightStarStamps.py.

◆ getArchiveElements()

lsst.meas.algorithms.stamps.StampsBase.getArchiveElements ( self)
inherited
Retrieve archive elements associated with each stamp.

Returns
-------
archiveElements :
    `list` [`~lsst.afw.table.io.Persistable`]

Definition at line 454 of file stamps.py.

◆ getGaiaIds()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.getGaiaIds ( self)
Retrieve Gaia IDs for each star.

Returns
-------
gaiaIds : `list` [`int`]
    Gaia IDs for each star.

Definition at line 569 of file brightStarStamps.py.

◆ getMagnitudes()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.getMagnitudes ( self)
Retrieve Gaia G-band magnitudes for each star.

Returns
-------
gaiaGMags : `list` [`float`]
    Gaia G-band magnitudes for each star.

Definition at line 559 of file brightStarStamps.py.

◆ getMaskedImages()

lsst.meas.algorithms.stamps.StampsBase.getMaskedImages ( self)
inherited
Retrieve star images.

Returns
-------
maskedImages :
    `list` [`~lsst.afw.image.MaskedImageF`]

Definition at line 444 of file stamps.py.

◆ getPositions()

lsst.meas.algorithms.stamps.Stamps.getPositions ( self)
inherited

Definition at line 475 of file stamps.py.

◆ getValidPixelsFraction()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.getValidPixelsFraction ( self)
Retrieve the fraction of valid pixels within the normalization
annulus for each star.

Returns
-------
validPixelsFractions : `list` [`float`]
    Fractions of valid pixels within the normalization annulus for each
    star.

Definition at line 595 of file brightStarStamps.py.

◆ initAndNormalize()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.initAndNormalize ( cls,
starStamps,
innerRadius,
outerRadius,
nb90Rots = None,
metadata = None,
use_mask = True,
use_variance = False,
use_archive = False,
imCenter = None,
discardNanFluxObjects = True,
forceFindFlux = False,
statsControl = StatisticsControl(),
statsFlag = stringToStatisticsProperty("MEAN"),
badMaskPlanes = ("BAD", "SAT", "NO_DATA") )
Normalize a set of bright star stamps and initialize a
BrightStarStamps instance.

Since the center of bright stars are saturated and/or heavily affected
by ghosts, we measure their flux in an annulus with a large enough
inner radius to avoid the most severe ghosts and contain enough
non-saturated pixels.

Parameters
----------
starStamps : `collections.abc.Sequence` [`BrightStarStamp`]
    Sequence of star stamps. Cannot contain both normalized and
    unnormalized stamps.
innerRadius : `int`
    Inner radius value, in pixels. This and ``outerRadius`` define the
    annulus used to compute the ``"annularFlux"`` values within each
    ``starStamp``.
outerRadius : `int`
    Outer radius value, in pixels. This and ``innerRadius`` define the
    annulus used to compute the ``"annularFlux"`` values within each
    ``starStamp``.
nb90Rots : `int`, optional
    Number of 90 degree rotations required to compensate for detector
    orientation.
metadata : `~lsst.daf.base.PropertyList`, optional
    Metadata associated with the bright stars.
use_mask : `bool`
    If `True` read and write mask data. Default `True`.
use_variance : `bool`
    If ``True`` read and write variance data. Default ``False``.
use_archive : `bool`
    If ``True`` read and write an Archive that contains a Persistable
    associated with each stamp. In the case of bright stars, this is
    usually a ``TransformPoint2ToPoint2``, used to warp each stamp
    to the same pixel grid before stacking.
imCenter : `collections.abc.Sequence`, optional
    Center of the object, in pixels. If not provided, the center of the
    first stamp's pixel grid will be used.
discardNanFluxObjects : `bool`
    Whether objects with NaN annular flux should be discarded.
    If False, these objects will not be normalized.
forceFindFlux : `bool`
    Whether to try to find the flux of objects with NaN annular flux
    at a different annulus.
statsControl : `~lsst.afw.math.statistics.StatisticsControl`, optional
    StatisticsControl to be used when computing flux over all pixels
    within the annulus.
statsFlag : `~lsst.afw.math.statistics.Property`, optional
    statsFlag to be passed on to ``~lsst.afw.math.makeStatistics`` to
    compute annularFlux. Defaults to a simple MEAN.
badMaskPlanes : `collections.abc.Collection` [`str`]
    Collection of mask planes to ignore when computing annularFlux.

Raises
------
ValueError
    Raised if one of the star stamps provided does not contain the
    required keys.
AttributeError
    Raised if there is a mix-and-match of normalized and unnormalized
    stamps, stamps normalized with different annulus definitions, or if
    stamps are to be normalized but annular radii were not provided.

Definition at line 261 of file brightStarStamps.py.

◆ metadata()

lsst.meas.algorithms.stamps.StampsBase.metadata ( self)
inherited

Definition at line 465 of file stamps.py.

◆ readFits()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.readFits ( cls,
filename )
Build an instance of this class from a file.

Parameters
----------
filename : `str`
    Name of the file to read.

Reimplemented from lsst.meas.algorithms.stamps.Stamps.

Definition at line 473 of file brightStarStamps.py.

◆ readFitsWithOptions()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.readFitsWithOptions ( cls,
filename,
options )
Build an instance of this class with options.

Parameters
----------
filename : `str`
    Name of the file to read.
options : `PropertyList`
    Collection of metadata parameters.

Reimplemented from lsst.meas.algorithms.stamps.Stamps.

Definition at line 484 of file brightStarStamps.py.

◆ selectByMag()

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.selectByMag ( self,
magMin = None,
magMax = None )
Return the subset of bright star stamps for objects with specified
magnitude cuts (in Gaia G).

Parameters
----------
magMin : `float`, optional
    Keep only stars fainter than this value.
magMax : `float`, optional
    Keep only stars brighter than this value.

Definition at line 607 of file brightStarStamps.py.

◆ writeFits()

lsst.meas.algorithms.stamps.StampsBase.writeFits ( self,
filename )
inherited
Write this object to a file.

Parameters
----------
filename : `str`
    Name of file to write.

Definition at line 415 of file stamps.py.

Member Data Documentation

◆ _innerRadius

lsst.meas.algorithms.brightStarStamps.BrightStarStamps._innerRadius
protected

Definition at line 253 of file brightStarStamps.py.

◆ _metadata

lsst.meas.algorithms.stamps.StampsBase._metadata = PropertyList() if metadata is None else metadata.deepCopy()
protectedinherited

Definition at line 359 of file stamps.py.

◆ _outerRadius

lsst.meas.algorithms.brightStarStamps.BrightStarStamps._outerRadius = innerRadius, outerRadius
protected

Definition at line 253 of file brightStarStamps.py.

◆ _stamps

lsst.meas.algorithms.stamps.StampsBase._stamps = stamps
protectedinherited

Definition at line 358 of file stamps.py.

◆ nb90Rots

lsst.meas.algorithms.brightStarStamps.BrightStarStamps.nb90Rots = nb90Rots

Definition at line 258 of file brightStarStamps.py.

◆ normalized

bool lsst.meas.algorithms.brightStarStamps.BrightStarStamps.normalized = True

Definition at line 255 of file brightStarStamps.py.

◆ use_archive

lsst.meas.algorithms.stamps.StampsBase.use_archive = use_archive
inherited

Definition at line 362 of file stamps.py.

◆ use_mask

lsst.meas.algorithms.stamps.StampsBase.use_mask = use_mask
inherited

Definition at line 360 of file stamps.py.

◆ use_variance

lsst.meas.algorithms.stamps.StampsBase.use_variance = use_variance
inherited

Definition at line 361 of file stamps.py.


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