BrightStarStamps

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

Bases: Stamps

Collection of bright star stamps and associated metadata.

Parameters:
starStampscollections.abc.Sequence [BrightStarStamp]

Sequence of star stamps. Cannot contain both normalized and unnormalized stamps.

innerRadiusint, 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.

outerRadiusint, 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.

nb90Rotsint, optional

Number of 90 degree rotations required to compensate for detector orientation.

metadataPropertyList, optional

Metadata associated with the bright stars.

use_maskbool

If True read and write mask data. Default True.

use_variancebool

If True read and write variance data. Default False.

use_archivebool

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}
    )

Attributes Summary

metadata

Methods Summary

append(item[, innerRadius, outerRadius])

Add an additional bright star stamp.

count(value)

extend(bss)

Extend BrightStarStamps instance by appending elements from another instance.

getAnnularFluxes()

Retrieve normalization factor for each star.

getArchiveElements()

Retrieve archive elements associated with each stamp.

getGaiaIds()

Retrieve Gaia IDs for each star.

getMagnitudes()

Retrieve Gaia G-band magnitudes for each star.

getMaskedImages()

Retrieve star images.

getPositions()

getValidPixelsFraction()

Retrieve the fraction of valid pixels within the normalization annulus for each star.

index(value, [start, [stop]])

Raises ValueError if the value is not present.

initAndNormalize(starStamps, innerRadius, ...)

Normalize a set of bright star stamps and initialize a BrightStarStamps instance.

readFits(filename)

Build an instance of this class from a file.

readFitsWithOptions(filename, options)

Build an instance of this class with options.

selectByMag([magMin, magMax])

Return the subset of bright star stamps for objects with specified magnitude cuts (in Gaia G).

writeFits(filename)

Write this object to a file.

Attributes Documentation

metadata

Methods Documentation

append(item, innerRadius=None, outerRadius=None)

Add an additional bright star stamp.

Parameters:
itemBrightStarStamp

Bright star stamp to append.

innerRadiusint, optional

Inner radius value, in pixels. This and outerRadius define the annulus used to compute the "annularFlux" values within each BrightStarStamp.

outerRadiusint, optional

Outer radius value, in pixels. This and innerRadius define the annulus used to compute the "annularFlux" values within each BrightStarStamp.

count(value) integer -- return number of occurrences of value
extend(bss)

Extend BrightStarStamps instance by appending elements from another instance.

Parameters:
bssBrightStarStamps

Other instance to concatenate.

getAnnularFluxes()

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:
annularFluxeslist [float]

Annular fluxes which give the normalization factor for each star.

getArchiveElements()

Retrieve archive elements associated with each stamp.

Returns:
archiveElements

list [Persistable]

getGaiaIds()

Retrieve Gaia IDs for each star.

Returns:
gaiaIdslist [int]

Gaia IDs for each star.

getMagnitudes()

Retrieve Gaia G-band magnitudes for each star.

Returns:
gaiaGMagslist [float]

Gaia G-band magnitudes for each star.

getMaskedImages()

Retrieve star images.

Returns:
maskedImages

list [MaskedImageF]

getPositions()
getValidPixelsFraction()

Retrieve the fraction of valid pixels within the normalization annulus for each star.

Returns:
validPixelsFractionslist [float]

Fractions of valid pixels within the normalization annulus for each star.

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

classmethod initAndNormalize(starStamps, innerRadius, outerRadius, nb90Rots=None, metadata=None, use_mask=True, use_variance=False, use_archive=False, imCenter=None, discardNanFluxObjects=True, forceFindFlux=False, statsControl=<lsst.afw.math.StatisticsControl object>, statsFlag=<Property.MEAN: 4>, 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:
starStampscollections.abc.Sequence [BrightStarStamp]

Sequence of star stamps. Cannot contain both normalized and unnormalized stamps.

innerRadiusint

Inner radius value, in pixels. This and outerRadius define the annulus used to compute the "annularFlux" values within each starStamp.

outerRadiusint

Outer radius value, in pixels. This and innerRadius define the annulus used to compute the "annularFlux" values within each starStamp.

nb90Rotsint, optional

Number of 90 degree rotations required to compensate for detector orientation.

metadataPropertyList, optional

Metadata associated with the bright stars.

use_maskbool

If True read and write mask data. Default True.

use_variancebool

If True read and write variance data. Default False.

use_archivebool

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.

imCentercollections.abc.Sequence, optional

Center of the object, in pixels. If not provided, the center of the first stamp’s pixel grid will be used.

discardNanFluxObjectsbool

Whether objects with NaN annular flux should be discarded. If False, these objects will not be normalized.

forceFindFluxbool

Whether to try to find the flux of objects with NaN annular flux at a different annulus.

statsControlStatisticsControl, optional

StatisticsControl to be used when computing flux over all pixels within the annulus.

statsFlagProperty, optional

statsFlag to be passed on to ~lsst.afw.math.makeStatistics to compute annularFlux. Defaults to a simple MEAN.

badMaskPlanescollections.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.

classmethod readFits(filename)

Build an instance of this class from a file.

Parameters:
filenamestr

Name of the file to read.

classmethod readFitsWithOptions(filename, options)

Build an instance of this class with options.

Parameters:
filenamestr

Name of the file to read.

optionsPropertyList

Collection of metadata parameters.

selectByMag(magMin=None, magMax=None)

Return the subset of bright star stamps for objects with specified magnitude cuts (in Gaia G).

Parameters:
magMinfloat, optional

Keep only stars fainter than this value.

magMaxfloat, optional

Keep only stars brighter than this value.

writeFits(filename)

Write this object to a file.

Parameters:
filenamestr

Name of file to write.