A simulated dataset consisting of a test image and an associated truth catalog.
More...
|
def | makeMinimalSchema (cls) |
|
def | __init__ (self, bbox, threshold=10.0, exposure=None, kwds) |
| Initialize the dataset. More...
|
|
def | addSource (self, flux, centroid, shape=None) |
| Add a source to the simulation. More...
|
|
def | addBlend (self) |
| Return a context manager that allows a blend of multiple sources to be added. More...
|
|
def | transform (self, wcs, kwds) |
| Create a copy of the dataset transformed to a new WCS, with new Psf and Calib. More...
|
|
def | realize (self, noise, schema, randomSeed=None) |
| Create a simulated with noise and a simulated post-detection catalog with (Heavy)Footprints. More...
|
|
|
def | makePerturbedWcs (oldWcs, minScaleFactor=1.2, maxScaleFactor=1.5, minRotation=None, maxRotation=None, minRefShift=None, maxRefShift=None, minPixShift=2.0, maxPixShift=4.0, randomSeed=None) |
| Create a new undistorted TanWcs that is similar but not identical to another, with random scaling, rotation, and offset (in both pixel position and reference position). More...
|
|
def | makeEmptyExposure (bbox, wcs=None, crval=None, cdelt=None, psfSigma=2.0, psfDim=17, fluxMag0=1E12) |
| Create an Exposure, with a Calib, Wcs, and Psf, but no pixel values set. More...
|
|
def | drawGaussian (bbox, flux, ellipse) |
| Create an image of an elliptical Gaussian. More...
|
|
A simulated dataset consisting of a test image and an associated truth catalog.
TestDataset creates an idealized image made of pure Gaussians (including a Gaussian PSF), with simple noise and idealized Footprints/HeavyFootprints that simulated the outputs of detection and deblending. Multiple noise realizations can be created from the same underlying sources, allowing uncertainty estimates to be verified via Monte Carlo.
Typical usage:
dataset = TestDataset(bbox)
with dataset.addBlend() as family:
exposure, catalog = dataset.realize(noise=100.0, schema=TestDataset.makeMinimalSchema())
Definition at line 123 of file tests.py.
◆ __init__()
def lsst.meas.base.tests.TestDataset.__init__ |
( |
|
self, |
|
|
|
bbox, |
|
|
|
threshold = 10.0 , |
|
|
|
exposure = None , |
|
|
|
kwds |
|
) |
| |
Initialize the dataset.
- Parameters
-
[in] | bbox | Bounding box of the test image. |
[in] | threshold | Threshold absolute value used to determine footprints for simulated sources. This thresholding will be applied before noise is actually added to images (or before the noise level is even known), so this will necessarily produce somewhat artificial footprints. |
[in] | exposure | lsst.afw.image.ExposureF test sources should be added to. Ownership should be considered transferred from the caller to the TestDataset. Must have a Gaussian Psf for truth catalog shapes to be exact. |
[in] | **kwds | Keyword arguments forwarded to makeEmptyExposure if exposure is None. |
Definition at line 296 of file tests.py.
◆ addBlend()
def lsst.meas.base.tests.TestDataset.addBlend |
( |
|
self | ) |
|
Return a context manager that allows a blend of multiple sources to be added.
Example:
d = TestDataset(...)
with d.addBlend() as b:
b.addChild(flux1, centroid1)
b.addChild(flux2, centroid2, shape2)
Note that nothing stops you from creating overlapping sources just using the addSource() method, but addBlend() is necesssary to create a parent object and deblended HeavyFootprints of the type produced by the detection and deblending pipelines.
Definition at line 370 of file tests.py.
◆ addSource()
def lsst.meas.base.tests.TestDataset.addSource |
( |
|
self, |
|
|
|
flux, |
|
|
|
centroid, |
|
|
|
shape = None |
|
) |
| |
Add a source to the simulation.
- Parameters
-
[in] | flux | Total flux of the source to be added. |
[in] | centroid | Position of the source to be added (lsst.afw.geom.Point2D). |
[in] | shape | 2nd moments of the source before PSF convolution (lsst.afw.geom.ellipses.Quadrupole). Note that the truth catalog records post-convolution moments). If None, a point source will be added. |
- Returns
- a truth catalog record and single-source image corresponding to the new source.
Definition at line 334 of file tests.py.
◆ drawGaussian()
def lsst.meas.base.tests.TestDataset.drawGaussian |
( |
|
bbox, |
|
|
|
flux, |
|
|
|
ellipse |
|
) |
| |
|
static |
Create an image of an elliptical Gaussian.
- Parameters
-
[in,out] | bbox | Bounding box of image to create. |
[in] | flux | Total flux of the Gaussian (normalized analytically, not using pixel values) |
[in] | ellipse | lsst.afw.geom.ellipses.Ellipse holding the centroid and shape. |
Definition at line 278 of file tests.py.
◆ makeEmptyExposure()
def lsst.meas.base.tests.TestDataset.makeEmptyExposure |
( |
|
bbox, |
|
|
|
wcs = None , |
|
|
|
crval = None , |
|
|
|
cdelt = None , |
|
|
|
psfSigma = 2.0 , |
|
|
|
psfDim = 17 , |
|
|
|
fluxMag0 = 1E12 |
|
) |
| |
|
static |
Create an Exposure, with a Calib, Wcs, and Psf, but no pixel values set.
- Parameters
-
[in] | bbox | Bounding box of the image (image coordinates) as returned by makeCatalog. |
[in] | wcs | New Wcs for the exposure (created from crval and cdelt if None). |
[in] | crval | afw.coord.Coord: center of the TAN WCS attached to the image. |
[in] | cdelt | afw.geom.Angle: pixel scale of the image |
[in] | psfSigma | Radius (sigma) of the Gaussian PSF attached to the image |
[in] | psfDim | Width and height of the image's Gaussian PSF attached to the image |
[in] | fluxMag0 | Flux at magnitude zero (in e-) used to set the Calib of the exposure. |
Definition at line 249 of file tests.py.
◆ makeMinimalSchema()
def lsst.meas.base.tests.TestDataset.makeMinimalSchema |
( |
|
cls | ) |
|
Return the minimal schema needed to hold truth catalog fields.
When TestDataset.realize() is called, the schema must include at least these fields.
Usually it will include additional fields for measurement algorithm outputs, allowing
the same catalog to be used for both truth values (the fields from the minimal schema)
and the measurements.
Definition at line 147 of file tests.py.
◆ makePerturbedWcs()
def lsst.meas.base.tests.TestDataset.makePerturbedWcs |
( |
|
oldWcs, |
|
|
|
minScaleFactor = 1.2 , |
|
|
|
maxScaleFactor = 1.5 , |
|
|
|
minRotation = None , |
|
|
|
maxRotation = None , |
|
|
|
minRefShift = None , |
|
|
|
maxRefShift = None , |
|
|
|
minPixShift = 2.0 , |
|
|
|
maxPixShift = 4.0 , |
|
|
|
randomSeed = None |
|
) |
| |
|
static |
Create a new undistorted TanWcs that is similar but not identical to another, with random scaling, rotation, and offset (in both pixel position and reference position).
The maximum and minimum arguments are interpreted as absolute values for a split range that covers both positive and negative values (as this method is used in testing, it is typically most important to avoid perturbations near zero). Scale factors are treated somewhat differently: the actual scale factor is chosen between minScaleFactor and maxScaleFactor OR (1/maxScaleFactor) and (1/minScaleFactor).
The default range for rotation is 30-60 degrees, and the default range for reference shift is 0.5-1.0 arcseconds (these cannot be safely included directly as default values because Angle objects are mutable).
The random number generator is primed with the seed given. If None
, a seed is automatically chosen.
Definition at line 187 of file tests.py.
◆ realize()
def lsst.meas.base.tests.TestDataset.realize |
( |
|
self, |
|
|
|
noise, |
|
|
|
schema, |
|
|
|
randomSeed = None |
|
) |
| |
Create a simulated with noise and a simulated post-detection catalog with (Heavy)Footprints.
- Parameters
-
[in] | noise | Standard deviation of noise to be added to the exposure. The noise will be Gaussian and constant, appropriate for the sky-limited regime. |
[in] | schema | Schema of the new catalog to be created. Must start with self.schema (i.e. schema.contains(self.schema) must be True), but typically contains fields for already-configured measurement algorithms as well. |
[in] | randomSeed | Seed for the random number generator. If None, a seed is chosen automatically. |
- Returns
- a tuple of (exposure, catalog)
Definition at line 428 of file tests.py.
◆ transform()
def lsst.meas.base.tests.TestDataset.transform |
( |
|
self, |
|
|
|
wcs, |
|
|
|
kwds |
|
) |
| |
Create a copy of the dataset transformed to a new WCS, with new Psf and Calib.
- Parameters
-
[in] | wcs | Wcs for the new dataset. |
[in] | **kwds | Additional keyword arguments passed on to makeEmptyExposure. If not specified, these revert to the defaults for makeEmptyExposure, not the values in the current dataset. |
Definition at line 388 of file tests.py.
◆ catalog
lsst.meas.base.tests.TestDataset.catalog |
◆ exposure
lsst.meas.base.tests.TestDataset.exposure |
◆ keys
lsst.meas.base.tests.TestDataset.keys |
◆ psfShape
lsst.meas.base.tests.TestDataset.psfShape |
◆ schema
lsst.meas.base.tests.TestDataset.schema |
◆ threshold
lsst.meas.base.tests.TestDataset.threshold |
The documentation for this class was generated from the following file: