lsst.jointcal  15.0-17-g076ea75+3
Functions
lsst.jointcal.testUtils Namespace Reference

Functions

def createTwoFakeCcdImages (num1=4, num2=4, seed=100)
 
def createFakeCcdImage (butler, visit, ccdId, num, instFluxKeyName, photoCalibMean=100.0, photoCalibErr=1.0)
 
def createFakeCatalog (num, bbox, instFluxKeyName, skyWcs=None, refCat=False)
 
def fillCatalog (schema, num, bbox, centroidKey, xErrKey, yErrKey, shapeKey, instFluxKeyName, skyWcs=None, fluxErrFraction=0.05, refCat=False)
 
def getMeasuredStarsFromCatalog (catalog, pixToFocal)
 

Function Documentation

◆ createFakeCatalog()

def lsst.jointcal.testUtils.createFakeCatalog (   num,
  bbox,
  instFluxKeyName,
  skyWcs = None,
  refCat = False 
)
Return a fake minimally-useful catalog for jointcal.

Parameters
----------
num : `int`
    Number of sources to put in the catalogs. Should be
    a square, to have sqrt(num) centroids on a grid.
bbox : `lsst.afw.geom.Box2I`
    Bounding Box of the detector to populate.
instFluxKeyName : `str`
    Name of the instFluxKey to populate in the catalog.
skyWcs : `lsst.afw.geom.SkyWcs` or None, optional
    If supplied, use this to fill in coordinates from centroids.
refCat : `bool`, optional
    Return a ``SimpleCatalog`` so that it behaves like a reference catalog?

Returns
-------
catalog : `lsst.afw.table.SourceCatalog`
    A populated source catalog.

Definition at line 141 of file testUtils.py.

◆ createFakeCcdImage()

def lsst.jointcal.testUtils.createFakeCcdImage (   butler,
  visit,
  ccdId,
  num,
  instFluxKeyName,
  photoCalibMean = 100.0,
  photoCalibErr = 1.0 
)
Create a fake CcdImage by making a fake catalog.

Parameters
----------
butler : `lsst.daf.persistence.Butler`
    Butler to load metadata from.
visit : `int`
    Visit identifier to build a butler dataId.
ccdId : `int`
    CCD identifier to build a butler dataId.
num : `int`
    Number of sources to put in the catalogs. Should be
    a square, to have sqrt(num) centroids on a grid.
instFluxKeyName : `str`
    Name of the instFluxKey to populate in the catalog.
photoCalibMean : `float`, optional
    Value to set for calibrationMean in the created PhotoCalib.
photoCalibErr : `float`, optional
    Value to set for calibrationErr in the created PhotoCalib.

Returns
-------
struct : `lsst.pipe.base.Struct`
   Result struct with components:

   - `catalog` : Catalogs containing fake sources
       (`lsst.afw.table.SourceCatalog`).
   - `ccdImage` : CcdImage containing the metadata and fake sources
       (`lsst.jointcal.CcdImage`).
   - `bbox` : Bounding Box of the image (`lsst.afw.geom.Box2I`).

Definition at line 94 of file testUtils.py.

◆ createTwoFakeCcdImages()

def lsst.jointcal.testUtils.createTwoFakeCcdImages (   num1 = 4,
  num2 = 4,
  seed = 100 
)
Return two fake ccdImages built on CFHT Megacam metadata.

If ``num1 == num2``, the catalogs will align on-sky so each source will
have a match in the other catalog.

This uses the butler dataset stored in `tests/data/cfht_minimal` to
bootstrap the metadata.

Parameters
----------
num1, num2 : `int`, optional
    Number of sources to put in the first and second catalogs. Should be
    a square, to have sqrt(num) centroids on a grid.
seed : `int`, optional
    Seed value for np.random.

Returns
-------
struct : `lsst.pipe.base.Struct`
   Result struct with components:

   - `camera` : Camera representing these catalogs
       (`lsst.afw.cameraGeom.Camera`).
   - `catalogs` : Catalogs containing fake sources
       (`list` of `lsst.afw.table.SourceCatalog`).
   - `ccdImageList` : CcdImages containing the metadata and fake sources
       (`list` of `lsst.jointcal.CcdImage`).
   - `bbox` : Bounding Box of the image (`lsst.afw.geom.Box2I`).

Definition at line 37 of file testUtils.py.

◆ fillCatalog()

def lsst.jointcal.testUtils.fillCatalog (   schema,
  num,
  bbox,
  centroidKey,
  xErrKey,
  yErrKey,
  shapeKey,
  instFluxKeyName,
  skyWcs = None,
  fluxErrFraction = 0.05,
  refCat = False 
)
Return a catalog populated with fake, but reasonable, sources.

Centroids are placed on a uniform grid, errors are normally distributed.

Parameters
----------
schema : `lsst.afw.table.Schema`
    Pre-built schema to make the catalog from.
num : `int`
    Number of sources to put in the catalog.
bbox : `lsst.afw.geom.Box2I`
    Bounding box of the ccd to put sources in.
centroidKey : `lsst.afw.table.Key`
    Key for the centroid field to populate.
xErrKey : `lsst.afw.table.Key`
    Key for the xErr field to populate.
yErrKey : `lsst.afw.table.Key`
    Key for the yErr field to populate.
shapeKey : `lsst.afw.table.Key`
    Key for the shape field to populate.
instFluxKeyName : `str`
    Name of instFlux field to populate (i.e. instFluxKeyName+'_flux')
skyWcs : `lsst.afw.geom.SkyWcs` or None, optional
    If supplied, use this to fill in coordinates from centroids.
fluxErrFraction : `float`, optional
    Fraction of instFlux to use for the instFluxErr.
refCat : `bool`, optional
    Return a ``SimpleCatalog`` so that it behaves like a reference catalog?

Returns
-------
catalog : `lsst.afw.table.SourceCatalog`
    The filled catalog.

Definition at line 185 of file testUtils.py.

◆ getMeasuredStarsFromCatalog()

def lsst.jointcal.testUtils.getMeasuredStarsFromCatalog (   catalog,
  pixToFocal 
)
Return a list of measuredStars built from a catalog.

Parameters
----------
catalog : `lsst.afw.table.SourceCatalog`
    The table to get sources from.
pixToFocal : `lsst.afw.geom.TransformPoint2ToPoint2`
    Transform that goes from pixel to focal plane coordinates, to set the
    MeasuredStar x/y focal points.

Returns
-------
stars : `list` of `lsst.jointcal.MeasuredStar`
    MeasuredStars built from the catalog sources.

Definition at line 259 of file testUtils.py.