|
| | __init__ (self, *args, **kwargs) |
| astropy.table.Table | runFromAstropy (self, astropy.table.Table table, afwImage.Exposure exposure, *, str id_column_name="objectId", str ra_column_name="coord_ra", str dec_column_name="coord_dec", float psf_footprint_scaling=3.0, measBase.IdGenerator|None idGenerator=None) |
| | run (self, *args, **kwargs) |
| | runFromImage (self, *args, **kwargs) |
| Public Member Functions inherited from lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask |
|
| __init__ (self, *args, **kwargs) |
|
| __init__ (self, afwTable.Schema schema=None, afwTable.Schema peakSchema=None, **dict kwargs) |
| | __setattr__ (self, name, value) |
|
| None | _ensureValidInputs (self, astropy.table.Table table, afwImage.Exposure exposure, str id_column_name, str ra_column_name, str dec_column_name) |
| | _makeMinimalSourceCatalogFromAstropy (self, astropy.table.Table table, list[str] columns=["id", "ra", "dec"], str coord_unit="degrees") |
| Protected Member Functions inherited from lsst.pipe.tasks.measurementDriver.SingleBandMeasurementDriverTask |
| afwTable.SourceCatalog | _deblendSources (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog) |
| | _initializeSchema (self, afwTable.SourceCatalog catalog=None) |
| | _addCoordErrorFieldsIfMissing (self, afwTable.Schema schema) |
| | _makeSubtasks (self) |
| afwTable.SourceCatalog|None | _prepareSchemaAndSubtasks (self, afwTable.SourceCatalog|None catalog) |
| | _scaleVariance (self, afwImage.Exposure exposure, str band="a single") |
| afwTable.SourceCatalog|dict[str, afwTable.SourceCatalog] | _toContiguous (self, afwTable.SourceCatalog|dict[str, afwTable.SourceCatalog] catalog) |
| afwTable.SourceCatalog | _updateCatalogSchema (self, afwTable.SourceCatalog catalog) |
| tuple[afwTable.SourceCatalog, afwMath.BackgroundList] | _detectSources (self, afwImage.Exposure|afwImage.MultibandExposure exposure, measBase.IdGenerator idGenerator) |
| | _measureSources (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog, measBase.IdGenerator idGenerator, afwTable.SourceCatalog|None refCat=None) |
| | _applyApCorr (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog, measBase.IdGenerator idGenerator) |
| | _runCatalogCalculation (self, afwTable.SourceCatalog catalog) |
| afwTable.SourceCatalog | _processCatalog (self, afwImage.Exposure exposure, afwTable.SourceCatalog catalog, measBase.IdGenerator idGenerator, str band="a single", afwTable.SourceCatalog|None refCat=None) |
Forced measurement driver task for single-band data.
This task is the 'forced' version of the `SingleBandMeasurementDriverTask`,
intended as a convenience function for performing forced photometry on an
input image given a set of IDs and RA/Dec coordinates. It is designed as a
public-facing interface, allowing users to measure sources without
explicitly instantiating and running pipeline tasks.
Examples
--------
Here is an example of how to use this class to run forced measurements on
an exposure using an Astropy table containing source IDs and RA/Dec
coordinates:
>>> from lsst.pipe.tasks.measurementDriver import (
... ForcedMeasurementDriverConfig,
... ForcedMeasurementDriverTask,
... )
>>> import astropy.table
>>> import lsst.afw.image as afwImage
>>> config = ForcedMeasurementDriverConfig()
>>> config.doScaleVariance = True
>>> config.scaleVariance.background.binSize = 32
>>> config.doApCorr = True
>>> config.measurement.plugins.names = [
... "base_PixelFlags",
... "base_TransformedCentroidFromCoord",
... "base_PsfFlux",
... "base_CircularApertureFlux",
... ]
>>> config.measurement.slots.psfFlux = "base_PsfFlux"
>>> config.measurement.slots.centroid = "base_TransformedCentroidFromCoord"
>>> config.measurement.slots.shape = None
>>> config.measurement.doReplaceWithNoise = False
>>> calexp = butler.get("deepCoadd_calexp", dataId=...)
>>> objtable = butler.get(
... "objectTable", dataId=..., storageClass="ArrowAstropy"
... )
>>> table = objtable[:5].copy()["objectId", "coord_ra", "coord_dec"]
>>> driver = ForcedMeasurementDriverTask(config=config)
>>> results = driver.runFromAstropy(
... table,
... calexp,
... id_column_name="objectId",
... ra_column_name="coord_ra",
... dec_column_name="coord_dec",
... psf_footprint_scaling=3.0,
... )
>>> results.writeFits("forced_meas_catalog.fits")
| lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask._makeMinimalSourceCatalogFromAstropy |
( |
| self, |
|
|
astropy.table.Table | table, |
|
|
list[str] | columns = ["id", "ra", "dec"], |
|
|
str | coord_unit = "degrees" ) |
|
protected |
Convert an Astropy Table to a minimal LSST SourceCatalog.
This is intended for use with the forced measurement subtask, which
expects a `SourceCatalog` input with a minimal schema containing `id`,
`ra`, and `dec`.
Parameters
----------
table :
Astropy Table containing source IDs and sky coordinates.
columns :
Names of the columns in the order [id, ra, dec], where `ra` and
`dec` are in degrees by default. If the coordinates are in radians,
set `coord_unit` to "radians".
coord_unit : `str`
Unit of the sky coordinates. Can be either "degrees" or "radians".
Returns
-------
outputCatalog : `lsst.afw.table.SourceCatalog`
A SourceCatalog with minimal schema populated from the input table.
Raises
------
ValueError
If `coord_unit` is not "degrees" or "radians".
If `columns` does not contain exactly 3 items.
KeyError
If any of the specified columns are missing from the input table.
| astropy.table.Table lsst.pipe.tasks.measurementDriver.ForcedMeasurementDriverTask.runFromAstropy |
( |
| self, |
|
|
astropy.table.Table | table, |
|
|
afwImage.Exposure | exposure, |
|
|
* | , |
|
|
str | id_column_name = "objectId", |
|
|
str | ra_column_name = "coord_ra", |
|
|
str | dec_column_name = "coord_dec", |
|
|
float | psf_footprint_scaling = 3.0, |
|
|
measBase.IdGenerator | None | idGenerator = None ) |
Run forced measurements on an exposure using an Astropy table.
Parameters
----------
table :
Astropy table containing source IDs and RA/Dec coordinates.
Must contain columns with names specified by `id_column_name`,
`ra_column_name`, and `dec_column_name`.
exposure :
Exposure on which to run the forced measurements.
id_column_name :
Name of the column containing source IDs in the table.
ra_column_name :
Name of the column containing RA coordinates in the table.
dec_column_name :
Name of the column containing Dec coordinates in the table.
psf_footprint_scaling :
Scaling factor to apply to the PSF second-moments ellipse in order
to determine the footprint boundary.
idGenerator :
Object that generates source IDs and provides random seeds.
If not provided, a new `IdGenerator` will be created.
Returns
-------
result :
Astropy table containing the measured sources with columns
corresponding to the source IDs, RA, Dec, from the input table, and
additional measurement columns defined in the configuration.