LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
ip_diffim
11.0+1
python
lsst
ip
diffim
makeRatingVector.py
Go to the documentation of this file.
1
# all the c++ level classes and routines
2
import
diffimLib
3
4
# all the other LSST packages
5
import
lsst.afw.image
as
afwImage
6
import
lsst.afw.math
as
afwMath
7
8
# Basically deprecated until SDQA is replaced
9
10
def
makeRatingVector
(kernelCellSet, spatialKernel, spatialBg):
11
imstats = diffimLib.ImageStatisticsF()
12
#sdqaVector = sdqa.SdqaRatingSet()
13
14
width, height = spatialKernel.getDimensions()
15
kImage = afwImage.ImageD(width, height)
16
# find the kernel sum and its Rms by looking at the 4 corners of the image
17
kSums = afwMath.vectorD()
18
for
x
in
(0, width):
19
for
y
in
(0, height):
20
kSum = spatialKernel.computeImage(kImage,
False
, x, y)
21
kSums.push_back(kSum)
22
23
#afwStat = afwMath.makeStatistics(kSums, afwMath.MEAN | afwMath.STDEV)
24
#kSumRating = sdqa.SdqaRating("lsst.ip.diffim.kernel_sum",
25
# afwStat.getValue(afwMath.MEAN),
26
# afwStat.getValue(afwMath.STDEV),
27
# scope)
28
#sdqaVector.append(kSumRating)
29
30
nGood = 0
31
nBad = 0
32
for
cell
in
kernelCellSet.getCellList():
33
for
cand
in
cell.begin(
False
):
# False = include bad candidates
34
cand = diffimLib.cast_KernelCandidateF(cand)
35
if
cand.getStatus() == afwMath.SpatialCellCandidate.GOOD:
36
# this has been used for processing
37
nGood += 1
38
39
xCand = int(cand.getXCenter())
40
yCand = int(cand.getYCenter())
41
42
# evaluate kernel and background at position of candidate
43
kSum = spatialKernel.computeImage(kImage,
False
, xCand, yCand)
44
kernel =
afwMath.FixedKernel
(kImage)
45
background = spatialBg(xCand, yCand)
46
47
diffIm = cand.getDifferenceImage(kernel, background)
48
imstats.apply(diffIm)
49
50
#candMean = imstats.getMean()
51
#candRms = imstats.getRms()
52
#candRating = sdqa.SdqaRating("lsst.ip.diffim.residuals_%d_%d" % (xCand, yCand),
53
# candMean, candRms, scope)
54
#sdqaVector.append(candRating)
55
elif
cand.getStatus() == afwMath.SpatialCellCandidate.BAD:
56
nBad += 1
57
58
#nGoodRating = sdqa.SdqaRating("lsst.ip.diffim.nCandGood", nGood, 0, scope)
59
#sdqaVector.append(nGoodRating)
60
#nBadRating = sdqa.SdqaRating("lsst.ip.diffim.nCandBad", nBad, 0, scope)
61
#sdqaVector.append(nBadRating)
62
63
nKernelTerms = spatialKernel.getNSpatialParameters()
64
if
nKernelTerms == 0:
# order 0
65
nKernelTerms = 1
66
#nBgTerms = len(spatialBg.getParameters())
67
#nKernRating = sdqa.SdqaRating("lsst.ip.diffim.nTermsSpatialKernel", nKernelTerms, 0, scope)
68
#nBgRating = sdqa.SdqaRating("lsst.ip.diffim.nTermsSpatialBg", nBgTerms, 0, scope)
69
#sdqaVector.append(nKernRating)
70
#sdqaVector.append(nBgRating)
71
72
#for i in range(sdqaVector.size()):
73
# pexLog.Trace("lsst.ip.diffim.makeSdqaRatingVector", 5,
74
# "Sdqa Rating %s : %.2f %.2f" % (sdqaVector[i].getName(),
75
# sdqaVector[i].getValue(),
76
# sdqaVector[i].getErr()))
77
#
78
#return sdqaVector
lsst::ip::diffim.makeRatingVector.makeRatingVector
def makeRatingVector
Definition:
makeRatingVector.py:10
lsst::afw::math
Definition:
Approximate.h:37
lsst::afw::image
Definition:
TanWcsFormatter.h:52
lsst::afw::math::FixedKernel
A kernel created from an Image.
Definition:
Kernel.h:551
Generated on Thu Sep 24 2015 02:29:19 for LSSTApplications by
1.8.5