lsst.meas.base
15.0-3-g6f085af+1
|
A simulated dataset consisting of a test image and an associated truth catalog. More...
Public Member Functions | |
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=1) |
Create a simulated with noise and a simulated post-detection catalog with (Heavy)Footprints. More... | |
Static Public Member Functions | |
def | makePerturbedWcs (oldWcs, minScaleFactor=1.2, maxScaleFactor=1.5, minRotation=None, maxRotation=None, minRefShift=None, maxRefShift=None, minPixShift=2.0, maxPixShift=4.0, randomSeed=1) |
Create a new undistorted TAN WCS 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... | |
Public Attributes | |
keys | |
threshold | |
exposure | |
psfShape | |
schema | |
catalog | |
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:
def lsst.meas.base.tests.TestDataset.__init__ | ( | self, | |
bbox, | |||
threshold = 10.0 , |
|||
exposure = None , |
|||
kwds | |||
) |
Initialize the dataset.
[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. |
def lsst.meas.base.tests.TestDataset.addBlend | ( | self | ) |
Return a context manager that allows a blend of multiple sources to be added.
Example:
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.
def lsst.meas.base.tests.TestDataset.addSource | ( | self, | |
flux, | |||
centroid, | |||
shape = None |
|||
) |
Add a source to the simulation.
[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.Quadrupole). Note that the truth catalog records post-convolution moments). If None, a point source will be added. |
|
static |
|
static |
Create an Exposure, with a Calib, Wcs, and Psf, but no pixel values set.
[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.geom.SpherePoint: ICRS 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. |
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.
|
static |
Create a new undistorted TAN WCS 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.
def lsst.meas.base.tests.TestDataset.realize | ( | self, | |
noise, | |||
schema, | |||
randomSeed = 1 |
|||
) |
Create a simulated with noise and a simulated post-detection catalog with (Heavy)Footprints.
[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. |
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.
[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. |