CentroidConvolveTemplate

class lsst.ts.wep.centroid.CentroidConvolveTemplate

Bases: CentroidDefault

CentroidDefault child class to get the centroid of donut by convolution with a template donut image.

Methods Summary

getCenterAndR(imgDonut[, templateDonut, ...])

Get the centroid data and effective weighting radius.

getCenterAndRfromImgBinary(imgBinary[, ...])

Get the centroid data and effective weighting radius.

getCenterAndRfromTemplateConv(imageBinary[, ...])

Get the centers of the donuts by convolving a binary template image with the binary image of the donut or donuts.

getImgBinary(imgDonut)

Get the binary image.

Methods Documentation

getCenterAndR(imgDonut, templateDonut=None, peakThreshold=0.95)

Get the centroid data and effective weighting radius.

Parameters:
imgDonutnumpy.ndarray

Donut image.

templateDonutNone or numpy.ndarray, optional

Template image for a single donut. If set to None then the image will be convolved with itself. (The Default is None)

peakThresholdfloat, optional

This value is a specifies a number between 0 and 1 that is the fraction of the highest pixel value in the convolved image. The code then sets all pixels with a value below this to 0 before running the K-means algorithm to find peaks that represent possible donut locations. (The default is 0.95)

Returns:
float

Centroid x.

float

Centroid y.

float

Effective weighting radius.

getCenterAndRfromImgBinary(imgBinary, templateBinary=None, peakThreshold=0.95)

Get the centroid data and effective weighting radius.

Parameters:
imgBinarynumpy.ndarray

Binary image of donut.

templateBinaryNone or numpy.ndarray, optional

Binary image of template for a single donut. If set to None then the image will be convolved with itself. (The Default is None)

peakThresholdfloat, optional

This value is a specifies a number between 0 and 1 that is the fraction of the highest pixel value in the convolved image. The code then sets all pixels with a value below this to 0 before running the K-means algorithm to find peaks that represent possible donut locations. (The default is 0.95)

Returns:
float

Centroid x.

float

Centroid y.

float

Effective weighting radius.

getCenterAndRfromTemplateConv(imageBinary, templateImgBinary=None, nDonuts=1, peakThreshold=0.95, dbscanEps=5.0)

Get the centers of the donuts by convolving a binary template image with the binary image of the donut or donuts.

Peaks will appear as bright spots in the convolved image. Since we use binary images the brightness of the stars does not matter and the peaks of any stars in the image should have about the same brightness if the template is correct.

Parameters:
imageBinary: numpy.ndarray

Binary image of postage stamp.

templateImgBinary: None or numpy.ndarray, optional

Binary image of template donut. If set to None then the image is convolved with itself. (The default is None)

nDonuts: int, optional

Number of donuts there should be in the binary image. If the number is >= 1 then K-Means clustering will be used to return the specified number of donut centers. However, this can also be set to -1 if the number of donuts is unknown and it will perform DBSCAN clustering to find and return a set of donut centers. (The default is 1)

peakThreshold: float, optional

This value is a specifies a number between 0 and 1 that is the fraction of the highest pixel value in the convolved image. The code then sets all pixels with a value below this to 0 before running the K-means algorithm to find peaks that represent possible donut locations. (The default is 0.95)

dbscanEps: float, optional

Maximum distance scikit-learn DBSCAN algorithm allows “between two samples for one to considered in the neighborhood of the other”. (The default is 5.0)

Returns:
list

X pixel coordinates for donut centroid.

list

Y pixel coordinates for donut centroid.

float

Effective weighting radius calculated using the template image.

getImgBinary(imgDonut)

Get the binary image.

Parameters:
imgDonutnumpy.ndarray

Donut image to do the analysis.

Returns:
numpy.ndarray [int]

Binary image of donut.